Пример #1
0
        private void MissionCommandsExecute(SoftkeyEnum obj)
        {
            if (VehicleSelected == null)
            {
                return;
            }
            switch (obj)
            {
            case SoftkeyEnum.ArmDisArm:
                var guiQuadVehicle = VehicleSelected as GuiQuadVehicle;
                VehicleComponent.SetArmDisArmCommand(VehicleSelected.ID, !guiQuadVehicle.QuadStatus.Armed);
                break;

            case SoftkeyEnum.Loiter:
                break;

            case SoftkeyEnum.ReturnToLaunch:
                break;

            case SoftkeyEnum.SetHome:
                break;

            case SoftkeyEnum.StartMission:
                MissionComponent.StartMission(VehicleSelected.ID, 0);
                break;

            case SoftkeyEnum.StopMission:
                MissionComponent.StopMission(VehicleSelected.ID, 0);
                break;

            case SoftkeyEnum.RestartMission:
                MissionComponent.RestartMission(VehicleSelected.ID, 0, 0);
                break;

            case SoftkeyEnum.Auto:
                break;

            case SoftkeyEnum.Sensor:
                break;

            case SoftkeyEnum.Reserve:
                break;

            case SoftkeyEnum.TaskOff:
                VehicleComponent.TakeOffCommand(VehicleSelected.ID, 100, (float)VehicleSelected.Latitude,
                                                (float)VehicleSelected.Longitude, (float)VehicleSelected.Heading);
                break;

            default:
                throw new ArgumentOutOfRangeException("obj");
            }
        }
Пример #2
0
        private async void MissionCommandsExecute(SoftkeyEnum obj)
        {
            await AsyncUtil.RaunAsync(() =>
            {
                switch (obj)
                {
                case SoftkeyEnum.StartMission:
                    {
                        foreach (var vehicle in Vehicles.Where(vehicle => vehicle.IsSelected))
                        {
                            MissionComponent.StartMission(vehicle.ID, 0);
                            Thread.Sleep(1000);
                            Debug.WriteLine("StartMission - vehicle " + vehicle.ID);
                        }
                    }

                    break;

                case SoftkeyEnum.StopMission:
                    {
                        foreach (var vehicle in Vehicles.Where(vehicle => vehicle.IsSelected))
                        {
                            MissionComponent.StopMission(vehicle.ID, 0);
                            Thread.Sleep(1000);
                            Debug.WriteLine("StopMission - vehicle " + vehicle.ID);
                        }
                    }

                    break;

                case SoftkeyEnum.RestartMission:
                    {
                        foreach (var vehicle in Vehicles.Where(vehicle => vehicle.IsSelected))
                        {
                            MissionComponent.RestartMission(vehicle.ID, 0, 0);
                            Thread.Sleep(1000);
                            Debug.WriteLine("RestartMission - vehicle " + vehicle.ID);
                        }
                    }
                    break;
                }
                return(obj);
            });
        }