mirror of
https://github.com/MaSzyna-EU07/StarterNG.git
synced 2026-11-18 22:45:59 +01:00
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.
27 lines
956 B
C#
27 lines
956 B
C#
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;
|
|
}
|
|
}
|