public void Dispose() { if (_commandRef != default) { UtilitiesAPI.CommandEnd(_commandRef); _commandRef = default; } }
override public void Run(String[] args) { CommandCatalog catalog = new CommandCatalog(); if (args.Length > 0) { CommandRef subcommand = catalog.Get(args[0]); if (subcommand != null) { TextBuiltin cmd = subcommand.Create(); cmd.OnlineHelp(); } else { OfflineHelp(); } } else { OfflineHelp(); } }
protected override bool OnStart() { Menu.PluginsMenu .AddItem("Sample Menu", item => { _menu = item.CreateSubMenu() .AddItem("Toggle Settings", out _, OnToggleSettings) .AddSeparator() .AddItem("Toggle Shortcuts", out _toggleShortcuts) .AddItem("Toggle Flight Configuration (Command-Based)", CommandRef.Find("sim/operation/toggle_flight_config")); }); _menu.Click += OnMenuClick; if (Menu.AircraftMenu != null) { // This will be null unless this plugin was loaded with an aircraft (i.e., it was located in the current aircraft's "plugins" subdirectory) Menu.AircraftMenu .AddItem("Toggle Settings (Command-Based)", CommandRef.Find("sim/operation/toggle_settings_window")); } return(true); }
public CommandDisposableScope(CommandRef commandRef) { _commandRef = commandRef; UtilitiesAPI.CommandBegin(_commandRef); }