Ejemplo n.º 1
0
 private void Finish()
 {
     if (FinishCommand != null && FinishCommand.CanExecute(null))
     {
         FinishCommand.Execute(null);
     }
 }
Ejemplo n.º 2
0
        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();
 }
Ejemplo n.º 5
0
        public void StepOut()
        {
            FinishCommand finishCommand = new FinishCommand();

            finishCommand.InBackground = true;
            ExecuteCommand(finishCommand);
        }
Ejemplo n.º 6
0
        public void TestNewFinishCommand()
        {
            FinishCommand command = MvcFactory.NewFinishCommand();

            Assert.IsNotNull(command);
            Assert.IsInstanceOf(typeof(FinishCommandImpl), command);
        }
Ejemplo n.º 7
0
        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));
        }
Ejemplo n.º 8
0
        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));
        }
Ejemplo n.º 9
0
 public void SubmitWithReturn([CanBeNull] object sender, EventArgs e)
 {
     if (FinishCommand != null)
     {
         if (FinishCommand.CanExecute(FinishCommandParameter))
         {
             FinishCommand.Execute(FinishCommandParameter);
         }
     }
 }
Ejemplo n.º 10
0
 public void SubmitPIN(object sender, TextChangedEventArgs e)
 {
     if (FinishCommand != null && !String.IsNullOrEmpty(e.NewTextValue))
     {
         if (FinishCommand.CanExecute(FinishCommandParameter))
         {
             FinishCommand.Execute(FinishCommandParameter);
         }
     }
 }
Ejemplo n.º 11
0
 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();
            }
        }
Ejemplo n.º 13
0
        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);
        }
Ejemplo n.º 14
0
        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));
        }
Ejemplo n.º 15
0
        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));
        }
Ejemplo n.º 16
0
        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();
        }
Ejemplo n.º 17
0
 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();
 }
Ejemplo n.º 18
0
        [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);
        }
Ejemplo n.º 19
0
 private void LoadNext()
 {
     if (workout_.Next())
     {
         SetupUI();
         Device.StartTimer(TimeSpan.FromSeconds(1), TimeTick);
         Vibration.Vibrate();
     }
     else
     {
         currentLabel_.Text = "FINISHED";
         FinishCommand.Execute(null);
     }
 }
Ejemplo n.º 20
0
        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();
        }
Ejemplo n.º 21
0
        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);
            }
        }
Ejemplo n.º 22
0
 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();
 }
Ejemplo n.º 24
0
 public override ModelAndView ProcessFinishCommand(FinishCommand command)
 {
     return(this.Factory.NewModelAndView(this.BoardAsModel(), "BoardView"));
 }
Ejemplo n.º 25
0
        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();
        }
Ejemplo n.º 26
0
 public abstract ModelAndView ProcessFinishCommand(FinishCommand command);
Ejemplo n.º 27
0
        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));
                }
            }
        }
Ejemplo n.º 28
0
 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();
 }