From 882d39b8f36fc591584ac89cbecd89fc2cbbbe2c Mon Sep 17 00:00:00 2001 From: achiez Date: Thu, 6 Nov 2025 18:44:43 +0200 Subject: [PATCH] Refactor and enhance UI, localization, and file name handling - Refactored file handling: added backup directories, improved mafile naming strategy, and introduced renaming functionality. - Enhanced UI: updated `MainWindow`, `SettingsView`, and dialogs with new controls, commands, and improved layouts. - Introduced `TextFieldDialog` for user input with localization support. - Improved localization: added new strings for buttons, errors, and tooltips. Removed all user-observed not localized strings - Fixed clipboard handling logic in `ClipboardHelper`. - Added 'Create Group' button in mafile's context menu and corresponding dialog view - Implemented `RequiresAdminAccess` check before updating program and requesting previlegies --- src/NebulaAuth/Components/CodeProgressBar.cs | 2 +- src/NebulaAuth/Components/HintBox.xaml | 5 - .../Converters/BoolToMafileNamingConverter.cs | 20 ++ src/NebulaAuth/Converters/Converters.xaml | 1 + src/NebulaAuth/Core/DialogsController.cs | 12 +- src/NebulaAuth/Core/TrayManager.cs | 2 +- src/NebulaAuth/Core/UpdateManager.cs | 18 +- src/NebulaAuth/MainWindow.xaml | 128 ++++++---- src/NebulaAuth/MainWindow.xaml.cs | 5 + src/NebulaAuth/Model/Entities/Mafile.cs | 1 - .../Model/Mafiles/MafileNamingStrategy.cs | 72 ++++++ src/NebulaAuth/Model/ProxyStorage.cs | 3 +- src/NebulaAuth/Model/Settings.cs | 2 +- src/NebulaAuth/Model/Storage.cs | 227 ++++++++++-------- .../Theme/WindowStyle/WindowStyle.xaml.cs | 3 - src/NebulaAuth/Utility/ClipboardHelper.cs | 58 ++--- src/NebulaAuth/Utility/FileNameValidator.cs | 23 ++ .../View/Dialogs/ConfirmCancelDialog.xaml | 35 +-- .../View/Dialogs/ConfirmCancelDialog.xaml.cs | 5 +- .../View/Dialogs/LoginAgainDialog.xaml.cs | 3 - .../Dialogs/LoginAgainOnImportDialog.xaml.cs | 3 - .../Dialogs/SetCryptPasswordDialog.xaml.cs | 4 +- .../View/Dialogs/TextFieldDialog.xaml | 71 ++++++ .../View/Dialogs/TextFieldDialog.xaml.cs | 23 ++ .../View/Dialogs/WaitLoginDialog.xaml.cs | 4 +- src/NebulaAuth/View/LinkerView.xaml.cs | 3 - src/NebulaAuth/View/LinksView.xaml.cs | 4 +- src/NebulaAuth/View/MafileMoverView.xaml.cs | 4 +- src/NebulaAuth/View/ProxyManagerView.xaml | 14 +- src/NebulaAuth/View/ProxyManagerView.xaml.cs | 4 +- src/NebulaAuth/View/SettingsView.xaml | 79 ++++-- src/NebulaAuth/View/SettingsView.xaml.cs | 4 +- src/NebulaAuth/View/UpdaterView.xaml.cs | 3 - .../ViewModel/Linker/LinkAccountVM.cs | 3 +- .../ViewModel/MafileMover/MafileMoverVM.cs | 22 +- src/NebulaAuth/ViewModel/MainVM.cs | 1 + .../ViewModel/MainVM_Confirmations.cs | 14 +- src/NebulaAuth/ViewModel/MainVM_File.cs | 2 +- src/NebulaAuth/ViewModel/MainVM_Groups.cs | 19 +- src/NebulaAuth/ViewModel/Other/SettingsVM.cs | 123 ++++++++-- src/NebulaAuth/localization.loc.json | 150 ++++++++---- 41 files changed, 792 insertions(+), 387 deletions(-) create mode 100644 src/NebulaAuth/Converters/BoolToMafileNamingConverter.cs create mode 100644 src/NebulaAuth/Model/Mafiles/MafileNamingStrategy.cs create mode 100644 src/NebulaAuth/Utility/FileNameValidator.cs create mode 100644 src/NebulaAuth/View/Dialogs/TextFieldDialog.xaml create mode 100644 src/NebulaAuth/View/Dialogs/TextFieldDialog.xaml.cs diff --git a/src/NebulaAuth/Components/CodeProgressBar.cs b/src/NebulaAuth/Components/CodeProgressBar.cs index 8171e7b..661b5af 100644 --- a/src/NebulaAuth/Components/CodeProgressBar.cs +++ b/src/NebulaAuth/Components/CodeProgressBar.cs @@ -13,7 +13,7 @@ public class CodeProgressBar : ProgressBar public static readonly DependencyProperty MaxTimeProperty = DependencyProperty.Register(nameof(MaxTime), typeof(double), typeof(CodeProgressBar), - new PropertyMetadata(30.0)); // По умолчанию 30 сек + new PropertyMetadata(30.0)); public double TimeRemaining { diff --git a/src/NebulaAuth/Components/HintBox.xaml b/src/NebulaAuth/Components/HintBox.xaml index fdf57e9..98495b4 100644 --- a/src/NebulaAuth/Components/HintBox.xaml +++ b/src/NebulaAuth/Components/HintBox.xaml @@ -26,15 +26,12 @@ - - - - + CommandParameter="{StaticResource True}" + Content="{Tr Common.OK}"/> + CommandParameter="{StaticResource False}" + Content="{Tr Common.Cancel}" + /> diff --git a/src/NebulaAuth/View/Dialogs/ConfirmCancelDialog.xaml.cs b/src/NebulaAuth/View/Dialogs/ConfirmCancelDialog.xaml.cs index f678c13..1d226a8 100644 --- a/src/NebulaAuth/View/Dialogs/ConfirmCancelDialog.xaml.cs +++ b/src/NebulaAuth/View/Dialogs/ConfirmCancelDialog.xaml.cs @@ -1,8 +1,5 @@ namespace NebulaAuth.View.Dialogs; -/// -/// Логика взаимодействия для ConfirmCancelDialog.xaml -/// public partial class ConfirmCancelDialog { public ConfirmCancelDialog() @@ -13,6 +10,6 @@ public partial class ConfirmCancelDialog public ConfirmCancelDialog(string msg) { InitializeComponent(); - ConfirmTextBlock.Text = msg; + ConfirmHint.Text = msg; } } \ No newline at end of file diff --git a/src/NebulaAuth/View/Dialogs/LoginAgainDialog.xaml.cs b/src/NebulaAuth/View/Dialogs/LoginAgainDialog.xaml.cs index 294f5b6..204506a 100644 --- a/src/NebulaAuth/View/Dialogs/LoginAgainDialog.xaml.cs +++ b/src/NebulaAuth/View/Dialogs/LoginAgainDialog.xaml.cs @@ -1,8 +1,5 @@ namespace NebulaAuth.View.Dialogs; -/// -/// Логика взаимодействия для LoginAgainDialog.xaml -/// public partial class LoginAgainDialog { public LoginAgainDialog() diff --git a/src/NebulaAuth/View/Dialogs/LoginAgainOnImportDialog.xaml.cs b/src/NebulaAuth/View/Dialogs/LoginAgainOnImportDialog.xaml.cs index 8d936f9..deb3ec6 100644 --- a/src/NebulaAuth/View/Dialogs/LoginAgainOnImportDialog.xaml.cs +++ b/src/NebulaAuth/View/Dialogs/LoginAgainOnImportDialog.xaml.cs @@ -1,8 +1,5 @@ namespace NebulaAuth.View.Dialogs; -/// -/// Логика взаимодействия для LoginAgainDialog.xaml -/// public partial class LoginAgainOnImportDialog { public LoginAgainOnImportDialog() diff --git a/src/NebulaAuth/View/Dialogs/SetCryptPasswordDialog.xaml.cs b/src/NebulaAuth/View/Dialogs/SetCryptPasswordDialog.xaml.cs index a9a5b1e..4c48e3c 100644 --- a/src/NebulaAuth/View/Dialogs/SetCryptPasswordDialog.xaml.cs +++ b/src/NebulaAuth/View/Dialogs/SetCryptPasswordDialog.xaml.cs @@ -1,8 +1,6 @@ namespace NebulaAuth.View.Dialogs; -/// -/// Логика взаимодействия для SetCryptPasswordDialog.xaml -/// + public partial class SetCryptPasswordDialog { public SetCryptPasswordDialog() diff --git a/src/NebulaAuth/View/Dialogs/TextFieldDialog.xaml b/src/NebulaAuth/View/Dialogs/TextFieldDialog.xaml new file mode 100644 index 0000000..520d887 --- /dev/null +++ b/src/NebulaAuth/View/Dialogs/TextFieldDialog.xaml @@ -0,0 +1,71 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -47,15 +49,33 @@ - + - - + + + + + + + - - - - - - - - - + + + + True + False + + + + + + + + - +