public override void Execute(object parameter) { var newAccount = new TimeServerAccount(); newAccount.AccountId = Guid.NewGuid().ToString(); var interaction = new TimeServerAccountInteraction(newAccount, Translation.AddTimeServerAccount); _interactionRequest.Raise(interaction, AddTimeServerAccountCallback); }
private void UpdateTimeServerAccountsCallback(TimeServerAccountInteraction interaction) { if (interaction.Success) { interaction.TimeServerAccount.CopyTo(_currentAccount); IsDone?.Invoke(this, new MacroCommandIsDoneEventArgs(ResponseStatus.Success)); } else { IsDone?.Invoke(this, new MacroCommandIsDoneEventArgs(ResponseStatus.Cancel)); } }
private void AddTimeServerAccountCallback(TimeServerAccountInteraction interaction) { if (!interaction.Success) { IsDone?.Invoke(this, new MacroCommandIsDoneEventArgs(ResponseStatus.Cancel)); return; } var timeServerAccounts = _currentSettingsProvider?.Settings?.ApplicationSettings?.Accounts?.TimeServerAccounts; timeServerAccounts?.Add(interaction.TimeServerAccount); IsDone?.Invoke(this, new MacroCommandIsDoneEventArgs(ResponseStatus.Success)); }
public override void Execute(object parameter) { _currentAccount = parameter as TimeServerAccount; if (_currentAccount == null) { return; } if (!TimeServerAccounts.Contains(_currentAccount)) { return; } var interaction = new TimeServerAccountInteraction(_currentAccount.Copy(), Translation.EditTimeServerAccount); _interactionRequest.Raise(interaction, UpdateTimeServerAccountsCallback); }
public void SetUp() { var translationUpdater = new TranslationUpdater(new TranslationFactory(null), new ThreadManager()); _timeServerAccount = new TimeServerAccount { AccountId = new Guid().ToString(), Url = "www.randometimeserver.org", UserName = "******", Password = "******", IsSecured = true }; _timeServerAccountInteraction = new TimeServerAccountInteraction(_timeServerAccount, "TimeServerAccountTestTitle"); _viewModel = new TimeServerAccountViewModel(translationUpdater); }
private void AddTimeServerAccountCallback(TimeServerAccountInteraction interaction) { if (!interaction.Success) { IsDone?.Invoke(this, new MacroCommandIsDoneEventArgs(ResponseStatus.Cancel)); return; } var timeServerAccounts = _accountsProvider?.Settings.TimeServerAccounts; timeServerAccounts?.Add(interaction.TimeServerAccount); var collectionView = CollectionViewSource.GetDefaultView(timeServerAccounts); collectionView.MoveCurrentTo(interaction.TimeServerAccount); IsDone?.Invoke(this, new MacroCommandIsDoneEventArgs(ResponseStatus.Success)); }