diff --git a/samples/NotificationFlyoutSample.Host/App.xaml b/samples/NotificationFlyoutSample.Launcher/App.xaml similarity index 100% rename from samples/NotificationFlyoutSample.Host/App.xaml rename to samples/NotificationFlyoutSample.Launcher/App.xaml diff --git a/samples/NotificationFlyoutSample.Host/App.xaml.cs b/samples/NotificationFlyoutSample.Launcher/App.xaml.cs similarity index 100% rename from samples/NotificationFlyoutSample.Host/App.xaml.cs rename to samples/NotificationFlyoutSample.Launcher/App.xaml.cs diff --git a/samples/NotificationFlyoutSample.Host/AssemblyInfo.cs b/samples/NotificationFlyoutSample.Launcher/AssemblyInfo.cs similarity index 100% rename from samples/NotificationFlyoutSample.Host/AssemblyInfo.cs rename to samples/NotificationFlyoutSample.Launcher/AssemblyInfo.cs diff --git a/samples/NotificationFlyoutSample.Host/NotificationFlyoutSample.Host.csproj b/samples/NotificationFlyoutSample.Launcher/NotificationFlyoutSample.Launcher.csproj similarity index 100% rename from samples/NotificationFlyoutSample.Host/NotificationFlyoutSample.Host.csproj rename to samples/NotificationFlyoutSample.Launcher/NotificationFlyoutSample.Launcher.csproj diff --git a/samples/NotificationFlyoutSample.Host/Program.cs b/samples/NotificationFlyoutSample.Launcher/Program.cs similarity index 89% rename from samples/NotificationFlyoutSample.Host/Program.cs rename to samples/NotificationFlyoutSample.Launcher/Program.cs index b6b01c8..a4e8bd8 100644 --- a/samples/NotificationFlyoutSample.Host/Program.cs +++ b/samples/NotificationFlyoutSample.Launcher/Program.cs @@ -13,7 +13,7 @@ namespace NotificationFlyoutSample.Host var app = new App(); new NotificationFlyoutApplication { - Flyout = new NowPlayingFlyout() + Flyout = new SampleFlyout() }; app.Run(); } diff --git a/samples/NotificationFlyoutSample/Assets/Notification-Icon-Playing-Light.png b/samples/NotificationFlyoutSample/Assets/Notification-Icon-Playing-Light.png deleted file mode 100644 index 366512d..0000000 Binary files a/samples/NotificationFlyoutSample/Assets/Notification-Icon-Playing-Light.png and /dev/null differ diff --git a/samples/NotificationFlyoutSample/Assets/Notification-Icon-Playing.png b/samples/NotificationFlyoutSample/Assets/Notification-Icon-Playing.png deleted file mode 100644 index 2ac72cd..0000000 Binary files a/samples/NotificationFlyoutSample/Assets/Notification-Icon-Playing.png and /dev/null differ diff --git a/samples/NotificationFlyoutSample/Assets/album.jpg b/samples/NotificationFlyoutSample/Assets/album.jpg deleted file mode 100644 index 3c26e63..0000000 Binary files a/samples/NotificationFlyoutSample/Assets/album.jpg and /dev/null differ diff --git a/samples/NotificationFlyoutSample/Assets/notification-icon-light.png b/samples/NotificationFlyoutSample/Assets/notification-icon-light.png deleted file mode 100644 index 051e167..0000000 Binary files a/samples/NotificationFlyoutSample/Assets/notification-icon-light.png and /dev/null differ diff --git a/samples/NotificationFlyoutSample/Assets/notification-icon.png b/samples/NotificationFlyoutSample/Assets/notification-icon.png deleted file mode 100644 index f6c45e0..0000000 Binary files a/samples/NotificationFlyoutSample/Assets/notification-icon.png and /dev/null differ diff --git a/samples/NotificationFlyoutSample/Class1.cs b/samples/NotificationFlyoutSample/Class1.cs deleted file mode 100644 index a574a9f..0000000 --- a/samples/NotificationFlyoutSample/Class1.cs +++ /dev/null @@ -1,253 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Text; -using System.Threading.Tasks; -using Windows.System; - -namespace NotificationFlyoutSample -{ - public static class DispatcherQueueExtensions - { - /// - /// Indicates whether or not is available. - /// - private static bool IsHasThreadAccessPropertyAvailable => true; - - public static Task EnqueueAsync(this DispatcherQueue dispatcher, Action function, DispatcherQueuePriority priority = DispatcherQueuePriority.Normal) - { - // Run the function directly when we have thread access. - // Also reuse Task.CompletedTask in case of success, - // to skip an unnecessary heap allocation for every invocation. - if (IsHasThreadAccessPropertyAvailable && dispatcher.HasThreadAccess) - { - try - { - function(); - - return Task.CompletedTask; - } - catch (Exception e) - { - return Task.FromException(e); - } - } - - static Task TryEnqueueAsync(DispatcherQueue dispatcher, Action function, DispatcherQueuePriority priority) - { - var taskCompletionSource = new TaskCompletionSource(); - - if (!dispatcher.TryEnqueue(priority, () => - { - try - { - function(); - - taskCompletionSource.SetResult(null); - } - catch (Exception e) - { - taskCompletionSource.SetException(e); - } - })) - { - taskCompletionSource.SetException(GetEnqueueException("Failed to enqueue the operation")); - } - - return taskCompletionSource.Task; - } - - return TryEnqueueAsync(dispatcher, function, priority); - } - - /// - /// Invokes a given function on the target and returns a - /// that completes when the invocation of the function is completed. - /// - /// The return type of to relay through the returned . - /// The target to invoke the code on. - /// The to invoke. - /// The priority level for the function to invoke. - /// A that completes when the invocation of is over. - /// If the current thread has access to , will be invoked directly. - public static Task EnqueueAsync(this DispatcherQueue dispatcher, Func function, DispatcherQueuePriority priority = DispatcherQueuePriority.Normal) - { - if (IsHasThreadAccessPropertyAvailable && dispatcher.HasThreadAccess) - { - try - { - return Task.FromResult(function()); - } - catch (Exception e) - { - return Task.FromException(e); - } - } - - static Task TryEnqueueAsync(DispatcherQueue dispatcher, Func function, DispatcherQueuePriority priority) - { - var taskCompletionSource = new TaskCompletionSource(); - - if (!dispatcher.TryEnqueue(priority, () => - { - try - { - taskCompletionSource.SetResult(function()); - } - catch (Exception e) - { - taskCompletionSource.SetException(e); - } - })) - { - taskCompletionSource.SetException(GetEnqueueException("Failed to enqueue the operation")); - } - - return taskCompletionSource.Task; - } - - return TryEnqueueAsync(dispatcher, function, priority); - } - - /// - /// Invokes a given function on the target and returns a - /// that acts as a proxy for the one returned by the given function. - /// - /// The target to invoke the code on. - /// The to invoke. - /// The priority level for the function to invoke. - /// A that acts as a proxy for the one returned by . - /// If the current thread has access to , will be invoked directly. - public static Task EnqueueAsync(this DispatcherQueue dispatcher, Func function, DispatcherQueuePriority priority = DispatcherQueuePriority.Normal) - { - // If we have thread access, we can retrieve the task directly. - // We don't use ConfigureAwait(false) in this case, in order - // to let the caller continue its execution on the same thread - // after awaiting the task returned by this function. - if (IsHasThreadAccessPropertyAvailable && dispatcher.HasThreadAccess) - { - try - { - if (function() is Task awaitableResult) - { - return awaitableResult; - } - - return Task.FromException(GetEnqueueException("The Task returned by function cannot be null.")); - } - catch (Exception e) - { - return Task.FromException(e); - } - } - - static Task TryEnqueueAsync(DispatcherQueue dispatcher, Func function, DispatcherQueuePriority priority) - { - var taskCompletionSource = new TaskCompletionSource(); - - if (!dispatcher.TryEnqueue(priority, async () => - { - try - { - if (function() is Task awaitableResult) - { - await awaitableResult.ConfigureAwait(false); - - taskCompletionSource.SetResult(null); - } - else - { - taskCompletionSource.SetException(GetEnqueueException("The Task returned by function cannot be null.")); - } - } - catch (Exception e) - { - taskCompletionSource.SetException(e); - } - })) - { - taskCompletionSource.SetException(GetEnqueueException("Failed to enqueue the operation")); - } - - return taskCompletionSource.Task; - } - - return TryEnqueueAsync(dispatcher, function, priority); - } - - /// - /// Invokes a given function on the target and returns a - /// that acts as a proxy for the one returned by the given function. - /// - /// The return type of to relay through the returned . - /// The target to invoke the code on. - /// The to invoke. - /// The priority level for the function to invoke. - /// A that relays the one returned by . - /// If the current thread has access to , will be invoked directly. - public static Task EnqueueAsync(this DispatcherQueue dispatcher, Func> function, DispatcherQueuePriority priority = DispatcherQueuePriority.Normal) - { - if (IsHasThreadAccessPropertyAvailable && dispatcher.HasThreadAccess) - { - try - { - if (function() is Task awaitableResult) - { - return awaitableResult; - } - - return Task.FromException(GetEnqueueException("The Task returned by function cannot be null.")); - } - catch (Exception e) - { - return Task.FromException(e); - } - } - - static Task TryEnqueueAsync(DispatcherQueue dispatcher, Func> function, DispatcherQueuePriority priority) - { - var taskCompletionSource = new TaskCompletionSource(); - - if (!dispatcher.TryEnqueue(priority, async () => - { - try - { - if (function() is Task awaitableResult) - { - var result = await awaitableResult.ConfigureAwait(false); - - taskCompletionSource.SetResult(result); - } - else - { - taskCompletionSource.SetException(GetEnqueueException("The Task returned by function cannot be null.")); - } - } - catch (Exception e) - { - taskCompletionSource.SetException(e); - } - })) - { - taskCompletionSource.SetException(GetEnqueueException("Failed to enqueue the operation")); - } - - return taskCompletionSource.Task; - } - - return TryEnqueueAsync(dispatcher, function, priority); - } - - /// - /// Creates an to return when an enqueue operation fails. - /// - /// The message of the exception. - /// An with a specified message. - [MethodImpl(MethodImplOptions.NoInlining)] - private static InvalidOperationException GetEnqueueException(string message) - { - return new InvalidOperationException(message); - } - } -} diff --git a/samples/NotificationFlyoutSample/INavigation.cs b/samples/NotificationFlyoutSample/INavigation.cs deleted file mode 100644 index 78df783..0000000 --- a/samples/NotificationFlyoutSample/INavigation.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace NotificationFlyoutSample -{ - public interface INavigation - { - void OnNavigatedTo(); - } -} diff --git a/samples/NotificationFlyoutSample/NotificationFlyoutSample.csproj b/samples/NotificationFlyoutSample/NotificationFlyoutSample.csproj index 32a7545..71b6b43 100644 --- a/samples/NotificationFlyoutSample/NotificationFlyoutSample.csproj +++ b/samples/NotificationFlyoutSample/NotificationFlyoutSample.csproj @@ -119,16 +119,9 @@ App.xaml - - - - NowPlayingPage.xaml - - - - - NowPlayingFlyout.xaml + + SampleFlyout.xaml @@ -137,11 +130,6 @@ - - - - - @@ -169,14 +157,10 @@ - + MSBuild:Compile Designer - - Designer - MSBuild:Compile - diff --git a/samples/NotificationFlyoutSample/NotificationFlyoutSample.sln b/samples/NotificationFlyoutSample/NotificationFlyoutSample.sln index 93bc199..199991f 100644 --- a/samples/NotificationFlyoutSample/NotificationFlyoutSample.sln +++ b/samples/NotificationFlyoutSample/NotificationFlyoutSample.sln @@ -18,10 +18,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TheXamlGuy.NotificationFlyo EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "TheXamlGuy.NotificationFlyout.Wpf.UI.Controls", "..\..\src\TheXamlGuy.NotificationFlyout.Wpf.UI.Controls\TheXamlGuy.NotificationFlyout.Wpf.UI.Controls.csproj", "{0AB1D328-BBB0-434B-965A-48ACDB6CBFB7}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotificationFlyoutSample.Host", "..\NotificationFlyoutSample.Host\NotificationFlyoutSample.Host.csproj", "{EC9E370A-E28A-483E-8DBA-E1BD56CAA51B}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NotificationFlyoutSample", "NotificationFlyoutSample.csproj", "{2057ADE0-C61E-45EE-BB7E-A469FE4D4C41}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotificationFlyoutSample.Launcher", "..\NotificationFlyoutSample.Launcher\NotificationFlyoutSample.Launcher.csproj", "{DB86CC51-8AA1-46A4-B382-B05DE08E0FF6}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -136,26 +136,6 @@ Global {0AB1D328-BBB0-434B-965A-48ACDB6CBFB7}.Release|x64.Build.0 = Release|x64 {0AB1D328-BBB0-434B-965A-48ACDB6CBFB7}.Release|x86.ActiveCfg = Release|Any CPU {0AB1D328-BBB0-434B-965A-48ACDB6CBFB7}.Release|x86.Build.0 = Release|Any CPU - {EC9E370A-E28A-483E-8DBA-E1BD56CAA51B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {EC9E370A-E28A-483E-8DBA-E1BD56CAA51B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {EC9E370A-E28A-483E-8DBA-E1BD56CAA51B}.Debug|ARM.ActiveCfg = Debug|Any CPU - {EC9E370A-E28A-483E-8DBA-E1BD56CAA51B}.Debug|ARM.Build.0 = Debug|Any CPU - {EC9E370A-E28A-483E-8DBA-E1BD56CAA51B}.Debug|ARM64.ActiveCfg = Debug|Any CPU - {EC9E370A-E28A-483E-8DBA-E1BD56CAA51B}.Debug|ARM64.Build.0 = Debug|Any CPU - {EC9E370A-E28A-483E-8DBA-E1BD56CAA51B}.Debug|x64.ActiveCfg = Debug|x64 - {EC9E370A-E28A-483E-8DBA-E1BD56CAA51B}.Debug|x64.Build.0 = Debug|x64 - {EC9E370A-E28A-483E-8DBA-E1BD56CAA51B}.Debug|x86.ActiveCfg = Debug|Any CPU - {EC9E370A-E28A-483E-8DBA-E1BD56CAA51B}.Debug|x86.Build.0 = Debug|Any CPU - {EC9E370A-E28A-483E-8DBA-E1BD56CAA51B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {EC9E370A-E28A-483E-8DBA-E1BD56CAA51B}.Release|Any CPU.Build.0 = Release|Any CPU - {EC9E370A-E28A-483E-8DBA-E1BD56CAA51B}.Release|ARM.ActiveCfg = Release|Any CPU - {EC9E370A-E28A-483E-8DBA-E1BD56CAA51B}.Release|ARM.Build.0 = Release|Any CPU - {EC9E370A-E28A-483E-8DBA-E1BD56CAA51B}.Release|ARM64.ActiveCfg = Release|Any CPU - {EC9E370A-E28A-483E-8DBA-E1BD56CAA51B}.Release|ARM64.Build.0 = Release|Any CPU - {EC9E370A-E28A-483E-8DBA-E1BD56CAA51B}.Release|x64.ActiveCfg = Release|x64 - {EC9E370A-E28A-483E-8DBA-E1BD56CAA51B}.Release|x64.Build.0 = Release|x64 - {EC9E370A-E28A-483E-8DBA-E1BD56CAA51B}.Release|x86.ActiveCfg = Release|Any CPU - {EC9E370A-E28A-483E-8DBA-E1BD56CAA51B}.Release|x86.Build.0 = Release|Any CPU {2057ADE0-C61E-45EE-BB7E-A469FE4D4C41}.Debug|Any CPU.ActiveCfg = Debug|x86 {2057ADE0-C61E-45EE-BB7E-A469FE4D4C41}.Debug|ARM.ActiveCfg = Debug|ARM {2057ADE0-C61E-45EE-BB7E-A469FE4D4C41}.Debug|ARM.Build.0 = Debug|ARM @@ -182,6 +162,26 @@ Global {2057ADE0-C61E-45EE-BB7E-A469FE4D4C41}.Release|x86.ActiveCfg = Release|x86 {2057ADE0-C61E-45EE-BB7E-A469FE4D4C41}.Release|x86.Build.0 = Release|x86 {2057ADE0-C61E-45EE-BB7E-A469FE4D4C41}.Release|x86.Deploy.0 = Release|x86 + {DB86CC51-8AA1-46A4-B382-B05DE08E0FF6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DB86CC51-8AA1-46A4-B382-B05DE08E0FF6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DB86CC51-8AA1-46A4-B382-B05DE08E0FF6}.Debug|ARM.ActiveCfg = Debug|Any CPU + {DB86CC51-8AA1-46A4-B382-B05DE08E0FF6}.Debug|ARM.Build.0 = Debug|Any CPU + {DB86CC51-8AA1-46A4-B382-B05DE08E0FF6}.Debug|ARM64.ActiveCfg = Debug|Any CPU + {DB86CC51-8AA1-46A4-B382-B05DE08E0FF6}.Debug|ARM64.Build.0 = Debug|Any CPU + {DB86CC51-8AA1-46A4-B382-B05DE08E0FF6}.Debug|x64.ActiveCfg = Debug|x64 + {DB86CC51-8AA1-46A4-B382-B05DE08E0FF6}.Debug|x64.Build.0 = Debug|x64 + {DB86CC51-8AA1-46A4-B382-B05DE08E0FF6}.Debug|x86.ActiveCfg = Debug|Any CPU + {DB86CC51-8AA1-46A4-B382-B05DE08E0FF6}.Debug|x86.Build.0 = Debug|Any CPU + {DB86CC51-8AA1-46A4-B382-B05DE08E0FF6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DB86CC51-8AA1-46A4-B382-B05DE08E0FF6}.Release|Any CPU.Build.0 = Release|Any CPU + {DB86CC51-8AA1-46A4-B382-B05DE08E0FF6}.Release|ARM.ActiveCfg = Release|Any CPU + {DB86CC51-8AA1-46A4-B382-B05DE08E0FF6}.Release|ARM.Build.0 = Release|Any CPU + {DB86CC51-8AA1-46A4-B382-B05DE08E0FF6}.Release|ARM64.ActiveCfg = Release|Any CPU + {DB86CC51-8AA1-46A4-B382-B05DE08E0FF6}.Release|ARM64.Build.0 = Release|Any CPU + {DB86CC51-8AA1-46A4-B382-B05DE08E0FF6}.Release|x64.ActiveCfg = Release|x64 + {DB86CC51-8AA1-46A4-B382-B05DE08E0FF6}.Release|x64.Build.0 = Release|x64 + {DB86CC51-8AA1-46A4-B382-B05DE08E0FF6}.Release|x86.ActiveCfg = Release|Any CPU + {DB86CC51-8AA1-46A4-B382-B05DE08E0FF6}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/samples/NotificationFlyoutSample/NowPlayingFlyout.xaml b/samples/NotificationFlyoutSample/NowPlayingFlyout.xaml deleted file mode 100644 index 8ff6dfa..0000000 --- a/samples/NotificationFlyoutSample/NowPlayingFlyout.xaml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/samples/NotificationFlyoutSample/NowPlayingPage.xaml b/samples/NotificationFlyoutSample/NowPlayingPage.xaml deleted file mode 100644 index c4886b8..0000000 --- a/samples/NotificationFlyoutSample/NowPlayingPage.xaml +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/NotificationFlyoutSample/NowPlayingPage.xaml.cs b/samples/NotificationFlyoutSample/NowPlayingPage.xaml.cs deleted file mode 100644 index 2425dbb..0000000 --- a/samples/NotificationFlyoutSample/NowPlayingPage.xaml.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Navigation; - -namespace NotificationFlyoutSample -{ - public sealed partial class NowPlayingPage : Page - { - public NowPlayingPage() - { - InitializeComponent(); - - ViewModel = new NowPlayingPageViewModel(); - DataContext = ViewModel; - } - - public NowPlayingPageViewModel ViewModel { get; } - - protected override void OnNavigatedTo(NavigationEventArgs args) - { - if (DataContext is INavigation navigation) - { - navigation.OnNavigatedTo(); - } - - base.OnNavigatedTo(args); - } - } -} diff --git a/samples/NotificationFlyoutSample/NowPlayingPageViewModel.cs b/samples/NotificationFlyoutSample/NowPlayingPageViewModel.cs deleted file mode 100644 index 56fe897..0000000 --- a/samples/NotificationFlyoutSample/NowPlayingPageViewModel.cs +++ /dev/null @@ -1,121 +0,0 @@ -using System; -using System.Threading.Tasks; -using Windows.ApplicationModel.Core; -using Windows.Media.Control; -using Windows.Storage.Streams; -using Windows.System; -using Windows.UI.Core; -using Windows.UI.Xaml.Media.Imaging; - -namespace NotificationFlyoutSample -{ - - public class NowPlayingPageViewModel : ObservableObject, INavigation - { - private string _artist; - private bool _isPlaying; - private bool _isPaused; - private GlobalSystemMediaTransportControlsSession _session; - private string _song; - private BitmapImage _thumbnail; - - public bool IsPaused - { - get => _isPaused; - set => SetProperty(ref _isPaused, value); - } - - public string Artist - { - get => _artist; - set => SetProperty(ref _artist, value); - } - - public bool IsPlaying - { - get => _isPlaying; - set => SetProperty(ref _isPlaying, value); - } - - public string Song - { - get => _song; - set => SetProperty(ref _song, value); - } - - public async Task Next() - { - await _session.TrySkipNextAsync(); - } - - DispatcherQueue d; - public async void OnNavigatedTo() - { - d = DispatcherQueue.GetForCurrentThread(); - - var sessionManager = await GlobalSystemMediaTransportControlsSessionManager.RequestAsync(); - _session = sessionManager.GetCurrentSession(); - if (_session != null) - { - _session.MediaPropertiesChanged += OnMediaPropertiesChanged; - } - } - - public BitmapImage Thumbnail - { - get => _thumbnail; - set => SetProperty(ref _thumbnail, value); - } - - private async void OnMediaPropertiesChanged(GlobalSystemMediaTransportControlsSession sender, MediaPropertiesChangedEventArgs args) - { - var mediaProperties = await _session.TryGetMediaPropertiesAsync(); - - await d.EnqueueAsync(async () => { - Artist = mediaProperties.Artist; - - var foo = mediaProperties.Thumbnail; - - - if (foo != null) - { - var f = await foo.OpenReadAsync(); - var image = new BitmapImage(); - await image.SetSourceAsync(f); - - Thumbnail = image; - } - }); - - } - - public async Task Pause() - { - var result = await _session.TryPauseAsync().AsTask().ConfigureAwait(false); - if (result) - { - IsPlaying = false; - } - } - - public async Task Play() - { - await _session.TryPlayAsync().AsTask().ConfigureAwait(false); - } - - public async Task Previous() - { - await _session.TrySkipPreviousAsync().AsTask().ConfigureAwait(false); - } - - private async Task UpdateNowPlaying() - { - var playbackInfo = _session.GetPlaybackInfo(); - var mediaProperties = await _session.TryGetMediaPropertiesAsync(); - - Artist = mediaProperties.Artist; - Song = mediaProperties.Title; - - } - } -} diff --git a/samples/NotificationFlyoutSample/ObservableObject.cs b/samples/NotificationFlyoutSample/ObservableObject.cs deleted file mode 100644 index cb4d71e..0000000 --- a/samples/NotificationFlyoutSample/ObservableObject.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Runtime.CompilerServices; - -namespace NotificationFlyoutSample -{ - public class ObservableObject : INotifyPropertyChanged - { - public event PropertyChangedEventHandler PropertyChanged; - - public virtual void OnPropertyChanged([CallerMemberName] string propertyName = "") => PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - - protected virtual bool SetProperty(ref T backingStore, T value, [CallerMemberName] string propertyName = "", - Action onChanged = null, Func validateValue = null) - { - if (EqualityComparer.Default.Equals(backingStore, value)) - return false; - - if (validateValue != null && !validateValue(backingStore, value)) - return false; - - backingStore = value; - onChanged?.Invoke(); - OnPropertyChanged(propertyName); - return true; - } - } -} diff --git a/samples/NotificationFlyoutSample/SampleFlyout.xaml b/samples/NotificationFlyoutSample/SampleFlyout.xaml new file mode 100644 index 0000000..5a97eb2 --- /dev/null +++ b/samples/NotificationFlyoutSample/SampleFlyout.xaml @@ -0,0 +1,12 @@ + + +