From c997f7d9117e25ba37382c7382f470fed2662df8 Mon Sep 17 00:00:00 2001 From: Christoph Hofmann Date: Mon, 30 Sep 2024 09:31:42 +0200 Subject: [PATCH] Refactor and update packages, add MainUIPage Updated package references in multiple project files, including `Microsoft.WindowsAppSDK` and `Microsoft.Windows.SDK.BuildTools`. Added new resource entry for `MenuItemMainUI.Content`. Cleaned up unused `using` directives and namespaces. Modified `MainWindow.xaml` to use `Binding` instead of `x:Bind` and added a new `NavigationViewItem` for `MainUI`. Added event handler for `MainUIPage` navigation. Removed `WinUIPage` and introduced `MainUIPage` with `WebView2` control. Updated project files accordingly. Made minor UI changes in `SitemapPage.xaml` and cleaned up unused XML namespaces in `MainPage.xaml`. Upgraded `Mapsui` packages to version `4.1.6`. --- src/openHAB.Common/openHAB.Common.csproj | 4 +-- .../openHAB.Core.Client.csproj | 4 +-- src/openHAB.Core/Openhab.Core.csproj | 6 ++-- src/openHAB.Core/Strings/de-de/Resources.resw | 3 ++ src/openHAB.Core/Strings/en-us/Resources.resw | 3 ++ src/openHAB.Windows/App.xaml.cs | 6 +--- src/openHAB.Windows/MainWindow.xaml | 18 ++++------- src/openHAB.Windows/MainWindow.xaml.cs | 11 ++++--- src/openHAB.Windows/View/MainPage.xaml | 9 ------ src/openHAB.Windows/View/MainUIPage.xaml | 11 +++++++ src/openHAB.Windows/View/MainUIPage.xaml.cs | 15 +++++++++ src/openHAB.Windows/View/SitemapPage.xaml | 3 -- src/openHAB.Windows/View/WinUIPage.xaml | 15 --------- src/openHAB.Windows/View/WinUIPage.xaml.cs | 31 ------------------- .../ViewModel/MainViewModel.cs | 12 +++---- src/openHAB.Windows/openHAB.Windows.csproj | 12 +++---- 16 files changed, 65 insertions(+), 98 deletions(-) create mode 100644 src/openHAB.Windows/View/MainUIPage.xaml create mode 100644 src/openHAB.Windows/View/MainUIPage.xaml.cs delete mode 100644 src/openHAB.Windows/View/WinUIPage.xaml delete mode 100644 src/openHAB.Windows/View/WinUIPage.xaml.cs diff --git a/src/openHAB.Common/openHAB.Common.csproj b/src/openHAB.Common/openHAB.Common.csproj index bf581cc9..f7f18e04 100644 --- a/src/openHAB.Common/openHAB.Common.csproj +++ b/src/openHAB.Common/openHAB.Common.csproj @@ -8,7 +8,7 @@ - - + + diff --git a/src/openHAB.Core.Client/openHAB.Core.Client.csproj b/src/openHAB.Core.Client/openHAB.Core.Client.csproj index 4552f333..8813502c 100644 --- a/src/openHAB.Core.Client/openHAB.Core.Client.csproj +++ b/src/openHAB.Core.Client/openHAB.Core.Client.csproj @@ -19,8 +19,8 @@ - - + + 8.0.0 diff --git a/src/openHAB.Core/Openhab.Core.csproj b/src/openHAB.Core/Openhab.Core.csproj index 31c53749..7da21416 100644 --- a/src/openHAB.Core/Openhab.Core.csproj +++ b/src/openHAB.Core/Openhab.Core.csproj @@ -30,13 +30,13 @@ - 1.5.240311000 + 1.5.240607001 13.0.3 - 5.3.8 + 5.3.11 1.1.118 @@ -46,7 +46,7 @@ all - + diff --git a/src/openHAB.Core/Strings/de-de/Resources.resw b/src/openHAB.Core/Strings/de-de/Resources.resw index d420bc76..28f0ab07 100644 --- a/src/openHAB.Core/Strings/de-de/Resources.resw +++ b/src/openHAB.Core/Strings/de-de/Resources.resw @@ -341,4 +341,7 @@ Bitte wählen Sie den Demomodus oder die Lokale-/Remote-Verbindungsinformation z Hochauflösende Icons + + MainUI + \ No newline at end of file diff --git a/src/openHAB.Core/Strings/en-us/Resources.resw b/src/openHAB.Core/Strings/en-us/Resources.resw index 39151f2d..0f1bac23 100644 --- a/src/openHAB.Core/Strings/en-us/Resources.resw +++ b/src/openHAB.Core/Strings/en-us/Resources.resw @@ -348,4 +348,7 @@ Please select demo mode or configure local/remote connection. High resolution icons + + MainUI + \ No newline at end of file diff --git a/src/openHAB.Windows/App.xaml.cs b/src/openHAB.Windows/App.xaml.cs index ea04414e..1da9ea07 100644 --- a/src/openHAB.Windows/App.xaml.cs +++ b/src/openHAB.Windows/App.xaml.cs @@ -1,16 +1,12 @@ using System; -using System.Diagnostics; using Microsoft.Extensions.Logging; using Microsoft.Toolkit.Uwp.Notifications; using Microsoft.UI.Dispatching; using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; -using Microsoft.UI.Xaml.Media; using Microsoft.Windows.AppLifecycle; using openHAB.Core.Notification.Contracts; using openHAB.Core.Services.Contracts; using openHAB.Windows.Services; -using openHAB.Windows.View; namespace openHAB.Windows { @@ -82,7 +78,7 @@ protected override async void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventA // Initialize MainWindow here MainWindow = new MainWindow(); - //Frame rootFrame = MainWindow.RootFrame; + //Frame rootFrame = MainWindow.Content; //if (rootFrame == null) //{ diff --git a/src/openHAB.Windows/MainWindow.xaml b/src/openHAB.Windows/MainWindow.xaml index 64c40b03..31cddd7f 100644 --- a/src/openHAB.Windows/MainWindow.xaml +++ b/src/openHAB.Windows/MainWindow.xaml @@ -60,8 +60,7 @@ - + @@ -247,22 +246,17 @@ - - - - - - - + diff --git a/src/openHAB.Windows/MainWindow.xaml.cs b/src/openHAB.Windows/MainWindow.xaml.cs index 48e813cd..821fa487 100644 --- a/src/openHAB.Windows/MainWindow.xaml.cs +++ b/src/openHAB.Windows/MainWindow.xaml.cs @@ -1,3 +1,5 @@ +using System; +using System.Threading.Tasks; using CommunityToolkit.Mvvm.Messaging; using CommunityToolkit.WinUI; using Microsoft.Extensions.Logging; @@ -15,8 +17,6 @@ using openHAB.Windows.Services; using openHAB.Windows.View; using openHAB.Windows.ViewModel; -using System; -using System.Threading.Tasks; using Windows.ApplicationModel; using Windows.Foundation; using Windows.Graphics; @@ -55,8 +55,6 @@ public MainWindow() Vm.LoadSitemapsAndItemData(); } - - /// /// Gets the root frame. /// @@ -222,5 +220,10 @@ private RectInt32 GetRect(Rect bounds, double scale) } #endregion + + private void NavigationViewItemMainUI_Tapped(object sender, Microsoft.UI.Xaml.Input.TappedRoutedEventArgs e) + { + ContentFrame.Navigate(typeof(MainUIPage)); + } } } diff --git a/src/openHAB.Windows/View/MainPage.xaml b/src/openHAB.Windows/View/MainPage.xaml index f4fb4d39..3003f2fe 100644 --- a/src/openHAB.Windows/View/MainPage.xaml +++ b/src/openHAB.Windows/View/MainPage.xaml @@ -1,17 +1,8 @@ diff --git a/src/openHAB.Windows/View/MainUIPage.xaml b/src/openHAB.Windows/View/MainUIPage.xaml new file mode 100644 index 00000000..3cf018c0 --- /dev/null +++ b/src/openHAB.Windows/View/MainUIPage.xaml @@ -0,0 +1,11 @@ + + + + + diff --git a/src/openHAB.Windows/View/MainUIPage.xaml.cs b/src/openHAB.Windows/View/MainUIPage.xaml.cs new file mode 100644 index 00000000..995a3b88 --- /dev/null +++ b/src/openHAB.Windows/View/MainUIPage.xaml.cs @@ -0,0 +1,15 @@ +using Microsoft.UI.Xaml.Controls; + +namespace openHAB.Windows.View +{ + /// + /// An empty page that can be used on its own or navigated to within a Frame. + /// + public sealed partial class MainUIPage : Page + { + public MainUIPage() + { + InitializeComponent(); + } + } +} diff --git a/src/openHAB.Windows/View/SitemapPage.xaml b/src/openHAB.Windows/View/SitemapPage.xaml index 21c7c89a..1ecd3e56 100644 --- a/src/openHAB.Windows/View/SitemapPage.xaml +++ b/src/openHAB.Windows/View/SitemapPage.xaml @@ -24,9 +24,6 @@ SelectionMode="None"> - diff --git a/src/openHAB.Windows/View/WinUIPage.xaml b/src/openHAB.Windows/View/WinUIPage.xaml deleted file mode 100644 index 6f9f3bc1..00000000 --- a/src/openHAB.Windows/View/WinUIPage.xaml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - diff --git a/src/openHAB.Windows/View/WinUIPage.xaml.cs b/src/openHAB.Windows/View/WinUIPage.xaml.cs deleted file mode 100644 index f478b61f..00000000 --- a/src/openHAB.Windows/View/WinUIPage.xaml.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; -using Microsoft.UI.Xaml.Controls.Primitives; -using Microsoft.UI.Xaml.Data; -using Microsoft.UI.Xaml.Input; -using Microsoft.UI.Xaml.Media; -using Microsoft.UI.Xaml.Navigation; -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; - -// To learn more about WinUI, the WinUI project structure, -// and more about our project templates, see: http://aka.ms/winui-project-info. - -namespace openHAB.Windows.View -{ - /// - /// An empty page that can be used on its own or navigated to within a Frame. - /// - public sealed partial class WinUIPage : Page - { - public WinUIPage() - { - this.InitializeComponent(); - } - } -} diff --git a/src/openHAB.Windows/ViewModel/MainViewModel.cs b/src/openHAB.Windows/ViewModel/MainViewModel.cs index acaccb1f..d7550e30 100644 --- a/src/openHAB.Windows/ViewModel/MainViewModel.cs +++ b/src/openHAB.Windows/ViewModel/MainViewModel.cs @@ -1,3 +1,9 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; using CommunityToolkit.Mvvm.Messaging; using CommunityToolkit.WinUI; using Microsoft.Extensions.Logging; @@ -11,12 +17,6 @@ using openHAB.Core.Services.Contracts; using openHAB.Windows.Messages; using openHAB.Windows.Services; -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; namespace openHAB.Windows.ViewModel { diff --git a/src/openHAB.Windows/openHAB.Windows.csproj b/src/openHAB.Windows/openHAB.Windows.csproj index 2ee80e5e..364e551a 100644 --- a/src/openHAB.Windows/openHAB.Windows.csproj +++ b/src/openHAB.Windows/openHAB.Windows.csproj @@ -57,8 +57,8 @@ - - + + 8.0.0 runtime; build; native; contentfiles; analyzers; buildtransitive @@ -70,11 +70,11 @@ - 1.5.240311000 + 1.5.240607001 - 5.3.8 + 5.3.11 1.1.118 @@ -87,8 +87,8 @@ + - @@ -99,7 +99,7 @@ - + MSBuild:Compile