private void Finish() { if (FinishCommand != null && FinishCommand.CanExecute(null)) { FinishCommand.Execute(null); } }
private bool Handle(FinishCommand command) { var response = new StateResponse(State); Sender.Tell(response, Self); return(true); }
private void SetSteps(IEnumerable <CreateTileStep> steps) { var typeStep = new CreateTileStep() { Page = new SelectTypePage() { DataContext = this }, PageHeader = "Select tile type", Validate = (tile) => tile != null && tile.Type != 0 }; _createSteps.Clear(); _createSteps.Add(typeStep); _createSteps.AddRange(steps); LeftButtonCommand = CancelCommand; LeftButtonContent = "Cancel"; if (_createSteps.Count == 1) { RightButtonCommand = FinishCommand; RightButtonContent = "Finish"; } else { RightButtonCommand = NextPageCommand; RightButtonContent = "Next"; } NextPageCommand.OnCanExecuteChanged(); FinishCommand.OnCanExecuteChanged(); }
private void PreviousPage() { _currentStepIndex--; if (_currentStepIndex == _createSteps.Count - 1) { RightButtonCommand = FinishCommand; RightButtonContent = "Finish"; } else { RightButtonCommand = NextPageCommand; RightButtonContent = "Next"; } if (_currentStepIndex == 0) { LeftButtonCommand = CancelCommand; LeftButtonContent = "Cancel"; } else { LeftButtonCommand = PreviousPageCommand; LeftButtonContent = "Back"; } OnPropertyChanged("CurrentStep"); NextPageCommand.OnCanExecuteChanged(); FinishCommand.OnCanExecuteChanged(); }
public void StepOut() { FinishCommand finishCommand = new FinishCommand(); finishCommand.InBackground = true; ExecuteCommand(finishCommand); }
public void TestNewFinishCommand() { FinishCommand command = MvcFactory.NewFinishCommand(); Assert.IsNotNull(command); Assert.IsInstanceOf(typeof(FinishCommandImpl), command); }
public void TestRun() { Controller mockController = MockMvcFactory.NewMockController(MvcFactory); MockControllerImpl mockControllerImpl = (MockControllerImpl)mockController; FinishCommand command = MvcFactory.NewFinishCommand(); command.Process(mockController); Assert.IsTrue(mockControllerImpl.FinishCommandsProcessed.Contains(command)); }
public void TaskStateShouldBeNone() { var task = mokeData.GetUserTaskList(Guid.Empty).First(); var command = new FinishCommand(task); command.Execute(); Assert.That(task.State, Is.EqualTo(TaskState.None)); }
public void SubmitWithReturn([CanBeNull] object sender, EventArgs e) { if (FinishCommand != null) { if (FinishCommand.CanExecute(FinishCommandParameter)) { FinishCommand.Execute(FinishCommandParameter); } } }
public void SubmitPIN(object sender, TextChangedEventArgs e) { if (FinishCommand != null && !String.IsNullOrEmpty(e.NewTextValue)) { if (FinishCommand.CanExecute(FinishCommandParameter)) { FinishCommand.Execute(FinishCommandParameter); } } }
public void SubmitPIN(object sender, TextChangedEventArgs e) { if (FinishCommand != null) { if (FinishCommand.CanExecute(FinishCommandParameter)) { FinishCommand.Execute(FinishCommandParameter); } } }
private void EditingAccount_PropertyChanged(object sender, PropertyChangedEventArgs e) { bool oldCanFinish = _canFinish; _canFinish = CanFinish(_targetAccount, _editingAccount); if (_canFinish != oldCanFinish) { FinishCommand.NotifyCanExecuteChanged(); } }
public override ModelAndView ProcessFinishCommand(FinishCommand command) { FinishCommandsProcessed.Add(command); IDictionary <string, object> model = new Dictionary <string, object>(); model.Add("command", command); string viewName = "MockView"; ModelAndView modelAndView = this.Factory.NewModelAndView(model, viewName); return(modelAndView); }
public void TaskShouldBeStartedThenFinished() { var task = mokeData.GetUserTaskList(Guid.Empty).First(); var startCommand = new StartCommand(task); var finishCommand = new FinishCommand(task); startCommand.Execute(); Assert.That(task.State, Is.EqualTo(TaskState.Started)); finishCommand.Execute(); Assert.That(task.State, Is.EqualTo(TaskState.Done)); }
public void TestProcess() { Controller mockController = MockMvcFactory.NewMockController(this.MvcFactory); MockControllerImpl mockControllerImpl = (MockControllerImpl)mockController; StartCommand startCommand = MvcFactory.NewStartCommand(); FinishCommand finishCommand = MvcFactory.NewFinishCommand(); mockController.Process(startCommand); mockController.Process(finishCommand); Assert.IsTrue(mockControllerImpl.StartCommandsProcessed.Contains(startCommand)); Assert.IsTrue(mockControllerImpl.FinishCommandsProcessed.Contains(finishCommand)); }
public void Run() { Computer pc = new Computer(); var s = new StartCommand(pc); var f = new FinishCommand(pc); User u = new User(s, f); u.Start(); u.Finish(); }
private void UpdateValuesFromModel() { _teamOneScore = Model.TeamOneScore; RaisePropertyChanged(() => TeamOneScore); _teamTwoScore = Model.TeamTwoScore; RaisePropertyChanged(() => TeamTwoScore); RaisePropertyChanged(() => TeamOne); RaisePropertyChanged(() => TeamTwo); RaisePropertyChanged(() => Winner); RaisePropertyChanged(() => State); RaisePropertyChanged(() => ScoreIsEditable); FinishCommand.RaiseCanExecuteChanged(); }
[Test] public void TestProcessFinishCommand() { FinishCommand finishCommand = this.MvcFactory.NewFinishCommand(); ModelAndView modelAndView = this.ChessControllerImpl.ProcessFinishCommand(finishCommand); this.AssertValidModelAndView(modelAndView); IDictionary <string, object> model = modelAndView.Model; Assert.AreEqual("BoardView", modelAndView.ViewName); Assert.IsTrue(model.ContainsKey("Board")); object boardObject = model["Board"]; Assert.IsInstanceOf(typeof(Board), boardObject); }
private void LoadNext() { if (workout_.Next()) { SetupUI(); Device.StartTimer(TimeSpan.FromSeconds(1), TimeTick); Vibration.Vibrate(); } else { currentLabel_.Text = "FINISHED"; FinishCommand.Execute(null); } }
public void Call() { var invoker = new InvokeAction(); var process = new Process(); var commandBegin = new StartCommand(process); invoker.SetCommand(commandBegin); invoker.Invoke(); var commandEnd = new FinishCommand(process); invoker.SetCommand(commandEnd); invoker.Invoke(); }
private void ExecuteFinishWizard() { if (FinishCommand?.CanExecute(CanFinish) == true) { FinishCommand?.Execute(CanFinish); } var eventArgs = new RoutedEventArgs(Wizard.FinishEvent); this.RaiseEvent(eventArgs); //if (eventArgs.Cancel) // return; if (FinishButtonClosesWindow) { CloseParentWindow(true); } }
protected override void OnPropertyChanged(AvaloniaPropertyChangedEventArgs e) { base.OnPropertyChanged(e); if ( e.Property.Name == nameof(CanSelectNextPage) || (e.Property.Name == nameof(CanHelp)) || (e.Property.Name == nameof(CanFinish)) || (e.Property.Name == nameof(CanCancel)) || (e.Property.Name == nameof(CanSelectPreviousPage)) || (e.Property.Name == nameof(CurrentPage)) ) { CancelCommand?.CanExecute(CanCancel); FinishCommand?.CanExecute(CanFinish); PreviousPageCommand?.CanExecute(CanSelectPreviousPage); NextPageCommand?.CanExecute(CanSelectNextPage); HelpCommand?.CanExecute(CanHelp); UpdateButtonState(); } }
private void UpdateHasValidationErrors(bool value) { _hasValidationErrors = value; NextCommand.OnCanExecuteChanged(); FinishCommand.OnCanExecuteChanged(); }
public override ModelAndView ProcessFinishCommand(FinishCommand command) { return(this.Factory.NewModelAndView(this.BoardAsModel(), "BoardView")); }
private void Validate() { var updatedValidations = new List <string>(); if (!(ThresholdMin < ThresholdMax) && Type == EventType.Abort) { const string thresholdError = "Threshold minimum must be less than the threshold maximum."; errors[nameof(ThresholdMin)] = thresholdError; errors[nameof(ThresholdMax)] = thresholdError; updatedValidations.Add(nameof(ThresholdMin)); updatedValidations.Add(nameof(ThresholdMax)); } else { errors.Remove(nameof(ThresholdMin)); errors.Remove(nameof(ThresholdMax)); updatedValidations.Add(nameof(ThresholdMin)); updatedValidations.Add(nameof(ThresholdMax)); } const string timeError = "Start time must be before end time."; if (!(StartTime < EndTime)) { errors[nameof(EndTime)] = timeError; updatedValidations.Add(nameof(EndTime)); } else { errors.Remove(nameof(EndTime)); updatedValidations.Add(nameof(EndTime)); } if (StartTime < TimeSpan.Zero) { errors[nameof(StartTime)] = $"Start time cannot be before {TimeSpan.Zero}."; } else { errors.Remove(nameof(StartTime)); updatedValidations.Add(nameof(StartTime)); } if (ChannelOptions.All(channel => channel.Name != Channel)) { errors[nameof(Channel)] = "Channel name is not a channel name in this current configuration"; updatedValidations.Add(nameof(Channel)); } else if (ChannelOptions.First(channel => channel.Name == Channel) is InputChannel && Type == EventType.Output) { errors[nameof(Channel)] = "Cannot set an output on an input channel."; updatedValidations.Add(nameof(Channel)); } else if (!(ChannelOptions.First(channel => channel.Name == Channel) is InputChannel) && Type == EventType.Abort) { errors[nameof(Channel)] = "Cannot set an abort condition on an output channel."; updatedValidations.Add(nameof(Channel)); } else { errors.Remove(nameof(Channel)); updatedValidations.Add(nameof(Channel)); } updatedValidations.ForEach(prop => ErrorsChanged?.Invoke(this, new DataErrorsChangedEventArgs(prop))); RaisePropertyChanged(nameof(HasErrors)); FinishCommand.RaiseCanExecuteChanged(); }
public abstract ModelAndView ProcessFinishCommand(FinishCommand command);
public MLSSSong(int offset) { SetOffset(offset); VoiceTable = VoiceTable.LoadTable <MLSSVoiceTable>(0, true); // 0 won't be used in the Load method int amt = GetTrackAmount(ROM.Instance.Reader.ReadInt16(offset)); Commands = new List <SongEvent> [amt]; for (int i = 0; i < amt; i++) { Commands[i] = new List <SongEvent>(); int track = offset + ROM.Instance.Reader.ReadInt16(offset + 2 + (i * 2)); ROM.Instance.Reader.BaseStream.Position = track; byte cmd = 0; while (cmd != 0xFF && cmd != 0xF8) { int off = (int)ROM.Instance.Reader.BaseStream.Position; ICommand command = null; cmd = ROM.Instance.Reader.ReadByte(); switch (cmd) { case 0: command = new FreeNoteCommand { Note = ROM.Instance.Reader.ReadByte(), Duration = ROM.Instance.Reader.ReadByte() }; break; case 0xF0: command = new VoiceCommand { Voice = ROM.Instance.Reader.ReadByte() }; break; case 0xF1: command = new VolumeCommand { Volume = ROM.Instance.Reader.ReadByte() }; break; case 0xF2: command = new PanpotCommand { Panpot = (sbyte)(ROM.Instance.Reader.ReadByte() - 0x80) }; break; case 0xF4: command = new BendRangeCommand { Range = ROM.Instance.Reader.ReadByte() }; break; case 0xF5: command = new BendCommand { Bend = ROM.Instance.Reader.ReadSByte() }; break; case 0xF6: command = new RestCommand { Rest = ROM.Instance.Reader.ReadByte() }; break; case 0xF8: short offsetFromEnd = ROM.Instance.Reader.ReadInt16(); command = new GoToCommand { Offset = (int)(ROM.Instance.Reader.BaseStream.Position + offsetFromEnd) }; break; case 0xF9: command = new TempoCommand { Tempo = ROM.Instance.Reader.ReadByte() }; break; case 0xFF: command = new FinishCommand(); break; default: command = new MLSSNoteCommand { Duration = cmd, Note = ROM.Instance.Reader.ReadSByte() }; break; } Commands[i].Add(new SongEvent(off, command)); } } }
public void Dispose() { // dispose camera FinishCommand.Execute(); }
public void UpdateCanFinish(bool canFinish) { _canFinish = canFinish; FinishCommand.OnCanExecuteChanged(); WizardStatus.ShowFinishButton = canFinish; }
private void TilePropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { NextPageCommand?.OnCanExecuteChanged(); FinishCommand?.OnCanExecuteChanged(); }