diff --git a/Cryptura/Cryptura.csproj b/Cryptura/Cryptura.csproj
index 938a6e6..cc14301 100644
--- a/Cryptura/Cryptura.csproj
+++ b/Cryptura/Cryptura.csproj
@@ -7,7 +7,7 @@
app.manifest
true
1.0
- 1.0
+ 1.2
diff --git a/Cryptura/MainWindow.axaml b/Cryptura/MainWindow.axaml
index d628e3d..75e004e 100644
--- a/Cryptura/MainWindow.axaml
+++ b/Cryptura/MainWindow.axaml
@@ -9,6 +9,8 @@
Background="Transparent"
Height="400"
Width="520"
+ MinHeight="340"
+ MinWidth="340"
WindowStartupLocation="CenterScreen"
Title="Cryptura">
@@ -24,8 +26,10 @@
-
-
+
+
+
@@ -33,11 +37,22 @@
+
-
-
+
+
@@ -45,12 +60,15 @@
-
+
+
-
-
-
+
+
-
+
-
+
-
+
+
-
-
diff --git a/Cryptura/MainWindow.axaml.cs b/Cryptura/MainWindow.axaml.cs
index 2677f56..324a8bb 100644
--- a/Cryptura/MainWindow.axaml.cs
+++ b/Cryptura/MainWindow.axaml.cs
@@ -45,7 +45,8 @@ public partial class MainWindow : Window
if (Path.GetExtension(file).ToLower() == ".wx")
{
Password pw = new Password(file);
- passwords.Add(pw);
+ if(!String.IsNullOrEmpty(pw.Value))
+ passwords.Add(pw);
}
else
{
@@ -65,11 +66,7 @@ public partial class MainWindow : Window
}
}
- private void Button_OnClick(object? sender, RoutedEventArgs e)
- {
- censorPasswords = !censorPasswords;
- FetchPasswords();
- }
+
private void PasswordList_OnSelectionChanged(object? sender, SelectionChangedEventArgs e)
{
@@ -83,12 +80,23 @@ public partial class MainWindow : Window
private void DeletePassword_OnClick(object? sender, RoutedEventArgs e)
{
- throw new NotImplementedException();
+ if (PasswordList.SelectedItem is Password password)
+ {
+ File.Delete(password.WxFile.Path);
+ FetchPasswords();
+ }
+
+ }
+ private void ToggleHide_OnClick(object? sender, RoutedEventArgs e)
+ {
+ censorPasswords = !censorPasswords;
+ FetchPasswords();
}
private void ErrorMessage(string message)
{
- //TODO: Show Error in GUI
+ ErrorTextBlock.Text = message;
+ ErrorTextBlock.IsVisible = true;
}
private void SavePassword()
@@ -110,7 +118,17 @@ public partial class MainWindow : Window
}
Password newPassword = new Password(PasswordName.Text, PasswordValue.Text);
FetchPasswords();
+ ResetPasswordModal();
+ }
+
+ private void ResetPasswordModal()
+ {
AddPasswordContainer.IsVisible = false;
+ PasswordName.Text = "";
+ PasswordValue.Text = "";
+ PasswordRepeat.Text = "";
+ ErrorTextBlock.IsVisible = false;
+
}
private void PasswordSave_OnClick(object? sender, RoutedEventArgs e)
@@ -125,4 +143,13 @@ public partial class MainWindow : Window
SavePassword();
}
}
+
+ private void OuterBorder_OnPointerPressed(object? sender, PointerPressedEventArgs e)
+ {
+ ResetPasswordModal();
+ }
+ private void InnerBorder_OnPointerPressed(object sender, PointerPressedEventArgs e)
+ {
+ e.Handled = true;
+ }
}
\ No newline at end of file
diff --git a/Cryptura/Password.cs b/Cryptura/Password.cs
index b581680..6ea2b2a 100644
--- a/Cryptura/Password.cs
+++ b/Cryptura/Password.cs
@@ -14,7 +14,7 @@ public class Password
public string DisplayValue
{
- get => MainWindow.censorPasswords ? Value : CensoredValue;
+ get => MainWindow.censorPasswords ? CensoredValue : Value;
}
public Password(string name, string value)
diff --git a/Cryptura/PasswordWindow.axaml b/Cryptura/PasswordWindow.axaml
index 3073f9b..7fce86d 100644
--- a/Cryptura/PasswordWindow.axaml
+++ b/Cryptura/PasswordWindow.axaml
@@ -9,7 +9,9 @@
Title="Cryptura"
CanResize="False"
Width="430"
- Height="170">
+ Height="170"
+ Loaded="Control_OnLoaded"
+ WindowStartupLocation="CenterScreen">
@@ -22,7 +24,6 @@
-
diff --git a/Cryptura/PasswordWindow.axaml.cs b/Cryptura/PasswordWindow.axaml.cs
index eee0338..48df552 100644
--- a/Cryptura/PasswordWindow.axaml.cs
+++ b/Cryptura/PasswordWindow.axaml.cs
@@ -32,10 +32,6 @@ public partial class PasswordWindow : Window
AdjustThemeToPlatform();
}
- private void WindowBase_OnResized(object? sender, WindowResizedEventArgs e)
- {
- Console.WriteLine(e.ClientSize);
- }
private void ConfirmPassword()
{
@@ -54,4 +50,9 @@ public partial class PasswordWindow : Window
ConfirmPassword();
}
}
+
+ private void Control_OnLoaded(object? sender, RoutedEventArgs e)
+ {
+ MasterPasswordBox.Focus();
+ }
}
\ No newline at end of file