コード例 #1
0
        protected override Task OnKeyUp(ActionEventArgs <KeyPayload> args)
        {
            timer.Stop();
            if (!timerHasTick)
            {
                var currentStatus = status;
                if (currentStatus != null)
                {
                    switch (settings?.Type)
                    {
                    case PresetFunction.Avionics:
                        logger.LogInformation("Toggle AV Master. Current state: {state}.", currentStatus.IsAvMasterOn);
                        uint off = 0;
                        uint on  = 1;
                        flightConnector.AvMasterToggle(currentStatus.IsAvMasterOn ? off : on);
                        break;

                    case PresetFunction.ApMaster:
                        logger.LogInformation("Toggle AP Master. Current state: {state}.", currentStatus.IsAutopilotOn);
                        flightConnector.ApToggle();
                        break;

                    case PresetFunction.Heading:
                        logger.LogInformation("Toggle AP HDG. Current state: {state}.", currentStatus.IsApHdgOn);
                        flightConnector.ApHdgToggle();
                        break;

                    case PresetFunction.Nav:
                        logger.LogInformation("Toggle AP NAV. Current state: {state}.", currentStatus.IsApNavOn);
                        flightConnector.ApNavToggle();
                        break;

                    case PresetFunction.Altitude:
                        logger.LogInformation("Toggle AP ALT. Current state: {state}.", currentStatus.IsApAltOn);
                        flightConnector.ApAltToggle();
                        break;

                    case PresetFunction.VerticalSpeed:
                        logger.LogInformation("Toggle AP VS. Current state: {state}.", currentStatus.IsApVsOn);
                        flightConnector.ApVsToggle();
                        break;

                    case PresetFunction.Approach:
                        logger.LogInformation("Toggle AP APR. Current state: {state}.", currentStatus.IsApAprOn);
                        flightConnector.ApAprToggle();
                        break;
                    }
                }
            }
            timerHasTick = false;
            return(Task.CompletedTask);
        }
コード例 #2
0
        protected override Task OnKeyUp(ActionEventArgs <KeyPayload> args)
        {
            timer.Stop();
            if (!timerHasTick)
            {
                var currentStatus = status;
                if (currentStatus != null)
                {
                    switch (action)
                    {
                    case "tech.flighttracker.streamdeck.master.activate":
                        logger.LogInformation("Toggle AP Master. Current state: {state}.", currentStatus.IsAutopilotOn);
                        flightConnector.ApToggle();
                        break;

                    case "tech.flighttracker.streamdeck.heading.activate":
                        logger.LogInformation("Toggle AP HDG. Current state: {state}.", currentStatus.IsApHdgOn);
                        flightConnector.ApHdgToggle();
                        break;

                    case "tech.flighttracker.streamdeck.nav.activate":
                        logger.LogInformation("Toggle AP NAV. Current state: {state}.", currentStatus.IsApNavOn);
                        flightConnector.ApNavToggle();
                        break;

                    case "tech.flighttracker.streamdeck.approach.activate":
                        logger.LogInformation("Toggle AP APR. Current state: {state}.", currentStatus.IsApAprOn);
                        flightConnector.ApAprToggle();
                        break;

                    case "tech.flighttracker.streamdeck.altitude.activate":
                        logger.LogInformation("Toggle AP ALT. Current state: {state}.", currentStatus.IsApAltOn);
                        flightConnector.ApAltToggle();
                        break;
                    }
                }
            }
            timerHasTick = false;
            return(Task.CompletedTask);
        }