diff --git a/src/SmartCommander/ViewModels/CopyMoveViewModel.cs b/src/SmartCommander/ViewModels/CopyMoveViewModel.cs index ad4b4a5..2ee1095 100644 --- a/src/SmartCommander/ViewModels/CopyMoveViewModel.cs +++ b/src/SmartCommander/ViewModels/CopyMoveViewModel.cs @@ -19,11 +19,11 @@ public CopyMoveViewModel(bool copy, string text, string directory) public bool IsCopying { get; set; } - public string Text { get;set;} + public string Text { get; set; } public string Directory { get; set; } - public string CopyText => IsCopying? string.Format(Resources.CopyTo, Text) : + public string CopyText => IsCopying ? string.Format(Resources.CopyTo, Text) : string.Format(Resources.MoveTo, Text); public ReactiveCommand OKCommand { get; } @@ -31,11 +31,13 @@ public CopyMoveViewModel(bool copy, string text, string directory) public void SaveClose(Window window) { + IsCopying = true; window?.Close(this); } public void Close(Window window) { + IsCopying = false; window?.Close(this); } } diff --git a/src/SmartCommander/ViewModels/MainWindowViewModel.cs b/src/SmartCommander/ViewModels/MainWindowViewModel.cs index c24c30c..c0b989f 100644 --- a/src/SmartCommander/ViewModels/MainWindowViewModel.cs +++ b/src/SmartCommander/ViewModels/MainWindowViewModel.cs @@ -352,7 +352,7 @@ public async Task Copy() string.Format(Resources.ItemsNumber, SelectedPane.CurrentItems.Count); var copy = new CopyMoveViewModel(true, text, SecondPane.CurrentDirectory); var result = await ShowCopyDialog.Handle(copy); - if (result != null) + if (result != null && result.IsCopying) { var duplicates = Utils.GetDuplicates(SelectedPane.CurrentItems, SecondPane.CurrentDirectory); @@ -461,7 +461,7 @@ public async Task Move() string.Format(Resources.ItemsNumber, SelectedPane.CurrentItems.Count); var copy = new CopyMoveViewModel(false, text, SecondPane.CurrentDirectory); var result = await ShowCopyDialog.Handle(copy); - if (result != null) + if (result != null && result.IsCopying) { var duplicates = Utils.GetDuplicates(SelectedPane.CurrentItems, SecondPane.CurrentDirectory); diff --git a/src/SmartCommander/Views/CopyMoveWindow.axaml b/src/SmartCommander/Views/CopyMoveWindow.axaml index 6afcaae..b67b5a4 100644 --- a/src/SmartCommander/Views/CopyMoveWindow.axaml +++ b/src/SmartCommander/Views/CopyMoveWindow.axaml @@ -11,19 +11,19 @@ Icon="/Assets/main.ico" CanResize="False" Title="SmartCommander"> - - - - - - - - - - - - - + + + + + + + + + + + + + diff --git a/src/SmartCommander/Views/MvvmMessageBoxEventArgs.cs b/src/SmartCommander/Views/MvvmMessageBoxEventArgs.cs index 0acb647..e83426e 100644 --- a/src/SmartCommander/Views/MvvmMessageBoxEventArgs.cs +++ b/src/SmartCommander/Views/MvvmMessageBoxEventArgs.cs @@ -42,7 +42,7 @@ public void Show(Window owner) { var messageBoxWindow = MsBox.Avalonia.MessageBoxManager .GetMessageBoxStandard(caption, messageBoxText + Environment.NewLine, button, icon); - var result = await messageBoxWindow.ShowAsPopupAsync(owner); + var result = await messageBoxWindow.ShowWindowDialogAsync(owner); resultAction?.Invoke(result, parameter); }); } @@ -59,12 +59,12 @@ public void ShowInput(Window owner) MinWidth = 300, InputParams = new InputParams() { }, ButtonDefinitions = new[] { - new ButtonDefinition {Name = Resources.OK}, - new ButtonDefinition {Name = Resources.Cancel, IsCancel = true, IsDefault = true} + new ButtonDefinition {Name = Resources.OK, IsDefault = true}, + new ButtonDefinition {Name = Resources.Cancel, IsCancel = true} }, WindowStartupLocation = WindowStartupLocation.CenterOwner }); - var result = await messageBoxWindow.ShowAsPopupAsync(owner); + var result = await messageBoxWindow.ShowWindowDialogAsync(owner); resultInputAction?.Invoke(result == Resources.OK ? messageBoxWindow.InputValue : ""); }); }