diff --git a/src/MyNet.UI/ViewModels/Shell/MainWindowViewModelBase.cs b/src/MyNet.UI/ViewModels/Shell/MainWindowViewModelBase.cs index 910eab2..7f0533c 100644 --- a/src/MyNet.UI/ViewModels/Shell/MainWindowViewModelBase.cs +++ b/src/MyNet.UI/ViewModels/Shell/MainWindowViewModelBase.cs @@ -55,12 +55,9 @@ public class MainWindowViewModelBase : LocalizableObject public NotificationsViewModel NotificationsViewModel { get; } - public FileMenuViewModelBase FileMenuViewModel { get; } - public IBusyService BusyService { get; } public MainWindowViewModelBase( - FileMenuViewModelBase fileMenuViewModel, INotificationsManager notificationsManager, IAppCommandsService appCommandsService, IBusyService mainBusyService) @@ -70,7 +67,6 @@ public MainWindowViewModelBase( #endif NotificationsViewModel = new(notificationsManager); - FileMenuViewModel = fileMenuViewModel; BusyService = mainBusyService; ToggleNotificationsCommand = CommandsManager.Create(() => Messenger.Default.Send(new UpdateNotificationsVisibilityRequestedMessage(VisibilityAction.Toggle)), () => !DialogManager.HasOpenedDialogs && NotificationsViewModel.Notifications.Count != 0); @@ -171,7 +167,6 @@ protected override void Cleanup() { Messenger.Default.Unregister(this); NotificationsViewModel.Dispose(); - FileMenuViewModel.Dispose(); ThemeManager.ThemeChanged -= ThemeService_ThemeChanged; base.Cleanup(); } diff --git a/src/MyNet.UI/ViewModels/Shell/MainWindowWithFileMenuViewModel.cs b/src/MyNet.UI/ViewModels/Shell/MainWindowWithFileMenuViewModel.cs new file mode 100644 index 0000000..047477a --- /dev/null +++ b/src/MyNet.UI/ViewModels/Shell/MainWindowWithFileMenuViewModel.cs @@ -0,0 +1,27 @@ +// Copyright (c) Stéphane ANDRE. All Right Reserved. +// See the LICENSE file in the project root for more information. + +using MyNet.UI.Busy; +using MyNet.UI.Notifications; +using MyNet.UI.Services; + +namespace MyNet.UI.ViewModels.Shell +{ + public class MainWindowWithFileMenuViewModel : MainWindowViewModelBase + { + public FileMenuViewModelBase FileMenuViewModel { get; } + + public MainWindowWithFileMenuViewModel( + FileMenuViewModelBase fileMenuViewModel, + INotificationsManager notificationsManager, + IAppCommandsService appCommandsService, + IBusyService mainBusyService) + : base(notificationsManager, appCommandsService, mainBusyService) => FileMenuViewModel = fileMenuViewModel; + + protected override void Cleanup() + { + FileMenuViewModel.Dispose(); + base.Cleanup(); + } + } +}