Skip to content

Commit

Permalink
feat: Removed FileMenuViewModel from MainWindowViewModelBase.
Browse files Browse the repository at this point in the history
Introduced MainWindowWithFileMenuViewModel to handle FileMenuViewModel.

BREAKING CHANGE: Removed FileMenuViewModel from MainWindowViewModelBase.
  • Loading branch information
Stéphane ANDRE (E104915) committed Dec 21, 2024
1 parent f90dc3e commit 91e1e9a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
5 changes: 0 additions & 5 deletions src/MyNet.UI/ViewModels/Shell/MainWindowViewModelBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
Expand Down Expand Up @@ -171,7 +167,6 @@ protected override void Cleanup()
{
Messenger.Default.Unregister(this);
NotificationsViewModel.Dispose();
FileMenuViewModel.Dispose();
ThemeManager.ThemeChanged -= ThemeService_ThemeChanged;
base.Cleanup();
}
Expand Down
27 changes: 27 additions & 0 deletions src/MyNet.UI/ViewModels/Shell/MainWindowWithFileMenuViewModel.cs
Original file line number Diff line number Diff line change
@@ -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();
}
}
}

0 comments on commit 91e1e9a

Please sign in to comment.