sourcegit/src/Views/Askpass.axaml.cs

63 lines
1.4 KiB
C#
Raw Normal View History

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