diff --git a/src/openHAB.Windows/MainWindow.xaml.cs b/src/openHAB.Windows/MainWindow.xaml.cs index 3d291b2..f9a063e 100644 --- a/src/openHAB.Windows/MainWindow.xaml.cs +++ b/src/openHAB.Windows/MainWindow.xaml.cs @@ -1,5 +1,3 @@ -using System; -using System.Threading.Tasks; using CommunityToolkit.Mvvm.Messaging; using CommunityToolkit.WinUI; using Microsoft.Extensions.Logging; @@ -15,6 +13,8 @@ using openHAB.Windows.Services; using openHAB.Windows.View; using openHAB.Windows.ViewModel; +using System; +using System.Threading.Tasks; using Windows.ApplicationModel; namespace openHAB.Windows @@ -74,7 +74,7 @@ private void BreadcrumbBar_ItemClicked(BreadcrumbBar sender, BreadcrumbBarItemCl return; } - StrongReferenceMessenger.Default.Send(new WidgetNavigationMessage(null, widget, EventTriggerSource.Breadcrumb)); + StrongReferenceMessenger.Default.Send(new WidgetNavigationMessage(null, widget, EventTriggerSource.Breadcrumb), Vm.SelectedSitemap.Name); } private async Task ShowErrorMessage(object recipient, ConnectionErrorMessage message) @@ -159,7 +159,7 @@ private void SitemapNavigation_SelectionChanged( private void SitemapTextBlock_Tapped(object sender, Microsoft.UI.Xaml.Input.TappedRoutedEventArgs e) { - StrongReferenceMessenger.Default.Send(new WidgetNavigationMessage(null, null, EventTriggerSource.Root)); + StrongReferenceMessenger.Default.Send(new WidgetNavigationMessage(null, null, EventTriggerSource.Root), Vm.SelectedSitemap.Name); } } } diff --git a/src/openHAB.Windows/ViewModel/MainViewModel.cs b/src/openHAB.Windows/ViewModel/MainViewModel.cs index 6dff769..9f87617 100644 --- a/src/openHAB.Windows/ViewModel/MainViewModel.cs +++ b/src/openHAB.Windows/ViewModel/MainViewModel.cs @@ -54,9 +54,6 @@ public MainViewModel(IOpenHABClient openHABClient, ISettingsService settingsServ StrongReferenceMessenger.Default.Register(this, async (obj, operation) => await DataOperationStateAsync(operation)); - - StrongReferenceMessenger.Default.Register(this, (obj, operation) - => WidgetNavigatedEvent()); } /// @@ -116,7 +113,6 @@ public Sitemap SelectedSitemap { if (_selectedSitemap != value) { - StrongReferenceMessenger.Default.Unregister(this, value.Name); } @@ -128,7 +124,8 @@ public Sitemap SelectedSitemap settings.LastSitemap = _selectedSitemap.Name; _settingsService.Save(settings); - //StrongReferenceMessenger.Default.Send(new SitemapChanged(value.Model)); + StrongReferenceMessenger.Default.Register(this, SelectedSitemap.Name, (obj, operation) + => WidgetNavigatedEvent()); } SelectedMenuItem = value; diff --git a/src/openHAB.Windows/ViewModel/SitemapViewModel.cs b/src/openHAB.Windows/ViewModel/SitemapViewModel.cs index eae47ad..0cf738f 100644 --- a/src/openHAB.Windows/ViewModel/SitemapViewModel.cs +++ b/src/openHAB.Windows/ViewModel/SitemapViewModel.cs @@ -1,8 +1,3 @@ -using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; -using System.Linq; -using System.Threading.Tasks; using CommunityToolkit.Mvvm.Messaging; using CommunityToolkit.WinUI; using openHAB.Common; @@ -14,6 +9,11 @@ using openHAB.Core.Services; using openHAB.Windows.Messages; using openHAB.Windows.Services; +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Threading.Tasks; namespace openHAB.Windows.ViewModel { @@ -69,7 +69,7 @@ private SitemapViewModel(Sitemap model, List widgetViewModels) StrongReferenceMessenger.Default.Register(this, (obj, operation) => DataOperationState(operation)); - StrongReferenceMessenger.Default.Register(this, (recipient, msg) => + StrongReferenceMessenger.Default.Register(this, Model.Name, (recipient, msg) => { if (msg.Trigger == EventTriggerSource.Breadcrumb) { @@ -369,7 +369,7 @@ await App.DispatcherQueue.EnqueueAsync(async () => } WidgetNavigationService.Navigate(SelectedWidget); - StrongReferenceMessenger.Default.Send(new WidgetNavigationMessage(lastWidget, widget, EventTriggerSource.Widget)); + StrongReferenceMessenger.Default.Send(new WidgetNavigationMessage(lastWidget, widget, EventTriggerSource.Widget), Model.Name); List widgets = ConvertWidgetToViewModel(SelectedWidget.LinkedPage.Widgets); await SetWidgetsOnScreenAsync(widgets); @@ -402,7 +402,7 @@ private async Task WidgetGoBack(WidgetViewModel widget) SelectedWidget = widgetFromStack; WidgetNavigationService.Navigate(SelectedWidget); - StrongReferenceMessenger.Default.Send(new WidgetNavigationMessage(lastWidget, SelectedWidget, EventTriggerSource.Widget)); + StrongReferenceMessenger.Default.Send(new WidgetNavigationMessage(lastWidget, SelectedWidget, EventTriggerSource.Widget), Model.Name); List widgets = ConvertWidgetToViewModel(SelectedWidget.LinkedPage.Widgets); await SetWidgetsOnScreenAsync(widgets); diff --git a/src/openHAB.Windows/openHAB.Windows.GeneratedMSBuildEditorConfig.editorconfig b/src/openHAB.Windows/openHAB.Windows.GeneratedMSBuildEditorConfig.editorconfig deleted file mode 100644 index 479cd4c..0000000 --- a/src/openHAB.Windows/openHAB.Windows.GeneratedMSBuildEditorConfig.editorconfig +++ /dev/null @@ -1,8 +0,0 @@ -is_global = true -build_property.TargetFramework = -build_property.TargetPlatformMinVersion = 10.0.17763.0 -build_property.UsingMicrosoftNETSdkWeb = -build_property.ProjectTypeGuids = {A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} -build_property.PublishSingleFile = -build_property.IncludeAllContentForSelfExtract = -build_property._SupportedPlatformList =