mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-07 14:31:18 +01:00
Gate Start on crew, pick starting vehicle, loading screen and help menu
#16 and #12 Start is enabled only with crew/passenger (hold Ctrl to force); the chosen starting vehicle is carried through launch; loading-screen logo; help menu; runtime language picker.
This commit is contained in:
56
StarterNG/Views/MessageBox.cs
Normal file
56
StarterNG/Views/MessageBox.cs
Normal file
@@ -0,0 +1,56 @@
|
||||
using System.Threading.Tasks;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Layout;
|
||||
using Avalonia.Media;
|
||||
|
||||
namespace StarterNG.Views;
|
||||
|
||||
public enum MessageBoxButtons
|
||||
{
|
||||
YesNo
|
||||
}
|
||||
|
||||
public static class MessageBox
|
||||
{
|
||||
/// <summary>Simple Yes/No dialog. Returns true for Yes.</summary>
|
||||
public static async Task<bool> Show(Window owner, string message, string title, MessageBoxButtons _)
|
||||
{
|
||||
var win = new Window
|
||||
{
|
||||
Title = title,
|
||||
Width = 420,
|
||||
SizeToContent = SizeToContent.Height,
|
||||
WindowStartupLocation = WindowStartupLocation.CenterOwner,
|
||||
CanResize = false
|
||||
};
|
||||
|
||||
bool yes = false;
|
||||
var yesBtn = new Button { Content = App.Loc["Yes"], MinWidth = 80, Cursor = new Avalonia.Input.Cursor(Avalonia.Input.StandardCursorType.Hand) };
|
||||
yesBtn.Classes.Add("Accent");
|
||||
yesBtn.Click += (_, _) => { yes = true; win.Close(); };
|
||||
|
||||
var noBtn = new Button { Content = App.Loc["No"], MinWidth = 80, Cursor = new Avalonia.Input.Cursor(Avalonia.Input.StandardCursorType.Hand) };
|
||||
noBtn.Classes.Add("Flat");
|
||||
noBtn.Click += (_, _) => win.Close();
|
||||
|
||||
win.Content = new StackPanel
|
||||
{
|
||||
Margin = new Avalonia.Thickness(16),
|
||||
Spacing = 16,
|
||||
Children =
|
||||
{
|
||||
new TextBlock { Text = message, TextWrapping = TextWrapping.Wrap },
|
||||
new StackPanel
|
||||
{
|
||||
Orientation = Orientation.Horizontal,
|
||||
HorizontalAlignment = HorizontalAlignment.Right,
|
||||
Spacing = 8,
|
||||
Children = { yesBtn, noBtn }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
await win.ShowDialog(owner);
|
||||
return yes;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user