58 lines
No EOL
1.5 KiB
C#
58 lines
No EOL
1.5 KiB
C#
using System;
|
|
using Avalonia;
|
|
using Avalonia.Controls;
|
|
using Avalonia.Input;
|
|
using Avalonia.Interactivity;
|
|
using Avalonia.Markup.Xaml;
|
|
using Avalonia.Media;
|
|
|
|
namespace Cryptura;
|
|
|
|
public partial class PasswordWindow : Window
|
|
{
|
|
private void AdjustThemeToPlatform()
|
|
{
|
|
if (Core.IsRunningOnGnome())
|
|
{
|
|
this.TransparencyLevelHint = new[] { WindowTransparencyLevel.None };
|
|
this.Background = new SolidColorBrush(Color.Parse(ColorScheme.Surface.Color_1));
|
|
this.ContentBorder.Background = new SolidColorBrush(Color.Parse(ColorScheme.Surface.Color_2));
|
|
AcrylicBorderObject.IsVisible = false;
|
|
}
|
|
else
|
|
{
|
|
this.TransparencyLevelHint = new[] { WindowTransparencyLevel.AcrylicBlur };
|
|
this.Background = Brushes.Transparent;
|
|
AcrylicBorderObject.IsVisible = true;
|
|
}
|
|
}
|
|
public PasswordWindow()
|
|
{
|
|
InitializeComponent();
|
|
AdjustThemeToPlatform();
|
|
}
|
|
|
|
|
|
private void ConfirmPassword()
|
|
{
|
|
new MainWindow(MasterPasswordBox.Text ?? "").Show();
|
|
this.Close();
|
|
}
|
|
private void MasterPasswordConfirm_OnClick(object? sender, RoutedEventArgs e)
|
|
{
|
|
ConfirmPassword();
|
|
}
|
|
|
|
private void MasterPasswordBox_OnKeyDown(object? sender, KeyEventArgs e)
|
|
{
|
|
if (e.Key == Key.Enter)
|
|
{
|
|
ConfirmPassword();
|
|
}
|
|
}
|
|
|
|
private void Control_OnLoaded(object? sender, RoutedEventArgs e)
|
|
{
|
|
MasterPasswordBox.Focus();
|
|
}
|
|
} |