1e21e33ade
Move SecureStoreManager project and tests to Deprecated folder and remove from solution. SecureStore functionality is now integrated into ConfigManager.
58 lines
1.8 KiB
C#
58 lines
1.8 KiB
C#
using Avalonia.Controls;
|
|
using Avalonia.Interactivity;
|
|
using JdeScoping.SecureStoreManager.ViewModels;
|
|
using MsBox.Avalonia;
|
|
using MsBox.Avalonia.Enums;
|
|
|
|
namespace JdeScoping.SecureStoreManager.Views;
|
|
|
|
public partial class SecretEditDialog : Window
|
|
{
|
|
/// <summary>
|
|
/// Gets the view model for this dialog.
|
|
/// </summary>
|
|
public SecretEditDialogViewModel ViewModel => (SecretEditDialogViewModel)DataContext!;
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="SecretEditDialog"/> class for creating a new secret.
|
|
/// </summary>
|
|
public SecretEditDialog()
|
|
{
|
|
InitializeComponent();
|
|
DataContext = new SecretEditDialogViewModel();
|
|
}
|
|
|
|
/// <summary>
|
|
/// Initializes a new instance of the <see cref="SecretEditDialog"/> class for editing an existing secret.
|
|
/// </summary>
|
|
/// <param name="key">The secret key.</param>
|
|
/// <param name="value">The secret value.</param>
|
|
public SecretEditDialog(string key, string value)
|
|
{
|
|
InitializeComponent();
|
|
DataContext = new SecretEditDialogViewModel(key, value);
|
|
}
|
|
|
|
private async void SaveButton_Click(object? sender, RoutedEventArgs e)
|
|
{
|
|
if (!ViewModel.IsValid)
|
|
{
|
|
var box = MessageBoxManager
|
|
.GetMessageBoxStandard(
|
|
"Validation Error",
|
|
ViewModel.ValidationError ?? "Please fill in all required fields.",
|
|
ButtonEnum.Ok,
|
|
MsBox.Avalonia.Enums.Icon.Warning);
|
|
await box.ShowWindowDialogAsync(this);
|
|
return;
|
|
}
|
|
|
|
Close(true);
|
|
}
|
|
|
|
private void CancelButton_Click(object? sender, RoutedEventArgs e)
|
|
{
|
|
Close(false);
|
|
}
|
|
}
|