Пример #1
0
 public void Dispose()
 {
     if (_commandRef != default)
     {
         UtilitiesAPI.CommandEnd(_commandRef);
         _commandRef = default;
     }
 }
Пример #2
0
        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();
            }
        }
Пример #3
0
        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);
        }
Пример #4
0
 public CommandDisposableScope(CommandRef commandRef)
 {
     _commandRef = commandRef;
     UtilitiesAPI.CommandBegin(_commandRef);
 }