Exemplo n.º 1
0
 public MaintenanceViewModel(IVehiclesSource vehiclesSource, IVehicleComponent vehicleComponent, IMissionComponent missionComponent, IMissionSource missionSource)
 {
     MissionSource    = missionSource;
     MissionComponent = missionComponent;
     VehiclesSource   = vehiclesSource;
     VehicleComponent = vehicleComponent;
 }
Exemplo n.º 2
0
        private void AddToTreeList(IVehicleComponent vehicleComponent)
        {
            DesignTreeListView.BeginUnboundLoad();

            TreeListNode ParentNodeForRoot = null;

            if (BodyNeedsToAdd)
            {
                ParentNodeForRoot = DesignTreeListView.Nodes[0].Nodes[0].Nodes[0];
            }
            else if (SpringNeedsToAdd)
            {
                ParentNodeForRoot = DesignTreeListView.Nodes[0].Nodes[0].Nodes[1];
            }
            else if (DamperNeedsToAdd)
            {
                ParentNodeForRoot = DesignTreeListView.Nodes[0].Nodes[0].Nodes[2];
            }

            TreeListNode NewBody = DesignTreeListView.AppendNode(new object[] { null }, ParentNodeForRoot, vehicleComponent);

            ParentNodeForRoot.LastNode.SetValue(DesignTreeListColumn, vehicleComponent.Name);

            DesignTreeListView.EndUnboundLoad();

            DesignTreeListView.ExpandAll();

            BodyNeedsToAdd   = false;
            SpringNeedsToAdd = false;
            DamperNeedsToAdd = false;
        }
Exemplo n.º 3
0
 public ButtonsControlViewModel(IVehicleComponent vehicleComponent, IMissionComponent missionComponent)
 {
     VehicleComponent = vehicleComponent;
     MissionComponent = missionComponent;
     ButtonCommands   = new RelayCommand <SoftkeyEnum>(ButtonCommandsAction);
     QuadModeCommand  = new RelayCommand <VehicleModeEnum>(QuadModeCommandAction);
     Messenger.Default.Register <VehicleSelected>(this, VehicleSelectedAction);
 }
Exemplo n.º 4
0
        public void AddDamper(IVehicleComponent component)
        {
            if (DamperNeedsToAdd && component.Type == VehicleComponentType.Damper)
            {
                Dampers.Add(component);

                DamperNeedsToAdd = false;
            }
        }
Exemplo n.º 5
0
        public void AddSpring(IVehicleComponent component)
        {
            if (SpringNeedsToAdd && component.Type == VehicleComponentType.Spring)
            {
                Springs.Add(component);

                SpringNeedsToAdd = false;
            }
        }
Exemplo n.º 6
0
        public void AddBody(IVehicleComponent component)
        {
            if (BodyNeedsToAdd && component.Type == VehicleComponentType.Body)
            {
                Bodies.Add(component);

                BodyNeedsToAdd = false;
            }
        }
Exemplo n.º 7
0
        public JoystickViewModel(IVehicleComponent vehicleComponent)
        {
            VehicleComponent = vehicleComponent;
            Messenger.Default.Register <VehicleSelected>(this, VehicleSelectedAction);
            SenderTimer = new DispatcherTimer {
                Interval = new TimeSpan(0, 0, 0, 0, 1000 / 12)
            };
            UiThread = new DispatcherTimer {
                Interval = new TimeSpan(0, 0, 0, 0, 1000 / 12)
            };

            UiThread.Tick += UiThread_Tick;
            UiThread.Start();
            _joystick = new MAVLink.mavlink_rc_channels_override_t();
            // make sure that DirectInput has been initialized
            var dinput = new DirectInput();

            // search for devices
            foreach (DeviceInstance device in dinput.GetDevices(DeviceClass.GameController, DeviceEnumerationFlags.AttachedOnly))
            {
                // create the device
                try
                {
                    joystick = new Joystick(dinput, device.InstanceGuid);

                    break;
                }
                catch (DirectInputException exception)
                {
                    Logger.Error("JoystickViewModel", exception);
                }
            }

            if (joystick == null)
            {
                //MessageBox.Show("There are no joysticks attached to the system.");
                return;
            }
            foreach (DeviceObjectInstance deviceObject in joystick.GetObjects())
            {
                if ((deviceObject.ObjectType & ObjectDeviceType.Axis) != 0)
                {
                    joystick.GetObjectPropertiesById((int)deviceObject.ObjectType).SetRange(MinJoystickRange, MaxJoystickRange);
                }
            }
            Equalisers = new ObservableCollection <Equaliser>();
            for (int i = 0; i < 12; i++)
            {
                Equalisers.Add(new Equaliser {
                    Id = i + 1, Channel = 1, Value = 0, IsChecked = false, Receiver = 0
                });
            }
        }
Exemplo n.º 8
0
 //public Mission Mission { get; set; }
 public RightCommandsControlViewModel(IVehicleComponent vehicleComponent, IMissionComponent missionComponent, IMissionSource missionSource)
 {
     VehicleComponent = vehicleComponent;
     MissionComponent = missionComponent;
     MissionSource    = missionSource;
     //ListWaypoint = listWaypoint;
     WriteMissionCommand = new RelayCommand(WriteMissionCommandExecute, WriteMissionCommandCanExecute);
     ReadMissionCommand  = new RelayCommand(ReadMissionCommandExecute, ReadMissionCommandCanExecute);
     LoadMissionCommand  = new RelayCommand(LoadMissionCommandExecute, LoadMissionCommandCanExecute);
     SaveMissionCommand  = new RelayCommand(SaveMissionCommandExecute, SaveMissionCommandCanExecute);
     DrawCommand         = new RelayCommand(DrawCommandExecute);
     Messenger.Default.Register <VehicleSelected>(this, VehicleSelectedAction);
 }
Exemplo n.º 9
0
        public QuadToolActionViewModel(IVehiclesSource vehiclesSource, IMissionSource missionSource, IVehicleComponent vehicleComponent, IMissionComponent missionComponent)
        {
            VehicleComponent    = vehicleComponent;
            VehiclesSource      = vehiclesSource;
            MissionSource       = missionSource;
            MissionComponent    = missionComponent;
            CommandState        = new RelayCommand <object>(CommandStateClick);
            SelectedTaskCommand = new RelayCommand <ITask>(SelectedTaskCommandExecute);
            Messenger.Default.Register <VehicleSelected>(this, VehicleSelectedFunction);
            VisibilityView     = Visibility.Hidden;
            CommandsActionMode = new RelayCommand <VehicleModeEnum>(CommandsActionModeExecute);

            Messenger.Default.Register <UpdataMissionMessenger>(this, UpdataMissionMessengerMessenger);
        }
Exemplo n.º 10
0
 public QuadsStatusViewModel(IVehiclesSource vehiclesSource, IVehicleComponent vehicleComponent, IMissionComponent missionComponent, IMissionSource missionSource)
 {
     MissionSource           = missionSource;
     MissionComponent        = missionComponent;
     VehiclesSource          = vehiclesSource;
     VehicleComponent        = vehicleComponent;
     ArmModeCommand          = new RelayCommand(ArmModeCommandExecute);
     DisArmModeCommand       = new RelayCommand(DisArmModeCommandExecute);
     QuadModeCommand         = new RelayCommand <VehicleModeEnum>(QuadModeCommandExecute);
     TakeOffCommand          = new RelayCommand(TakeOffCommandExecute);
     MissionCommands         = new RelayCommand <SoftkeyEnum>(MissionCommandsExecute);
     JoystickRestartCommands = new RelayCommand(JoystickRestartCommandsExecute);
     SetNextWaypointCommand  = new RelayCommand(SetNextWaypointCommandExecute);
     SelectTaskCommand       = new RelayCommand <object>(SelectTaskCommandExecute);
     SendMissionCommands     = new RelayCommand(SendMissionCommandsExecute);
     AltTakeOff = 10;
     Messenger.Default.Register <UpdataMissionMessenger>(this, UpdataMissionMessengerMessenger);
 }
Exemplo n.º 11
0
        public QuadVideoViewModel(IMissionSource missionSource, IVehicleComponent vehicleComponent, IMissionComponent missionComponent)
        {
            VehicleComponent = vehicleComponent;
            MissionComponent = missionComponent;
            MissionSource    = missionSource;

            QuadModeCommand     = new RelayCommand <VehicleModeEnum>(ArduModeCommandExecute);
            ButtonCommands      = new RelayCommand <SoftkeyEnum>(ButtonCommandsAction);
            WriteMissionCommand = new RelayCommand(WriteMissionCommandExecute, WriteMissionCommandCanExecute);
            ReadMissionCommand  = new RelayCommand(ReadMissionCommandExecute, ReadMissionCommandCanExecute);


            _dispatcherUiTimer = new DispatcherTimer {
                Interval = new TimeSpan(0, 0, 0, 0, UpdataTimer)
            };
            _dispatcherUiTimer.Tick += DispatcherUiTimerTick;
            _dispatcherUiTimer.Start();
        }
Exemplo n.º 12
0
        public ClientQuadUIViewModel(IToolAction toolAction, IMissionComponent missionComponent, IVehicleComponent vehicleComponent, IMissionSource missionSource)
        {
            VehicleSelected  = toolAction.VehicleSelected;
            MissionComponent = missionComponent;
            VehicleComponent = vehicleComponent;
            MissionSource    = missionSource;

            StartMissionCommand     = new RelayCommand(StartMissionExecute);
            QuadModeCommand         = new RelayCommand <VehicleModeEnum>(ArduModeCommandExecute);
            MissionCommands         = new RelayCommand <SoftkeyEnum>(MissionCommandsExecute);
            JoystickRestartCommands = new RelayCommand(JoystickRestartCommandsExecute);

            Messenger.Default.Register <VehicleSelected>(this, VehicleSelectedAction);

            Messenger.Default.Register <MapMouseLeftButtonDownMessenger>(this, MapMouseLeftButtonDownAction);

            Logger.Info("ClientQuadUIViewModel init");
        }
Exemplo n.º 13
0
        public QuadPropertyViewModel(IToolAction toolAction, IMissionComponent missionComponent, IVehicleComponent vehicleComponent)
        {
            VehicleSelected       = toolAction.VehicleSelected;
            MissionComponent      = missionComponent;
            VehicleComponent      = vehicleComponent;
            QuadModeCommand       = new RelayCommand <VehicleModeEnum>(ArduModeCommandExecute);
            ChangeModeCommand     = new RelayCommand(ChangeModeCommandExecute);
            ButtonCommands        = new RelayCommand <SoftkeyEnum>(ButtonCommandsAction);
            FlyCommand            = new RelayCommand(FlyCommandExecute);
            ModeControlVisibility = Visibility.Collapsed;

            WriteMissionCommand = new RelayCommand(WriteMissionCommandExecute, WriteMissionCommandCanExecute);
            ReadMissionCommand  = new RelayCommand(ReadMissionCommandExecute, ReadMissionCommandCanExecute);
            LoadMissionCommand  = new RelayCommand(LoadMissionCommandExecute, LoadMissionCommandCanExecute);
            SaveMissionCommand  = new RelayCommand(SaveMissionCommandExecute, SaveMissionCommandCanExecute);

            Messenger.Default.Register <VehicleSelected>(this, VehicleSelectedAction);

            _dispatcherUiTimer = new DispatcherTimer {
                Interval = new TimeSpan(0, 0, 0, 0, UpdataTimer)
            };
            _dispatcherUiTimer.Tick += DispatcherUiTimerTick;
            _dispatcherUiTimer.Start();
        }
Exemplo n.º 14
0
 public ArduCopterModeViewModel(IVehicleComponent vehicleComponent)
 {
     VehicleComponent = vehicleComponent;
     QuadModeCommand  = new RelayCommand <VehicleModeEnum>(ArduModeCommandExecute);
     Visibility       = Visibility.Collapsed;
 }
Exemplo n.º 15
0
 public LeftCommandsControlViewModel(IVehicleComponent vehicleComponent)
 {
     ChangeModeCommand = new RelayCommand(ChangeModeCommandExecute);
     FlyCommand        = new RelayCommand(FlyCommandExecute);
     VehicleComponent  = vehicleComponent;
 }