2024-07-08 07:07:00 -07:00
|
|
|
using System;
|
|
|
|
|
2024-07-09 00:26:46 -07:00
|
|
|
using Avalonia;
|
2024-07-08 07:07:00 -07:00
|
|
|
using Avalonia.Input;
|
|
|
|
using Avalonia.Interactivity;
|
|
|
|
|
|
|
|
namespace SourceGit.Views
|
|
|
|
{
|
|
|
|
public partial class Askpass : ChromelessWindow
|
|
|
|
{
|
2024-07-09 00:26:46 -07:00
|
|
|
public static readonly StyledProperty<bool> ShowPasswordProperty =
|
|
|
|
AvaloniaProperty.Register<Askpass, bool>(nameof(ShowPassword), false);
|
|
|
|
|
|
|
|
public bool ShowPassword
|
|
|
|
{
|
|
|
|
get => GetValue(ShowPasswordProperty);
|
|
|
|
set => SetValue(ShowPasswordProperty, value);
|
|
|
|
}
|
|
|
|
|
2024-07-08 07:07:00 -07:00
|
|
|
public string KeyName
|
|
|
|
{
|
|
|
|
get;
|
|
|
|
private set;
|
|
|
|
} = string.Empty;
|
|
|
|
|
|
|
|
public string Passphrase
|
|
|
|
{
|
|
|
|
get;
|
|
|
|
set;
|
|
|
|
} = string.Empty;
|
|
|
|
|
|
|
|
public Askpass()
|
|
|
|
{
|
|
|
|
DataContext = this;
|
|
|
|
InitializeComponent();
|
|
|
|
}
|
|
|
|
|
|
|
|
public Askpass(string keyname)
|
|
|
|
{
|
|
|
|
KeyName = keyname;
|
|
|
|
DataContext = this;
|
|
|
|
InitializeComponent();
|
|
|
|
}
|
|
|
|
|
|
|
|
private void BeginMoveWindow(object sender, PointerPressedEventArgs e)
|
|
|
|
{
|
|
|
|
BeginMoveDrag(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void CloseWindow(object sender, RoutedEventArgs e)
|
|
|
|
{
|
|
|
|
Console.Out.WriteLine("No passphrase entered.");
|
|
|
|
Environment.Exit(-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void EnterPassword(object sender, RoutedEventArgs e)
|
|
|
|
{
|
|
|
|
Console.Out.Write($"{Passphrase}\n");
|
|
|
|
Environment.Exit(0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|