/// <summary> /// Update the current Roomba Mode and Model /// </summary> /// <param name="model"></param> /// <param name="firmwareDate"></param> /// <returns></returns> public PortSet <DefaultUpdateResponseType, Fault> UpdateMode(IRobotModel model, DateTime firmwareDate) { UpdateMode update = new UpdateMode(RoombaMode.NotSpecified, model, firmwareDate); this.PostUnknownType(update); return(update.ResponsePort); }
public MainViewModel(IRobotModel model, INavigationService navigationService) { _model = model; _navigationService = navigationService; _model.RaiseBatteryVoltageChanged += (sender, dc) => { BatteryVoltage = dc; }; _model.RaiseException += (sender, exception) => { ErrorMessage = exception.Message; }; ShowSettings = new RelayCommand(async() => await _navigationService.ShowSettings()); GoForward = new RelayCommand(async() => { CanSendCommands = false; await _model.GoForward(); CanSendCommands = true; }, () => CanSendCommands); GoBackward = new RelayCommand(async() => { CanSendCommands = false; await _model.GoBackward(); CanSendCommands = true; }, () => CanSendCommands); GoForwardLeft = new RelayCommand(async() => { CanSendCommands = false; await _model.GoForwardLeft(); CanSendCommands = true; }, () => CanSendCommands); GoForwardRight = new RelayCommand(async() => { CanSendCommands = false; await _model.GoForwardRight(); CanSendCommands = true; }, () => CanSendCommands); Stop = new RelayCommand(async() => { CanSendCommands = false; await _model.Stop(); CanSendCommands = true; }, () => CanSendCommands); RotateLeft = new RelayCommand(async() => { CanSendCommands = false; await _model.RotateLeft(); CanSendCommands = true; }, () => CanSendCommands); RotateRight = new RelayCommand(async() => { CanSendCommands = false; await _model.RotateRight(); CanSendCommands = true; }, () => CanSendCommands); }
public SettingsViewModel(ISettings settings, INavigationService navigationService, IRobotModel robotModel) { _settings = settings; _navigationService = navigationService; _robotModel = robotModel; SaveSettingsAndClose = new RelayCommand(async() => { _canSave = false; SaveSettingsAndClose.RaiseCanExecuteChanged(); await settings.SaveAsync(); await _navigationService.GoBackToMainScreen(); _canSave = true; SaveSettingsAndClose.RaiseCanExecuteChanged(); }, () => _canSave, true); }