moerfixes
This commit is contained in:
@@ -13,8 +13,7 @@ public partial class MediaButtonViewModel(IServiceFactory serviceFactory,
|
||||
string? text = null,
|
||||
string? icon = null,
|
||||
RelayCommand? command = null) :
|
||||
WidgetButtonViewModel(serviceFactory, mediator, disposer, templateFactory, guid, text, icon, command),
|
||||
IInitialization
|
||||
WidgetButtonViewModel(serviceFactory, mediator, disposer, templateFactory, guid, text, icon, command)
|
||||
{
|
||||
[ObservableProperty]
|
||||
private PlaybackButtonType playbackButtonType = playbackButtonType;
|
||||
@@ -38,6 +37,8 @@ public partial class MediaButtonViewModel(IServiceFactory serviceFactory,
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
//public override async Task InitializeAsync() =>
|
||||
//public override Task OnInitializeAsync()
|
||||
//{
|
||||
// await Mediator.PublishAsync<Request<PlaybackInformation>>();
|
||||
//}
|
||||
}
|
||||
|
||||
@@ -97,9 +97,15 @@ public class MediaController :
|
||||
GlobalSystemMediaTransportControlsSessionMediaProperties mediaProperties =
|
||||
await session.TryGetMediaPropertiesAsync();
|
||||
|
||||
IRandomAccessStreamWithContentType randomAccessStream = await mediaProperties.Thumbnail.OpenReadAsync();
|
||||
IRandomAccessStreamWithContentType? randomAccessStream = null;
|
||||
if (mediaProperties.Thumbnail is not null)
|
||||
{
|
||||
randomAccessStream =
|
||||
await mediaProperties.Thumbnail.OpenReadAsync();
|
||||
}
|
||||
|
||||
await mediator.PublishAsync(new Changed<MediaInformation>(new MediaInformation(mediaProperties.Title,
|
||||
mediaProperties.Artist, randomAccessStream.AsStream())));
|
||||
mediaProperties.Artist, randomAccessStream is not null ? randomAccessStream.AsStream() : default)));
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
@@ -27,7 +27,7 @@ public class MediaControllerService(IMediator mediator,
|
||||
|
||||
public Task StopAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
private async Task InitializeSessionAsync(GlobalSystemMediaTransportControlsSession session)
|
||||
|
||||
@@ -4,9 +4,8 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:windows="using:Hyperbar.UI.Windows">
|
||||
<Button>sfsdf</Button>
|
||||
<!--<FlipView
|
||||
<FlipView
|
||||
Width="360"
|
||||
ItemTemplateSelector="{Binding Converter={windows:DataTemplateConverter}}"
|
||||
ItemsSource="{Binding}" />-->
|
||||
ItemsSource="{Binding}" />
|
||||
</UserControl>
|
||||
|
||||
@@ -2,6 +2,6 @@
|
||||
|
||||
public record MediaInformation(string Title,
|
||||
string Description,
|
||||
Stream ThumbnailSource);
|
||||
Stream? ThumbnailSource);
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
|
||||
namespace Hyperbar.Widget.MediaController.Windows;
|
||||
|
||||
@@ -8,7 +7,6 @@ public partial class MediaInformationViewModel(IServiceFactory serviceFactory,
|
||||
IDisposer disposer,
|
||||
ITemplateFactory templateFactory) :
|
||||
WidgetComponentViewModel(serviceFactory, mediator, disposer, templateFactory),
|
||||
IInitialization,
|
||||
INotificationHandler<Changed<MediaInformation>>
|
||||
{
|
||||
[ObservableProperty]
|
||||
@@ -33,6 +31,6 @@ public partial class MediaInformationViewModel(IServiceFactory serviceFactory,
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
public override async Task InitializeAsync() =>
|
||||
public override async Task OnInitializeAsync() =>
|
||||
await Mediator.PublishAsync<Request<MediaInformation>>();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user