try to implement MessageBox

This commit is contained in:
2023-10-12 13:28:59 +06:00
parent e31df8e029
commit e3a3fb5e5e
6 changed files with 49 additions and 10 deletions

View File

@@ -27,6 +27,14 @@ public partial class LauncherWindow : Window
SelectTab(LibraryButton, null);
FillProgramsPanel();
Logger.Log("launcher started");
try
{
throw new Exception("aaa");
}
catch (Exception ex)
{
LogError("main window", ex);
}
}
void LogHandler(string m) => Dispatcher.UIThread.InvokeAsync(()=>LogBox.Text += m);

View File

@@ -3,7 +3,23 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="MessageBox"
d:DesignHeight="450"
d:DesignWidth="800"
mc:Ignorable="d" />
mc:Ignorable="d"
Height="100"
Width="200"
Background="{DynamicResource MyBackgroundColor}">
<Grid>
<Grid.RowDefinitions>* 30</Grid.RowDefinitions>
<TextBox Name="TextBlock" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
Foreground="{DynamicResource MyWhite}"
ScrollViewer.VerticalScrollBarVisibility="Auto"
IsReadOnly="True" TextWrapping="Wrap"
FontSize="14"/>
<Button Grid.Row="1" Click="Button_OnClick"
HorizontalAlignment="Center" VerticalAlignment="Bottom"
Foreground="{DynamicResource MyWhite}"
FontSize="16">
OK
</Button>
</Grid>
</Window>

View File

@@ -1,4 +1,6 @@
namespace Launcher.Client.Avalonia.GUI;
using Avalonia.Interactivity;
namespace Launcher.Client.Avalonia.GUI;
public partial class MessageBox : Window
{
@@ -9,6 +11,15 @@ public partial class MessageBox : Window
public static void Show(string title, string text)
{
throw new NotImplementedException();
var mb = new MessageBox();
mb.Title = title;
mb.TextBlock.Text = text;
mb.Topmost = true;
mb.Show();
}
private void Button_OnClick(object sender, RoutedEventArgs e)
{
this.Close();
}
}