From 06a2f5351130817ca79e963ac69b002bdb375a39 Mon Sep 17 00:00:00 2001 From: Jung Hyun Nam Date: Wed, 3 Jan 2024 18:05:51 +0900 Subject: [PATCH] =?UTF-8?q?v1=20->=20v2=EB=A1=9C=20=EC=9E=AC=EC=8B=A4?= =?UTF-8?q?=ED=96=89=ED=95=A0=20=EB=95=8C=20=EC=95=B1=EC=9D=B4=20=EB=91=90?= =?UTF-8?q?=20=EB=B2=88=20=EC=8B=A4=ED=96=89=EB=90=98=EB=8A=94=20=EB=B2=84?= =?UTF-8?q?=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/TableCloth.Test/ContainerFixture.cs | 2 +- src/TableCloth/App.xaml.cs | 2 +- .../MainWindow/MainWindowClosedCommand.cs | 20 ++++++++ .../MainWindowV2ClosedCommand.cs} | 50 +++++++++---------- .../Components/AppRestartManager.cs | 3 +- .../ViewModels/MainWindowV2ViewModel.cs | 6 +-- 6 files changed, 51 insertions(+), 32 deletions(-) create mode 100644 src/TableCloth/Commands/MainWindow/MainWindowClosedCommand.cs rename src/TableCloth/Commands/{MainWindowClosedCommand.cs => MainWindowV2/MainWindowV2ClosedCommand.cs} (79%) diff --git a/src/TableCloth.Test/ContainerFixture.cs b/src/TableCloth.Test/ContainerFixture.cs index f1fc2a60..5627b755 100644 --- a/src/TableCloth.Test/ContainerFixture.cs +++ b/src/TableCloth.Test/ContainerFixture.cs @@ -108,7 +108,7 @@ private ServiceProvider ConfigureServices() services .AddWindow() .AddSingleton() - .AddSingleton(); + .AddSingleton(); // Catalog Page services diff --git a/src/TableCloth/App.xaml.cs b/src/TableCloth/App.xaml.cs index 47cdbbc2..26ca3968 100644 --- a/src/TableCloth/App.xaml.cs +++ b/src/TableCloth/App.xaml.cs @@ -145,7 +145,7 @@ private ServiceProvider ConfigureServices() services .AddWindow() .AddSingleton() - .AddSingleton(); + .AddSingleton(); // Catalog Page services diff --git a/src/TableCloth/Commands/MainWindow/MainWindowClosedCommand.cs b/src/TableCloth/Commands/MainWindow/MainWindowClosedCommand.cs new file mode 100644 index 00000000..a84ead47 --- /dev/null +++ b/src/TableCloth/Commands/MainWindow/MainWindowClosedCommand.cs @@ -0,0 +1,20 @@ +using TableCloth.Components; + +namespace TableCloth.Commands.MainWindow; + +public sealed class MainWindowClosedCommand : CommandBase +{ + public MainWindowClosedCommand( + SandboxCleanupManager sandboxCleanupManager, + AppRestartManager appRestartManager) + { + _sandboxCleanupManager = sandboxCleanupManager; + } + + private readonly SandboxCleanupManager _sandboxCleanupManager; + + public override void Execute(object? parameter) + { + _sandboxCleanupManager.TryCleanup(); + } +} diff --git a/src/TableCloth/Commands/MainWindowClosedCommand.cs b/src/TableCloth/Commands/MainWindowV2/MainWindowV2ClosedCommand.cs similarity index 79% rename from src/TableCloth/Commands/MainWindowClosedCommand.cs rename to src/TableCloth/Commands/MainWindowV2/MainWindowV2ClosedCommand.cs index 8cc194a6..b1704e72 100644 --- a/src/TableCloth/Commands/MainWindowClosedCommand.cs +++ b/src/TableCloth/Commands/MainWindowV2/MainWindowV2ClosedCommand.cs @@ -1,25 +1,25 @@ -using TableCloth.Components; - -namespace TableCloth.Commands; - -public sealed class MainWindowClosedCommand : CommandBase -{ - public MainWindowClosedCommand( - SandboxCleanupManager sandboxCleanupManager, - AppRestartManager appRestartManager) - { - _sandboxCleanupManager = sandboxCleanupManager; - _appRestartManager = appRestartManager; - } - - private readonly SandboxCleanupManager _sandboxCleanupManager; - private readonly AppRestartManager _appRestartManager; - - public override void Execute(object? parameter) - { - _sandboxCleanupManager.TryCleanup(); - - if (_appRestartManager.ReserveRestart) - _appRestartManager.RestartNow(); - } -} +using TableCloth.Components; + +namespace TableCloth.Commands.MainWindowV2; + +public sealed class MainWindowV2ClosedCommand : CommandBase +{ + public MainWindowV2ClosedCommand( + SandboxCleanupManager sandboxCleanupManager, + AppRestartManager appRestartManager) + { + _sandboxCleanupManager = sandboxCleanupManager; + _appRestartManager = appRestartManager; + } + + private readonly SandboxCleanupManager _sandboxCleanupManager; + private readonly AppRestartManager _appRestartManager; + + public override void Execute(object? parameter) + { + _sandboxCleanupManager.TryCleanup(); + + if (_appRestartManager.ReserveRestart) + _appRestartManager.RestartNow(); + } +} diff --git a/src/TableCloth/Components/AppRestartManager.cs b/src/TableCloth/Components/AppRestartManager.cs index 3d1b8f2d..99494397 100644 --- a/src/TableCloth/Components/AppRestartManager.cs +++ b/src/TableCloth/Components/AppRestartManager.cs @@ -26,9 +26,8 @@ public AppRestartManager( public bool AskRestart() => _appMessageBox.DisplayInfo(StringResources.Ask_RestartRequired, MessageBoxButton.OKCancel).Equals(MessageBoxResult.OK); - public void RestartNow([CallerFilePath] string file = "", [CallerMemberName] string member = "", [CallerLineNumber] int line = 0) + public void RestartNow() { - _appMessageBox.DisplayInfo($"{file} - {member} - {line}"); Process.Start(_sharedLocations.ExecutableFilePath, Helpers.GetCommandLineArguments()); _application.Shutdown(); } diff --git a/src/TableCloth/ViewModels/MainWindowV2ViewModel.cs b/src/TableCloth/ViewModels/MainWindowV2ViewModel.cs index cdbec875..5627461d 100644 --- a/src/TableCloth/ViewModels/MainWindowV2ViewModel.cs +++ b/src/TableCloth/ViewModels/MainWindowV2ViewModel.cs @@ -15,18 +15,18 @@ protected MainWindowV2ViewModel() { } public MainWindowV2ViewModel( MainWindowV2LoadedCommand mainWindowV2LoadedCommand, - MainWindowClosedCommand mainWindowClosedCommand) + MainWindowV2ClosedCommand mainWindowClosedCommand) { _mainWindowV2LoadedCommand = mainWindowV2LoadedCommand; _mainWindowClosedCommand = mainWindowClosedCommand; } private readonly MainWindowV2LoadedCommand _mainWindowV2LoadedCommand; - private readonly MainWindowClosedCommand _mainWindowClosedCommand; + private readonly MainWindowV2ClosedCommand _mainWindowClosedCommand; public MainWindowV2LoadedCommand MainWindowV2LoadedCommand => _mainWindowV2LoadedCommand; - public MainWindowClosedCommand MainWindowClosedCommand + public MainWindowV2ClosedCommand MainWindowClosedCommand => _mainWindowClosedCommand; }