From 84afcf0be343d9c2a97c61c3e9b27e937f2ca394 Mon Sep 17 00:00:00 2001 From: Daniel Clark Date: Fri, 12 Feb 2021 23:23:41 +0000 Subject: [PATCH] refactoring for the next stage --- .../NotificationFlyoutSample.Host/App.xaml | 2 +- .../NotificationFlyoutSample.Host/App.xaml.cs | 10 +- .../AssemblyInfo.cs | 2 +- .../NotificationFlyoutSample.Host/Program.cs | 4 +- samples/NotificationFlyoutSample.sln | 32 ---- samples/NotificationFlyoutSample/App.xaml | 2 +- samples/NotificationFlyoutSample/App.xaml.cs | 2 +- .../Properties/AssemblyInfo.cs | 7 +- .../Properties/Default.rd.xml | 7 +- samples/NotificationFlyoutSample/Shell.xaml | 15 +- .../NotificationFlyoutSample/Shell.xaml.cs | 4 +- .../WindowContent.xaml | 2 +- .../WindowContent.xaml.cs | 17 +- .../NotificationFlyout.Uwp.UI.Controls.csproj | 2 +- .../ContextMenuFlyoutHost.cs | 55 ------ .../NotificationFlyout/NotificationFlyout.cs | 105 ++++-------- .../NotificationFlyoutContextMenu.cs | 25 +++ ...NotificationFlyoutContextMenuFlyoutHost.cs | 100 +++++++++++ ...ificationFlyoutContextMenuFlyoutHost.xaml} | 4 +- .../NotificationFlyoutHost.cs | 24 ++- ...ficationFlyoutMenuItemsChangedEventArgs.cs | 19 +++ .../NotificationFlyoutPresenter.cs | 5 +- .../NotificationFlyoutPresenter.xaml | 2 +- .../Properties/AssemblyInfo.cs | 2 +- .../Themes/Generic.xaml | 2 +- .../Extensions/ExecutionMode.cs | 2 +- .../Extensions/ImageSourceExtensions.cs | 9 +- .../INotificationFlyoutApplication.cs | 2 +- .../NotificationFlyoutApplication.cs | 47 ++--- .../NotificationFlyoutContextMenuXamlHost.cs | 44 +++++ .../NotificationFlyoutXamlHost.cs | 160 ++++++++---------- .../NotificationFlyoutContextMenuXamlHost.cs | 78 --------- .../XamlHost/XamlHost.cs | 3 +- .../Extensions/ImageSourceExtensions.cs | 2 +- .../Extensions/OperatingSystemExtensions.cs | 2 +- .../Extensions/OperatingSystemVersion.cs | 2 +- .../Extensions/RECTExtensions.cs | 2 +- .../Extensions/RegistryKeyExtensions.cs | 2 +- .../Extensions/VisualExtensions.cs | 2 +- .../Extensions/WindowExtensions.cs | 4 +- .../Helpers/CursorHelper.cs | 4 +- .../Helpers/NotificationIconHelper.cs | 3 +- .../Helpers/SystemInformationHelper.cs | 2 +- .../Helpers/SystemPersonalisationHelper.cs | 2 +- .../Helpers/SystemTheme.cs | 2 +- .../Helpers/TaskbarHelper.cs | 2 +- .../Helpers/TaskbarPosition.cs | 1 - .../Helpers/ThemeChangedEventArgs.cs | 3 +- .../Helpers/WindowHelper.cs | 6 +- src/NotificationFlyout.Wpf.UI/Screen.cs | 12 +- 50 files changed, 389 insertions(+), 460 deletions(-) delete mode 100644 src/NotificationFlyout.Uwp.UI.Controls/NotificationFlyout/ContextMenuFlyoutHost.cs create mode 100644 src/NotificationFlyout.Uwp.UI.Controls/NotificationFlyout/NotificationFlyoutContextMenu.cs create mode 100644 src/NotificationFlyout.Uwp.UI.Controls/NotificationFlyout/NotificationFlyoutContextMenuFlyoutHost.cs rename src/NotificationFlyout.Uwp.UI.Controls/NotificationFlyout/{ContextMenuFlyoutHost.xaml => NotificationFlyoutContextMenuFlyoutHost.xaml} (78%) create mode 100644 src/NotificationFlyout.Uwp.UI.Controls/NotificationFlyout/NotificationFlyoutMenuItemsChangedEventArgs.cs create mode 100644 src/NotificationFlyout.Wpf.UI.Controls/NotificationFlyout/NotificationFlyoutContextMenuXamlHost.cs rename src/NotificationFlyout.Wpf.UI.Controls/{XamlHost => NotificationFlyout}/NotificationFlyoutXamlHost.cs (70%) delete mode 100644 src/NotificationFlyout.Wpf.UI.Controls/XamlHost/NotificationFlyoutContextMenuXamlHost.cs diff --git a/samples/NotificationFlyoutSample.Host/App.xaml b/samples/NotificationFlyoutSample.Host/App.xaml index acca37f..15ff085 100644 --- a/samples/NotificationFlyoutSample.Host/App.xaml +++ b/samples/NotificationFlyoutSample.Host/App.xaml @@ -3,4 +3,4 @@ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> - + \ No newline at end of file diff --git a/samples/NotificationFlyoutSample.Host/App.xaml.cs b/samples/NotificationFlyoutSample.Host/App.xaml.cs index 83f9881..dda90fb 100644 --- a/samples/NotificationFlyoutSample.Host/App.xaml.cs +++ b/samples/NotificationFlyoutSample.Host/App.xaml.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Configuration; -using System.Data; -using System.Linq; -using System.Threading.Tasks; -using System.Windows; +using System.Windows; namespace NotificationFlyoutSample.Host { @@ -14,4 +8,4 @@ namespace NotificationFlyoutSample.Host public partial class App : Application { } -} +} \ No newline at end of file diff --git a/samples/NotificationFlyoutSample.Host/AssemblyInfo.cs b/samples/NotificationFlyoutSample.Host/AssemblyInfo.cs index 8b5504e..4f943de 100644 --- a/samples/NotificationFlyoutSample.Host/AssemblyInfo.cs +++ b/samples/NotificationFlyoutSample.Host/AssemblyInfo.cs @@ -7,4 +7,4 @@ using System.Windows; ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located //(used if a resource is not found in the page, // app, or any theme specific resource dictionaries) -)] +)] \ No newline at end of file diff --git a/samples/NotificationFlyoutSample.Host/Program.cs b/samples/NotificationFlyoutSample.Host/Program.cs index 9195f20..80b39c0 100644 --- a/samples/NotificationFlyoutSample.Host/Program.cs +++ b/samples/NotificationFlyoutSample.Host/Program.cs @@ -12,11 +12,11 @@ namespace NotificationFlyoutSample.Host { var app = new App(); new NotificationFlyoutApplication - { + { Flyout = new Shell() }; app.Run(); } } } -} +} \ No newline at end of file diff --git a/samples/NotificationFlyoutSample.sln b/samples/NotificationFlyoutSample.sln index 9079ea8..909956b 100644 --- a/samples/NotificationFlyoutSample.sln +++ b/samples/NotificationFlyoutSample.sln @@ -18,8 +18,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotificationFlyout.Wpf.UI", EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotificationFlyout.Wpf.UI.Controls", "..\src\NotificationFlyout.Wpf.UI.Controls\NotificationFlyout.Wpf.UI.Controls.csproj", "{094A2030-C430-490B-AB26-205385A0D4BF}" EndProject -Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "NotificationFlyoutSample.Package", "NotificationFlyoutSample.Package\NotificationFlyoutSample.Package.wapproj", "{E2F52D15-A3BB-41CE-901C-AB491C50327A}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NotificationFlyout.Uwp.UI", "..\src\NotificationFlyout.Uwp.UI\NotificationFlyout.Uwp.UI.csproj", "{AFCE4980-A641-4BBB-A745-F0D4E54A0D86}" EndProject Global @@ -143,36 +141,6 @@ Global {094A2030-C430-490B-AB26-205385A0D4BF}.Release|x64.Build.0 = Release|x64 {094A2030-C430-490B-AB26-205385A0D4BF}.Release|x86.ActiveCfg = Release|Any CPU {094A2030-C430-490B-AB26-205385A0D4BF}.Release|x86.Build.0 = Release|Any CPU - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|Any CPU.ActiveCfg = Debug|x64 - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|Any CPU.Build.0 = Debug|x64 - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|Any CPU.Deploy.0 = Debug|x64 - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|ARM.ActiveCfg = Debug|ARM - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|ARM.Build.0 = Debug|ARM - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|ARM.Deploy.0 = Debug|ARM - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|ARM64.ActiveCfg = Debug|ARM64 - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|ARM64.Build.0 = Debug|ARM64 - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|ARM64.Deploy.0 = Debug|ARM64 - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|x64.ActiveCfg = Debug|x64 - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|x64.Build.0 = Debug|x64 - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|x64.Deploy.0 = Debug|x64 - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|x86.ActiveCfg = Debug|x86 - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|x86.Build.0 = Debug|x86 - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Debug|x86.Deploy.0 = Debug|x86 - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|Any CPU.Build.0 = Release|Any CPU - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|Any CPU.Deploy.0 = Release|Any CPU - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|ARM.ActiveCfg = Release|ARM - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|ARM.Build.0 = Release|ARM - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|ARM.Deploy.0 = Release|ARM - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|ARM64.ActiveCfg = Release|ARM64 - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|ARM64.Build.0 = Release|ARM64 - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|ARM64.Deploy.0 = Release|ARM64 - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|x64.ActiveCfg = Release|x64 - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|x64.Build.0 = Release|x64 - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|x64.Deploy.0 = Release|x64 - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|x86.ActiveCfg = Release|x86 - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|x86.Build.0 = Release|x86 - {E2F52D15-A3BB-41CE-901C-AB491C50327A}.Release|x86.Deploy.0 = Release|x86 {AFCE4980-A641-4BBB-A745-F0D4E54A0D86}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {AFCE4980-A641-4BBB-A745-F0D4E54A0D86}.Debug|Any CPU.Build.0 = Debug|Any CPU {AFCE4980-A641-4BBB-A745-F0D4E54A0D86}.Debug|ARM.ActiveCfg = Debug|Any CPU diff --git a/samples/NotificationFlyoutSample/App.xaml b/samples/NotificationFlyoutSample/App.xaml index 82efc8e..d667a0b 100644 --- a/samples/NotificationFlyoutSample/App.xaml +++ b/samples/NotificationFlyoutSample/App.xaml @@ -6,4 +6,4 @@ - + \ No newline at end of file diff --git a/samples/NotificationFlyoutSample/App.xaml.cs b/samples/NotificationFlyoutSample/App.xaml.cs index ed596a9..a6ced91 100644 --- a/samples/NotificationFlyoutSample/App.xaml.cs +++ b/samples/NotificationFlyoutSample/App.xaml.cs @@ -9,4 +9,4 @@ namespace NotificationFlyoutSample Initialize(); } } -} +} \ No newline at end of file diff --git a/samples/NotificationFlyoutSample/Properties/AssemblyInfo.cs b/samples/NotificationFlyoutSample/Properties/AssemblyInfo.cs index 16d6268..2cfc1ca 100644 --- a/samples/NotificationFlyoutSample/Properties/AssemblyInfo.cs +++ b/samples/NotificationFlyoutSample/Properties/AssemblyInfo.cs @@ -1,8 +1,7 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -// General Information about an assembly is controlled through the following +// General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. [assembly: AssemblyTitle("NotificationFlyoutSample")] @@ -17,11 +16,11 @@ using System.Runtime.InteropServices; // Version information for an assembly consists of the following four values: // // Major Version -// Minor Version +// Minor Version // Build Number // Revision // -// You can specify all the values or you can default the Build and Revision Numbers +// You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] diff --git a/samples/NotificationFlyoutSample/Properties/Default.rd.xml b/samples/NotificationFlyoutSample/Properties/Default.rd.xml index af00722..7454086 100644 --- a/samples/NotificationFlyoutSample/Properties/Default.rd.xml +++ b/samples/NotificationFlyoutSample/Properties/Default.rd.xml @@ -6,7 +6,7 @@ Runtime Directives are documented at https://go.microsoft.com/fwlink/?LinkID=391919 To fully enable reflection for App1.MyClass and all of its public/private members - + To enable dynamic creation of the specific instantiation of AppClass over System.Int32 @@ -22,10 +22,7 @@ the application package. The asterisks are not wildcards. --> - - + - - \ No newline at end of file diff --git a/samples/NotificationFlyoutSample/Shell.xaml b/samples/NotificationFlyoutSample/Shell.xaml index 3f44d5d..265763a 100644 --- a/samples/NotificationFlyoutSample/Shell.xaml +++ b/samples/NotificationFlyoutSample/Shell.xaml @@ -6,9 +6,11 @@ xmlns:muxc="using:Microsoft.UI.Xaml.Controls" IconSource="/Assets/Icon.ico" LightIconSource="/Assets/Icon-Light.ico"> - - - + + + + + -