mirror of
https://github.com/KeyKeeperApp/KeyKeeper.git
synced 2026-04-17 18:16:28 +03:00
add logic for the entry edit window
This commit is contained in:
@@ -29,6 +29,7 @@ public class UnlockedRepositoryViewModel : ViewModelBase
|
||||
if (entry is PassStoreEntryPassword)
|
||||
{
|
||||
(passStore.GetRootDirectory() as PassStoreEntryGroup)!.ChildEntries.Add(entry);
|
||||
OnPropertyChanged(nameof(Passwords));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,19 +15,19 @@
|
||||
|
||||
<TextBlock Text="Entry name:" HorizontalAlignment="Right"
|
||||
Grid.Row="1" Grid.Column="0" Margin="5" />
|
||||
<TextBox Grid.Row="1" Grid.Column="1" Margin="5" />
|
||||
<TextBox Name="EntryNameEdit" Grid.Row="1" Grid.Column="1" Margin="5" />
|
||||
|
||||
<TextBlock Text="Username:" HorizontalAlignment="Right"
|
||||
Grid.Row="2" Grid.Column="0" Margin="5" />
|
||||
<TextBox Grid.Row="2" Grid.Column="1" Margin="5" />
|
||||
<TextBox Name="UsernameEdit" Grid.Row="2" Grid.Column="1" Margin="5" />
|
||||
|
||||
<TextBlock Text="Password:" HorizontalAlignment="Right"
|
||||
Grid.Row="3" Grid.Column="0" Margin="5" />
|
||||
<TextBox Grid.Row="3" Grid.Column="1" Margin="5" PasswordChar="*" />
|
||||
<TextBox Name="PasswordEdit" Grid.Row="3" Grid.Column="1" Margin="5" PasswordChar="*" />
|
||||
|
||||
<Button Content="Add!" HorizontalAlignment="Center"
|
||||
Grid.Row="4" Grid.Column="0" Grid.ColumnSpan="2"
|
||||
Background="#aaa" />
|
||||
Background="#aaa" Click="AddButton_Click" />
|
||||
</Grid>
|
||||
|
||||
<Window.Styles>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Interactivity;
|
||||
using KeyKeeper.PasswordStore;
|
||||
using static KeyKeeper.PasswordStore.FileFormatConstants;
|
||||
|
||||
namespace KeyKeeper.Views;
|
||||
|
||||
@@ -12,4 +14,39 @@ public partial class EntryEditWindow: Window
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void AddButton_Click(object sender, RoutedEventArgs args)
|
||||
{
|
||||
string name = EntryNameEdit.Text ?? "";
|
||||
name = name.Trim();
|
||||
if (name.Length == 0) return;
|
||||
|
||||
string username = UsernameEdit.Text ?? "";
|
||||
username = username.Trim();
|
||||
if (username.Length == 0) return;
|
||||
|
||||
string password = UsernameEdit.Text ?? "";
|
||||
password = password.Trim();
|
||||
if (password.Length == 0) return;
|
||||
|
||||
EditedEntry = new PassStoreEntryPassword(
|
||||
new Guid(),
|
||||
DateTime.UtcNow,
|
||||
DateTime.UtcNow,
|
||||
Guid.Empty,
|
||||
name,
|
||||
new LoginField()
|
||||
{
|
||||
Type = LOGIN_FIELD_USERNAME_ID,
|
||||
Value = username
|
||||
},
|
||||
new LoginField()
|
||||
{
|
||||
Type = LOGIN_FIELD_PASSWORD_ID,
|
||||
Value = password
|
||||
},
|
||||
null
|
||||
);
|
||||
Close();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user