Skip to content

Commit

Permalink
Add QuitService
Browse files Browse the repository at this point in the history
  • Loading branch information
cooolbros committed Jul 8, 2024
1 parent 4558124 commit 53cb2c7
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.
8 changes: 8 additions & 0 deletions src/HUDMerger.Core/Services/IQuitService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using System;

namespace HUDMerger.Core.Services;

public interface IQuitService
{
public void Quit();
}
4 changes: 2 additions & 2 deletions src/HUDMerger.Core/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public ViewModelBase TargetHUDPanelsListViewModel

public MergeCommand MergeCommand { get; }

public MainWindowViewModel(ISettingsService settingsService, IFolderPickerService folderPickerService, ISettingsWindowService settingsWindowService, IAboutWindowService aboutWindowService, IMessageBoxService messageBoxService)
public MainWindowViewModel(ISettingsService settingsService, IFolderPickerService folderPickerService, ISettingsWindowService settingsWindowService, IAboutWindowService aboutWindowService, IQuitService quitService, IMessageBoxService messageBoxService)
{
SettingsService = settingsService;
FolderPickerService = folderPickerService;
Expand All @@ -96,7 +96,7 @@ public MainWindowViewModel(ISettingsService settingsService, IFolderPickerServic
LoadSourceHUDCommand = new AsyncRelayCommand(LoadSourceHUD);
LoadTargetHUDCommand = new AsyncRelayCommand(LoadTargetHUD);
ShowSettingsWindowCommand = new RelayCommand(ShowSettingsWindow);
QuitCommand = new RelayCommand(Application.Current.Shutdown);
QuitCommand = new RelayCommand(quitService.Quit);

ShowAboutWindowCommand = new RelayCommand(ShowAboutWindow);

Expand Down
1 change: 1 addition & 0 deletions src/HUDMerger/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ protected override void OnStartup(StartupEventArgs e)
new FolderPickerService(settingsService),
new SettingsWindowService(),
new AboutWindowService(),
new QuitService(),
new MessageBoxService()
)
};
Expand Down
13 changes: 13 additions & 0 deletions src/HUDMerger/Services/QuitService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Windows;
using HUDMerger.Core.Services;

namespace HUDMerger.Services;

public class QuitService : IQuitService
{
public void Quit()
{
Application.Current.Shutdown();
}
}

0 comments on commit 53cb2c7

Please sign in to comment.