public TestingVM() { //set fields Console = new ConsoleVM(); //Led Led_OnCommand = new RelayCommand(Led_On); Led_OffCommand = new RelayCommand(Led_Off); Led_FadeCommand = new RelayCommand(Led_Fade); Led_BlinkCommand = new RelayCommand(Led_Blink); Led_PulseCommand = new RelayCommand(Led_Pulse); Led_GetStatusCommand = new RelayCommandAsync(Led_GetStatus); //Button Button_GetStatusCommand = new RelayCommandAsync(Button_GetStatus); Button_ResetCountCommand = new RelayCommand(Button_ResetCount); //Knob Knob_GetStatusCommand = new RelayCommandAsync(Knob_GetStatus); Knob_SetRangeCommand = new RelayCommand(Knob_SetRange); //Sound Sound_StopCommand = new RelayCommand(Sound_Stop); Sound_PlayCommand = new RelayCommand(Sound_Play); Sound_PlayFreqCommand = new RelayCommand(Sound_PlayFreq); Sound_GetStatusCommand = new RelayCommandAsync(Sound_GetStatus); //Servo Servo_OnCommand = new RelayCommand(Servo_On); Servo_OffCommand = new RelayCommand(Servo_Off); Servo_MoveCommand = new RelayCommand(Servo_Move); Servo_MoveStopCommand = new RelayCommand(Servo_MoveStop); }
public RobotSettingsVM() { //set fields ResetCommand = new RelayCommandAsync(Reset); BackupCommand = new RelayCommandAsync(Backup); RestoreCommand = new RelayCommandAsync(Restore) { Enabled = false }; DeleteCommand = new RelayCommand(Delete) { Enabled = false }; }
public ConnectionVM(ArmListener armListener) { //set fields ArmListener = armListener; StopCommand = new RelayCommand(Stop); DisconnectCommand = new RelayCommand(Disconnect); RenameCommand = new RelayCommandAsync(Rename); ConnectCommand = new RelayCommand(Connect); RescanCommand = new RelayCommand(Rescan); ResetCommand = new RelayCommand(Reset); //connect to events ArmListener.CurrentArmChanged += CurrentArmChanged; ArmListener.ScanningChanges += ScanningChanges; ArmListener.PortScanned += PortScanned; (Ports as INotifyCollectionChanged).CollectionChanged += Port_CollectionChanged; RefreshStatus(); }
public FirmwareVM() { //set fields Log = new ObservableStringWriter(); _uploader = new Uploader(); _uploader.Out = Log; _uploader.Status += Uploader_Status; var connection = App.Instance.Connection; FlashCommand = new RelayCommandAsync(Flash); SelectFileImageCommand = new RelayCommandAsync(SelectFileImage); Ports = connection.Ports; var storage = App.Instance.Storage; FirmwareModels = (from f in storage.Firmware group f by f.Model into g orderby g.Key descending select new FirmwareModelVM() { Model = g.Key, Images = g.Select(i => new FirmwareImageVM(i) { Description = $"{i.Model} v{i.Version} released {i.ReleaseDate.ToShortDateString()}" }).OrderByDescending(i => i.Firmware.Version).ToArray() } ).ToArray(); //select the most recent SelectedFirmwareModel = FirmwareModels.First(); SelectedFirmwareImage = SelectedFirmwareModel.Images.First(); //connect to events _connectionEvents = new PropertyObserver <ConnectionVM>(connection) .RegisterHandler(i => i.CurrentArm, CurrentRobotChanged) .RegisterHandler(i => i.Ports, CurrentRobotChanged); CurrentRobotChanged(connection); }