mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-19 15:02:15 +01:00
Rework the depot, warehouse and vehicle base
A consist added to the warehouse gets a name there. The crew type stays through loading a consist. The vehicle base window replaces the texture base. The depot follows consists changed on the scenarios page, also with the warehouse tab left open.
This commit is contained in:
26
StarterNG/Views/MenuItems.cs
Normal file
26
StarterNG/Views/MenuItems.cs
Normal file
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Input;
|
||||
|
||||
namespace StarterNG.Views;
|
||||
|
||||
/// <summary>A menu entry that runs something when clicked, as nearly all of them do.</summary>
|
||||
internal static class MenuItems
|
||||
{
|
||||
/// <param name="header">The text, or a control where a row holds more than that.</param>
|
||||
public static MenuItem Item(object header, Action run, bool enabled = true, KeyGesture? gesture = null)
|
||||
{
|
||||
var item = new MenuItem { Header = header, IsEnabled = enabled, InputGesture = gesture };
|
||||
item.Click += (_, _) => run();
|
||||
return item;
|
||||
}
|
||||
|
||||
/// <summary>The entry at the end of a menu or a submenu.</summary>
|
||||
public static MenuItem AddItem(this ItemsControl menu, object header, Action run, bool enabled = true,
|
||||
KeyGesture? gesture = null)
|
||||
{
|
||||
var item = Item(header, run, enabled, gesture);
|
||||
menu.Items.Add(item);
|
||||
return item;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user