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 =
|
2024-07-14 00:55:15 -07:00
|
|
|
AvaloniaProperty.Register<Askpass, bool>(nameof(ShowPassword));
|
2024-07-09 00:26:46 -07:00
|
|
|
|
|
|
|
public bool ShowPassword
|
|
|
|
{
|
|
|
|
get => GetValue(ShowPasswordProperty);
|
|
|
|
set => SetValue(ShowPasswordProperty, value);
|
|
|
|
}
|
|
|
|
|
2024-07-09 02:56:23 -07:00
|
|
|
public string Description
|
2024-07-08 07:07:00 -07:00
|
|
|
{
|
|
|
|
get;
|
|
|
|
private set;
|
|
|
|
} = string.Empty;
|
|
|
|
|
|
|
|
public string Passphrase
|
|
|
|
{
|
|
|
|
get;
|
|
|
|
set;
|
|
|
|
} = string.Empty;
|
|
|
|
|
|
|
|
public Askpass()
|
|
|
|
{
|
|
|
|
DataContext = this;
|
|
|
|
InitializeComponent();
|
|
|
|
}
|
|
|
|
|
2024-07-09 02:56:23 -07:00
|
|
|
public Askpass(string description)
|
2024-07-08 07:07:00 -07:00
|
|
|
{
|
2024-07-09 02:56:23 -07:00
|
|
|
Description = description;
|
2024-07-08 07:07:00 -07:00
|
|
|
DataContext = this;
|
|
|
|
InitializeComponent();
|
|
|
|
}
|
|
|
|
|
2024-07-14 00:55:15 -07:00
|
|
|
private void BeginMoveWindow(object _, PointerPressedEventArgs e)
|
2024-07-08 07:07:00 -07:00
|
|
|
{
|
|
|
|
BeginMoveDrag(e);
|
|
|
|
}
|
|
|
|
|
2024-07-14 00:55:15 -07:00
|
|
|
private void CloseWindow(object _1, RoutedEventArgs _2)
|
2024-07-08 07:07:00 -07:00
|
|
|
{
|
|
|
|
Console.Out.WriteLine("No passphrase entered.");
|
2024-07-14 18:54:46 -07:00
|
|
|
App.Quit(-1);
|
2024-07-08 07:07:00 -07:00
|
|
|
}
|
|
|
|
|
2024-07-14 00:55:15 -07:00
|
|
|
private void EnterPassword(object _1, RoutedEventArgs _2)
|
2024-07-08 07:07:00 -07:00
|
|
|
{
|
|
|
|
Console.Out.Write($"{Passphrase}\n");
|
2024-07-14 18:54:46 -07:00
|
|
|
App.Quit(0);
|
2024-07-08 07:07:00 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|