docs: add XML documentation and ConfigManager implementation plans
Add comprehensive XML documentation (param/returns tags) across 132 source files to improve IntelliSense and API discoverability. Include ConfigManager design documents and implementation plans for phases 1-9.
This commit is contained in:
@@ -12,6 +12,9 @@ public class AsyncRelayCommand : ICommand
|
||||
private bool _isExecuting;
|
||||
private EventHandler? _canExecuteChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when the result of CanExecute() may have changed.
|
||||
/// </summary>
|
||||
public event EventHandler? CanExecuteChanged
|
||||
{
|
||||
add => _canExecuteChanged += value;
|
||||
@@ -38,11 +41,19 @@ public class AsyncRelayCommand : ICommand
|
||||
_canExecute = canExecute;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the command can be executed in its current state.
|
||||
/// </summary>
|
||||
/// <param name="parameter">The command parameter (unused).</param>
|
||||
public bool CanExecute(object? parameter)
|
||||
{
|
||||
return !_isExecuting && (_canExecute?.Invoke() ?? true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the async command if it can execute.
|
||||
/// </summary>
|
||||
/// <param name="parameter">The command parameter (unused).</param>
|
||||
public async void Execute(object? parameter)
|
||||
{
|
||||
if (!CanExecute(parameter))
|
||||
|
||||
@@ -15,12 +15,18 @@ public class NewStoreDialogViewModel : ViewModelBase
|
||||
private bool _useKeyFile = true;
|
||||
private bool _usePassword;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NewStoreDialogViewModel"/> class.
|
||||
/// </summary>
|
||||
public NewStoreDialogViewModel()
|
||||
{
|
||||
BrowseStorePathCommand = new RelayCommand(BrowseStorePath);
|
||||
BrowseKeyFilePathCommand = new RelayCommand(BrowseKeyFilePath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the path to the store file to create.
|
||||
/// </summary>
|
||||
public string StorePath
|
||||
{
|
||||
get => _storePath;
|
||||
@@ -31,6 +37,9 @@ public class NewStoreDialogViewModel : ViewModelBase
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the path to the key file for encryption.
|
||||
/// </summary>
|
||||
public string KeyFilePath
|
||||
{
|
||||
get => _keyFilePath;
|
||||
@@ -41,6 +50,9 @@ public class NewStoreDialogViewModel : ViewModelBase
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the password for store encryption.
|
||||
/// </summary>
|
||||
public string Password
|
||||
{
|
||||
get => _password;
|
||||
@@ -51,6 +63,9 @@ public class NewStoreDialogViewModel : ViewModelBase
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the password confirmation value.
|
||||
/// </summary>
|
||||
public string ConfirmPassword
|
||||
{
|
||||
get => _confirmPassword;
|
||||
@@ -61,6 +76,9 @@ public class NewStoreDialogViewModel : ViewModelBase
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether to use key file for store encryption.
|
||||
/// </summary>
|
||||
public bool UseKeyFile
|
||||
{
|
||||
get => _useKeyFile;
|
||||
@@ -74,6 +92,9 @@ public class NewStoreDialogViewModel : ViewModelBase
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether to use password for store encryption.
|
||||
/// </summary>
|
||||
public bool UsePassword
|
||||
{
|
||||
get => _usePassword;
|
||||
@@ -93,9 +114,19 @@ public class NewStoreDialogViewModel : ViewModelBase
|
||||
OnPropertyChanged(nameof(ValidationError));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the command to browse for store path location.
|
||||
/// </summary>
|
||||
public ICommand BrowseStorePathCommand { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the command to browse for key file path location.
|
||||
/// </summary>
|
||||
public ICommand BrowseKeyFilePathCommand { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the dialog input is valid.
|
||||
/// </summary>
|
||||
public bool IsValid
|
||||
{
|
||||
get
|
||||
@@ -113,6 +144,9 @@ public class NewStoreDialogViewModel : ViewModelBase
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the validation error message, or null if valid.
|
||||
/// </summary>
|
||||
public string? ValidationError
|
||||
{
|
||||
get
|
||||
@@ -187,12 +221,18 @@ public class OpenStoreDialogViewModel : ViewModelBase
|
||||
private bool _useKeyFile = true;
|
||||
private bool _usePassword;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="OpenStoreDialogViewModel"/> class.
|
||||
/// </summary>
|
||||
public OpenStoreDialogViewModel()
|
||||
{
|
||||
BrowseStorePathCommand = new RelayCommand(BrowseStorePath);
|
||||
BrowseKeyFilePathCommand = new RelayCommand(BrowseKeyFilePath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the path to the store file to open.
|
||||
/// </summary>
|
||||
public string StorePath
|
||||
{
|
||||
get => _storePath;
|
||||
@@ -203,6 +243,9 @@ public class OpenStoreDialogViewModel : ViewModelBase
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the path to the key file for decryption.
|
||||
/// </summary>
|
||||
public string KeyFilePath
|
||||
{
|
||||
get => _keyFilePath;
|
||||
@@ -213,6 +256,9 @@ public class OpenStoreDialogViewModel : ViewModelBase
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the password for store decryption.
|
||||
/// </summary>
|
||||
public string Password
|
||||
{
|
||||
get => _password;
|
||||
@@ -223,6 +269,9 @@ public class OpenStoreDialogViewModel : ViewModelBase
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether to use key file for store decryption.
|
||||
/// </summary>
|
||||
public bool UseKeyFile
|
||||
{
|
||||
get => _useKeyFile;
|
||||
@@ -236,6 +285,9 @@ public class OpenStoreDialogViewModel : ViewModelBase
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether to use password for store decryption.
|
||||
/// </summary>
|
||||
public bool UsePassword
|
||||
{
|
||||
get => _usePassword;
|
||||
@@ -255,9 +307,19 @@ public class OpenStoreDialogViewModel : ViewModelBase
|
||||
OnPropertyChanged(nameof(ValidationError));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the command to browse for store path location.
|
||||
/// </summary>
|
||||
public ICommand BrowseStorePathCommand { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the command to browse for key file path location.
|
||||
/// </summary>
|
||||
public ICommand BrowseKeyFilePathCommand { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the dialog input is valid.
|
||||
/// </summary>
|
||||
public bool IsValid
|
||||
{
|
||||
get
|
||||
@@ -275,6 +337,9 @@ public class OpenStoreDialogViewModel : ViewModelBase
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the validation error message, or null if valid.
|
||||
/// </summary>
|
||||
public string? ValidationError
|
||||
{
|
||||
get
|
||||
@@ -348,10 +413,18 @@ public class SecretEditDialogViewModel : ViewModelBase
|
||||
private string _value = string.Empty;
|
||||
private bool _isNewSecret = true;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SecretEditDialogViewModel"/> class.
|
||||
/// </summary>
|
||||
public SecretEditDialogViewModel()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SecretEditDialogViewModel"/> class with a key and value for editing.
|
||||
/// </summary>
|
||||
/// <param name="key">The secret key.</param>
|
||||
/// <param name="value">The secret value.</param>
|
||||
public SecretEditDialogViewModel(string key, string value)
|
||||
{
|
||||
_key = key;
|
||||
@@ -359,6 +432,9 @@ public class SecretEditDialogViewModel : ViewModelBase
|
||||
_isNewSecret = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the secret key.
|
||||
/// </summary>
|
||||
public string Key
|
||||
{
|
||||
get => _key;
|
||||
@@ -369,24 +445,42 @@ public class SecretEditDialogViewModel : ViewModelBase
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the secret value.
|
||||
/// </summary>
|
||||
public string Value
|
||||
{
|
||||
get => _value;
|
||||
set => SetProperty(ref _value, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets a value indicating whether this is a new secret being added.
|
||||
/// </summary>
|
||||
public bool IsNewSecret
|
||||
{
|
||||
get => _isNewSecret;
|
||||
set => SetProperty(ref _isNewSecret, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the key field is editable.
|
||||
/// </summary>
|
||||
public bool IsKeyEditable => _isNewSecret;
|
||||
|
||||
/// <summary>
|
||||
/// Gets the dialog title based on whether this is a new secret or edit.
|
||||
/// </summary>
|
||||
public string DialogTitle => _isNewSecret ? "Add Secret" : "Edit Secret";
|
||||
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether the dialog input is valid.
|
||||
/// </summary>
|
||||
public bool IsValid => !string.IsNullOrWhiteSpace(Key);
|
||||
|
||||
/// <summary>
|
||||
/// Gets the validation error message, or null if valid.
|
||||
/// </summary>
|
||||
public string? ValidationError
|
||||
{
|
||||
get
|
||||
|
||||
@@ -16,6 +16,12 @@ public class MainWindowViewModel : ViewModelBase
|
||||
private SecretItemViewModel? _selectedSecret;
|
||||
private string _statusMessage = "Ready";
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the MainWindowViewModel.
|
||||
/// </summary>
|
||||
/// <param name="storeManager">The secure store manager service.</param>
|
||||
/// <param name="dialogService">The dialog service for user interactions.</param>
|
||||
/// <param name="clipboardService">The clipboard service for copying secrets.</param>
|
||||
public MainWindowViewModel(
|
||||
ISecureStoreManager storeManager,
|
||||
IDialogService dialogService,
|
||||
@@ -102,24 +108,64 @@ public class MainWindowViewModel : ViewModelBase
|
||||
public bool HasUnsavedChanges => _storeManager.HasUnsavedChanges;
|
||||
|
||||
// File Commands
|
||||
/// <summary>
|
||||
/// Gets the command to create a new store.
|
||||
/// </summary>
|
||||
public ICommand NewStoreCommand { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the command to open an existing store.
|
||||
/// </summary>
|
||||
public ICommand OpenStoreCommand { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the command to save the current store.
|
||||
/// </summary>
|
||||
public ICommand SaveCommand { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the command to close the current store.
|
||||
/// </summary>
|
||||
public ICommand CloseStoreCommand { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the command to exit the application.
|
||||
/// </summary>
|
||||
public ICommand ExitCommand { get; }
|
||||
|
||||
// Secret Commands
|
||||
/// <summary>
|
||||
/// Gets the command to add a new secret.
|
||||
/// </summary>
|
||||
public ICommand AddSecretCommand { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the command to edit the selected secret.
|
||||
/// </summary>
|
||||
public ICommand EditSecretCommand { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the command to delete the selected secret.
|
||||
/// </summary>
|
||||
public ICommand DeleteSecretCommand { get; }
|
||||
|
||||
// Tools Commands
|
||||
/// <summary>
|
||||
/// Gets the command to generate a new key file.
|
||||
/// </summary>
|
||||
public ICommand GenerateKeyFileCommand { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the command to export the store's key.
|
||||
/// </summary>
|
||||
public ICommand ExportKeyCommand { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new store. Called by the dialog.
|
||||
/// </summary>
|
||||
/// <param name="storePath">The path where the store file will be created.</param>
|
||||
/// <param name="keyFilePath">Optional path to a key file for encryption.</param>
|
||||
/// <param name="password">Optional password for encryption.</param>
|
||||
public async Task CreateNewStoreAsync(string storePath, string? keyFilePath, string? password)
|
||||
{
|
||||
try
|
||||
@@ -154,6 +200,9 @@ public class MainWindowViewModel : ViewModelBase
|
||||
/// <summary>
|
||||
/// Opens an existing store. Called by the dialog.
|
||||
/// </summary>
|
||||
/// <param name="storePath">The path to the store file to open.</param>
|
||||
/// <param name="keyFilePath">Optional path to a key file for decryption.</param>
|
||||
/// <param name="password">Optional password for decryption.</param>
|
||||
public async Task OpenExistingStoreAsync(string storePath, string? keyFilePath, string? password)
|
||||
{
|
||||
try
|
||||
@@ -188,6 +237,9 @@ public class MainWindowViewModel : ViewModelBase
|
||||
/// <summary>
|
||||
/// Adds or updates a secret. Called by the dialog.
|
||||
/// </summary>
|
||||
/// <param name="key">The secret key identifier.</param>
|
||||
/// <param name="value">The secret value to store.</param>
|
||||
/// <param name="isNew">True if this is a new secret, false if updating an existing one.</param>
|
||||
public async Task SaveSecretAsync(string key, string value, bool isNew)
|
||||
{
|
||||
try
|
||||
@@ -415,9 +467,28 @@ public class MainWindowViewModel : ViewModelBase
|
||||
}
|
||||
|
||||
// Events for view to show dialogs (these require view-specific DataContext setup)
|
||||
/// <summary>
|
||||
/// Raised when a new store creation dialog should be shown.
|
||||
/// </summary>
|
||||
public event Action? OnRequestNewStoreDialog;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when an open store dialog should be shown.
|
||||
/// </summary>
|
||||
public event Action? OnRequestOpenStoreDialog;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when a new secret dialog should be shown.
|
||||
/// </summary>
|
||||
public event Action? OnRequestAddSecretDialog;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when an edit secret dialog should be shown with the specified key and value.
|
||||
/// </summary>
|
||||
public event Action<string, string>? OnRequestEditSecretDialog;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when the application should close.
|
||||
/// </summary>
|
||||
public event Action? OnRequestClose;
|
||||
}
|
||||
|
||||
@@ -11,6 +11,9 @@ public class RelayCommand : ICommand
|
||||
private readonly Predicate<object?>? _canExecute;
|
||||
private EventHandler? _canExecuteChanged;
|
||||
|
||||
/// <summary>
|
||||
/// Raised when the command's ability to execute may have changed.
|
||||
/// </summary>
|
||||
public event EventHandler? CanExecuteChanged
|
||||
{
|
||||
add => _canExecuteChanged += value;
|
||||
@@ -56,11 +59,20 @@ public class RelayCommand : ICommand
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the command can execute.
|
||||
/// </summary>
|
||||
/// <param name="parameter">An optional command parameter.</param>
|
||||
/// <returns>True if the command can execute, false otherwise.</returns>
|
||||
public bool CanExecute(object? parameter)
|
||||
{
|
||||
return _canExecute == null || _canExecute(parameter);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the command with the specified parameter.
|
||||
/// </summary>
|
||||
/// <param name="parameter">An optional command parameter.</param>
|
||||
public void Execute(object? parameter)
|
||||
{
|
||||
_execute(parameter);
|
||||
|
||||
@@ -13,6 +13,12 @@ public class SecretItemViewModel : ViewModelBase
|
||||
private bool _isValueVisible;
|
||||
private const string MaskedValue = "********";
|
||||
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SecretItemViewModel"/> class.
|
||||
/// </summary>
|
||||
/// <param name="key">The secret key name.</param>
|
||||
/// <param name="value">The secret value.</param>
|
||||
/// <param name="clipboardService">The clipboard service for copy operations.</param>
|
||||
public SecretItemViewModel(string key, string value, IClipboardService clipboardService)
|
||||
{
|
||||
Key = key;
|
||||
|
||||
@@ -8,6 +8,7 @@ namespace JdeScoping.SecureStoreManager.ViewModels;
|
||||
/// </summary>
|
||||
public abstract class ViewModelBase : INotifyPropertyChanged
|
||||
{
|
||||
/// <summary>Occurs when a property value changes.</summary>
|
||||
public event PropertyChangedEventHandler? PropertyChanged;
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user