/// <summary>
 /// Executes the POP3 RSET command.
 /// </summary>
 /// <exception cref="Pop3Exception">If the RSET command was unable to be executed successfully.</exception>
 public void SendReset()
 {
     using (ResetCommand command = new ResetCommand(_clientStream))
     {
         ExecuteCommand <Pop3Response, ResetCommand>(command);
     }
 }
 private void InitCommands()
 {
     OpenCommand              = new OpenCommand(this);
     ApplyCommand             = new ApplyCommand(this);
     FlipCommand              = new FlipCommand(this);
     HistogramEqualizeCommand = new HistogramEqualizeCommand(this);
     HistogramStretchCommand  = new HistogramStretchCommand(this);
     CropCommand              = new CropCommand(this);
     InpaintCommand           = new InpaintCommand(this);
     ResizeCommand            = new ResizeCommand(this);
     RotateCommand            = new RotateCommand(this);
     SaveAsCommand            = new SaveAsCommand(this);
     SaveCommand              = new SaveCommand(this);
     ZoomCommand              = new ZoomCommand(this);
     ResetCommand             = new ResetCommand(this);
     CloseCommand             = new CloseCommand(this);
     SelectToolCommand        = new SelectToolCommand(this);
     UndoCommand              = new UndoCommand(this);
     RedoCommand              = new RedoCommand(this);
     DropboxCommand           = new DropboxCommand(this);
     DownloadCommand          = new DownloadCommand(this);
     UploadCommand            = new UploadCommand(this);
     DCommand       = new DCommand(this);
     ECommand       = new ECommand(this);
     PrewittCommand = new PrewittCommand(this);
 }
Example #3
0
 private void StopwatchStateChanged()
 {
     StartCommand.RaiseCanExecuteChanged();
     StopCommand.RaiseCanExecuteChanged();
     ResetCommand.RaiseCanExecuteChanged();
     LapCommand.RaiseCanExecuteChanged();
 }
Example #4
0
        public async Task <IActionResult> UpdateStatus(int id, bool completed, int?categoryId)
        {
            if (completed)
            {
                var command = new CompleteCommand
                {
                    Id = id,
                };
                await _mediator.Send(command);

                TempData[NotificationMessageKey] = $"Task marked as completed";
            }
            else
            {
                var command = new ResetCommand
                {
                    Id = id,
                };
                await _mediator.Send(command);

                TempData[NotificationMessageKey] = $"Task reset";
            }

            return(RedirectToAction("Index", categoryId.HasValue ? new { CategoryId = categoryId.Value } : null));
        }
Example #5
0
        private async void SaveAction(object obj)
        {
            try
            {
                if (IsBusy)
                {
                    return;
                }
                IsBusy = true;
                var saved = await PerubahanService.AddItemAsync(Model);

                if (saved)
                {
                    Helpers.ShowMessage("Permohonan Perubahan Berhasil Dikirim");
                    ResetCommand.Execute(null);
                }
            }
            catch (Exception ex)
            {
                Helpers.ShowMessageError(ex.Message);
            }
            finally
            {
                IsBusy = false;
            }
        }
Example #6
0
        private async void SaveAction(object obj)
        {
            try
            {
                if (IsBusy)
                {
                    return;
                }
                IsBusy = true;
                var saved = await PemasanganService.AddItemAsync(Model);

                if (saved)
                {
                    Helpers.ShowMessage("Permohonan Pemasangan Berhasil Dikirim");
                    ResetCommand.Execute(null);
                    var app = await Helpers.GetMainPageAsync();

                    if (app != null)
                    {
                        app.SetCurrenttarget("Pemasangan");
                    }
                }
            }
            catch (Exception ex)
            {
                Helpers.ShowMessageError(ex.Message);
            }
            finally
            {
                IsBusy = false;
            }
        }
 public void RaiseCanExecuteActions()
 {
     SaveCommand.RaiseCanExecuteChanged();
     ResetCommand.RaiseCanExecuteChanged();
     CopyPreviousMonth.RaiseCanExecuteChanged();
     CurrentMonthCommand.RaiseCanExecuteChanged();
 }
Example #8
0
        private void InitaliseCommands()
        {
            StartGameCommand = ReactiveCommand.Create();
            StartGameCommand.Subscribe(arg => StartGameCommandHandler());

            ResetCommand = ReactiveCommand.Create();
            ResetCommand.Subscribe(arg => ResetCommandHandler());

            StopGameCommand = ReactiveCommand.Create();
            StopGameCommand.Subscribe(arg => StopGameWindowHandler());

            OpenNewGameWindow = ReactiveCommand.Create();
            OpenNewGameWindow.Subscribe(arg => OpenNewGameWindowHandler());

            FlipCommand = ReactiveCommand.Create();
            FlipCommand.Subscribe(arg => FlipCommandHandler());

            UndoCommand = ReactiveCommand.Create();
            UndoCommand.Subscribe(arg => UndoCommandHandler());

            AcceptScoreCommand = ReactiveCommand.Create();
            AcceptScoreCommand.Subscribe(arg => AcceptScoreCommandHandler());

            RejectScoreCommand = ReactiveCommand.Create();
            RejectScoreCommand.Subscribe(arg => RejectScoreCommandHandler());
        }
Example #9
0
 private void CreateMatrix()
 {
     _playfairInstance.SetPkayfairKey(PlayfairKey);
     CurrentMatrix.Key = PlayfairKey;
     RaisePropertyChanged <PlayfairMatrix>(nameof(CurrentMatrix));
     ResetCommand.RaiseCanExecuteChanged();
     CreateCommand.RaiseCanExecuteChanged();
 }
Example #10
0
        public void InitializesCorrectly(string instruction, ResetCommand expComm, int expSubj, int expObj)
        {
            var reset = new Reset(instruction);

            Assert.Equal(expComm, reset.Command);
            Assert.Equal(expSubj, reset.Subject);
            Assert.Equal(expObj, reset.Object);
        }
        protected AdvancedOptionSettingsViewModelBase(string name, string optionsCategory, SettingsController controller)
            : base(name, controller)
        {
            _advancedOptionsCategory = optionsCategory;

            ResetCommand.Subscribe(OnReset);
            ResetAllCommand.Subscribe(OnResetAll);
        }
 private void UpdateSettingModeEvent_EA_SUB(bool isSettings)
 {
     _isAllowShuffel          = !isSettings;
     _isAllowResetAndSolution = !isSettings && _isAllowResetAndSolution;
     ResetCommand.RaiseCanExecuteChanged();
     ShowSolutionCommand.RaiseCanExecuteChanged();
     ShuffleCommand.RaiseCanExecuteChanged();
 }
Example #13
0
            public void ReturnsReset()
            {
                // act
                var cmd = new ResetCommand();

                // assert
                Assert.Equal("reset", cmd.CommandName);
            }
 private void IsAllowResetAndSolutionEvent_EA_SUB(bool obj)
 {
     _isAllowResetAndSolution = true;
     _isAllowShuffel          = true;
     ResetCommand.RaiseCanExecuteChanged();
     ShowSolutionCommand.RaiseCanExecuteChanged();
     ShuffleCommand.RaiseCanExecuteChanged();
 }
        public IResetCommand CreateResetCommand(XmlElement settings)
        {
            ResetCommand cmd = new ResetCommand(_transport, this);

            cmd.Status += RaiseIntermediateStatusEvent;
            ReadSettings(cmd, settings);
            return(cmd);
        }
Example #16
0
 private void ResetMatrix()
 {
     PlayfairKey = "";
     _playfairInstance.SetPkayfairKey("ABCDE");
     CurrentMatrix.Key = "ABCDE";
     RaisePropertyChanged <PlayfairMatrix>(nameof(CurrentMatrix));
     ResetCommand.RaiseCanExecuteChanged();
     CreateCommand.RaiseCanExecuteChanged();
 }
Example #17
0
        public void CallsReset()
        {
            var viewModel = Mock.Of <IViewModel>();
            var command   = new ResetCommand(viewModel);

            command.Execute(null);

            Mock.Get(viewModel).Verify(x => x.Reset());
        }
        public void Handle(ProjectionManagementMessage.Command.Reset message)
        {
            var command = new ResetCommand {
                Name  = message.Name,
                RunAs = message.RunAs,
            };

            _writer.PublishCommand("$reset", command);
        }
Example #19
0
        public DcsOptionCategoryViewModel(string name, string categoryId, SettingsController controller)
            : base(name, controller)
        {
            _categoryId = categoryId;

            SelectedInstall.Subscribe(OnSelectedInstallChanged);
            ResetCommand.Subscribe(OnReset);
            ResetAllCommand.Subscribe(OnResetAll);
        }
 private void ShowSolution()
 {
     _isAllowShuffel          = false;
     _isAllowResetAndSolution = false;
     ShuffleCommand.RaiseCanExecuteChanged();
     ResetCommand.RaiseCanExecuteChanged();
     ShowSolutionCommand.RaiseCanExecuteChanged();
     _eventAggregator.GetEvent <ShowSolutionClickEvent>().Publish(true);
 }
Example #21
0
        public void ShouldResetMachine()
        {
            var machine      = new Machine(new Job());
            var resetCommand = new ResetCommand(machine);

            machineController.SetCommand(resetCommand);
            machineController.Command.Execute();
            Assert.AreEqual(machine.JobStatus, JobStatus.Ready);
        }
Example #22
0
        public BeamgunViewModel()
        {
            var dictionary      = new RegistryBackedDictionary();
            var beamgunSettings = new BeamgunSettings(dictionary);

            BeamgunState = new BeamgunState(beamgunSettings)
            {
                MainWindowVisibility = Visibility.Hidden
            };
            // TODO: This bi-directional relationship feels bad.
            dictionary.BadCastReport += BeamgunState.AppendToAlert;
            BeamgunState.Disabler     = new Disabler(BeamgunState);
            BeamgunState.Disabler.Enable();
            DisableCommand     = new DisableCommand(this, beamgunSettings);
            TrayIconCommand    = new TrayIconCommand(this);
            LoseFocusCommand   = new DeactivatedCommand(this);
            ResetCommand       = new ResetCommand(this);
            ExitCommand        = new ExitCommand(this);
            ClearAlertsCommand = new ClearAlertsCommand(this);
            _keystrokeHooker   = InstallKeystrokeHooker();
            _usbStorageGuard   = InstallUsbStorageGuard(beamgunSettings);
            _alarm             = InstallAlarm(beamgunSettings);
            _networkWatcher    = new NetworkWatcher(beamgunSettings,
                                                    new NetworkAdapterDisabler(),
                                                    x => BeamgunState.AppendToAlert(x),
                                                    x =>
            {
                _alarm.Trigger(x);
                BeamgunState.SetGraphicsLanAlert();
            },
                                                    () => BeamgunState.Disabler.IsDisabled);
            _keyboardWatcher = new KeyboardWatcher(beamgunSettings,
                                                   new WorkstationLocker(),
                                                   x => BeamgunState.AppendToAlert(x),
                                                   x =>
            {
                _alarm.Trigger(x);
                BeamgunState.SetGraphicsKeyboardAlert();
            },
                                                   () => BeamgunState.Disabler.IsDisabled);
            _mouseWatcher = new MouseWatcher(beamgunSettings,
                                             new WorkstationLocker(),
                                             x => BeamgunState.AppendToAlert(x),
                                             x =>
            {
                _alarm.Trigger(x);
                BeamgunState.SetGraphicsMouseAlert();
            },
                                             () => BeamgunState.Disabler.IsDisabled);
            var checker = new VersionChecker();

            _updateTimer = new VersionCheckerTimer(beamgunSettings,
                                                   checker,
                                                   x => BeamgunState.AppendToAlert(x));
        }
Example #23
0
        private static void RunCommands(object obj)
        {
            // todo: copied code

            switch (obj)
            {
            case ContextMenuCommand c1:
            {
                var c = (IIntegrated)c1;
                RunIntegrated(c, ContextMenuCommand.Add, ContextMenuCommand.Remove);

                break;
            }

            case PathCommand c1:
            {
                var c = (IIntegrated)c1;
                RunIntegrated(c, PathCommand.Add, PathCommand.Remove);

                break;
            }

            case CreateSauceNaoCommand c:
            {
                var acc = SauceNao.CreateAccount(c.Auto);

                CliOutput.WriteInfo("Account information:");

                var accStr = acc.ToString();
                var output = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
                             + "\\saucenao_account.txt";

                File.WriteAllText(output, accStr);

                Console.WriteLine(accStr);

                CliOutput.WriteInfo("Adding key to cfg file");
                RuntimeInfo.Config.SauceNaoAuth = acc.ApiKey;
                RuntimeInfo.Config.WriteToFile();
                break;
            }

            case ResetCommand c:
            {
                ResetCommand.RunReset(c.All);
                break;
            }

            case InfoCommand c:
            {
                InfoCommand.Show();
                break;
            }
            }
        }
Example #24
0
        public void AccountPasswordReset_Execute_ReturnsSuccessMessage()
        {
            var command = new ResetCommand(_console, LoggerMock.GetLogger <ResetCommand>().Object, _accountService.Object, _consoleReader.Object)
            {
                User = "******"
            };

            var resultMessage = command.Execute();

            Assert.Equal("Password for user [email protected] has been reset", resultMessage);
        }
Example #25
0
        public void ResetCommandArgumentParsing_Failure()
        {
            bool initialize;

            Assert.False(ResetCommand.TryParseArguments("a", out initialize));
            Assert.False(ResetCommand.TryParseArguments("noconfi", out initialize));
            Assert.False(ResetCommand.TryParseArguments("noconfig1", out initialize));
            Assert.False(ResetCommand.TryParseArguments("noconfig 1", out initialize));
            Assert.False(ResetCommand.TryParseArguments("1 noconfig", out initialize));
            Assert.False(ResetCommand.TryParseArguments("noconfig\r\na", out initialize));
            Assert.False(ResetCommand.TryParseArguments("nOcOnfIg", out initialize));
        }
Example #26
0
        public async Task NullStateReset()
        {
            var channel = new MockSmtpChannel();
            var builder = new MockMailBuilder();
            var command = new ResetCommand(channel, builder);

            command.Initialize("");
            await command.ExecuteAsync(CancellationToken.None);

            SmtpTestHelper.AssertResponse(channel, SmtpReplyCode.Okay);
            Assert.Null(builder.PendingMail);
        }
Example #27
0
            public void CallsReplReset()
            {
                // arrange
                var repl = new Mock <IRepl>();

                var cmd = new ResetCommand();

                // act
                cmd.Execute(repl.Object, null);

                // assert
                repl.Verify(x => x.Reset(), Times.Once);
            }
Example #28
0
 private void SetSelectedItem(CustomerWrapper customerWrapper)
 {
     SelectedItem = customerWrapper;
     SelectedItem.PropertyChanged += (s, e) =>
     {
         if (e.PropertyName == nameof(SelectedItem.IsChanged))
         {
             SaveCommand.RaiseCanExecuteChanged();
             ResetCommand.RaiseCanExecuteChanged();
             _eventAggregator.GetEvent <ModelIsChangedEvent>().Publish(SelectedItem.IsChanged);//Notify the mainwindow that there are changes, to prompt user not to close window.
         }
     };
 }
Example #29
0
            public void CallsReplReset()
            {
                // arrange
                var executor = new Mock <IScriptExecutor>();

                var cmd = new ResetCommand();

                // act
                cmd.Execute(executor.Object, null);

                // assert
                executor.Verify(x => x.Reset(), Times.Once);
            }
Example #30
0
        public async Task ResetAfterMailCommand()
        {
            var channel = new MockSmtpChannel();
            var builder = new MockMailBuilder {
                PendingMail = new SmtpMailMessage(new SmtpPath("*****@*****.**"))
            };
            var command = new ResetCommand(channel, builder);

            command.Initialize("");
            await command.ExecuteAsync(CancellationToken.None);

            SmtpTestHelper.AssertResponse(channel, SmtpReplyCode.Okay);
            Assert.Null(builder.PendingMail);
        }
 private void ProcessCommand(ResetCommand command)
 {
     dynamic job = _allJobs.Single(at => at.Id == command.TaskId);
     if (command.IsStopSet)
     {
         StopJob(job);
     }
     job.Reset();
 }
        private static ResetCommand ParseResetCommandOptions(string[] args)
        {
            var command = new ResetCommand();
            for (var i = 1; i < args.Length; i++)
            {
                if (args[i] == "--stop")
                {
                    command.IsStopSet = true;
                    continue;
                }

                int id;
                if (int.TryParse(args[i], out id))
                {
                    command.TaskId = id;
                }
                else
                {
                    throw new CommandParseException("Cannot parse reset command");
                }
            }

            return command;
        }
Example #33
0
 public IResetCommand CreateResetCommand(XmlElement settings)
 {
     ResetCommand cmd = new ResetCommand(_transport, this);
     cmd.Status += RaiseIntermediateStatusEvent;
     ReadSettings(cmd, settings);
     return cmd;
 }