Добавлена кнопка и окно "О приложении"

Добавлена кнопка "О приложении" в окне настроек (SettingsWindow.cs), а также окно "О приложении" (AboutWindow.cs)
This commit is contained in:
Быстров Михаил Евгеньевич
2025-11-14 18:15:11 +03:00
parent e3510a379a
commit 9aef0bd3c3
2 changed files with 62 additions and 3 deletions

View File

@@ -0,0 +1,50 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Layout;
using Avalonia.Media;
namespace KeyKeeper.Views;
public class AboutWindow : Window
{
public AboutWindow()
{
this.Title = "О приложении";
this.Width = 600;
this.Height = 400;
var AboutKeyKeeper = new TextBlock
{
Text = "About Keykeeper",
HorizontalAlignment = HorizontalAlignment.Left,
FontSize = 50,
TextAlignment = TextAlignment.Left
};
var AboutText = new TextBlock
{
Text = "KeyKeeper is a personal password and key manager\nwhere you can save passwords and other login\ninformation, configure one-time code generation,\nand create encryption keys for personal use",
HorizontalAlignment = HorizontalAlignment.Left,
FontSize = 16,
TextAlignment = TextAlignment.Left,
Margin = new Thickness(0, 20, 0, 0)
};
var mainGrid = new Grid
{
VerticalAlignment = VerticalAlignment.Center,
HorizontalAlignment = HorizontalAlignment.Center
};
var innerStack = new StackPanel
{
Width = 400
};
innerStack.Children.Add(AboutKeyKeeper);
innerStack.Children.Add(AboutText);
mainGrid.Children.Add(innerStack);
this.Content = mainGrid;
}
}

View File

@@ -5,18 +5,27 @@ using Avalonia.Media;
namespace KeyKeeper.Views;
public class SettingsWindow : Window
{
private async void OpenAbout()
{
var AboutWindow = new AboutWindow();
await AboutWindow.ShowDialog(this);
}
public SettingsWindow()
{
this.Title = "Настройки";
this.Width = 400;
this.Height = 300;
var textBlock = new TextBlock
var AboutButton = new Button
{
Text = "Окно настроек",
Content = "О приложении",
HorizontalAlignment = Avalonia.Layout.HorizontalAlignment.Center,
VerticalAlignment = Avalonia.Layout.VerticalAlignment.Center,
FontSize = 16
};
this.Content = textBlock;
AboutButton.Click += (sender, e) => OpenAbout();
this.Content = AboutButton;
}
}