Exemple #1
0
        public override void Execute(object parameter)
        {
            var newAccount = new HttpAccount();

            newAccount.AccountId = Guid.NewGuid().ToString();

            var interaction = new HttpAccountInteraction(newAccount, Translation.AddHttpAccount);

            _interactionRequest.Raise(interaction, AddHttpAccountCallback);
        }
        private void UpdateHttpAccountsCallback(HttpAccountInteraction interaction)
        {
            if (!interaction.Success)
            {
                IsDone?.Invoke(this, new MacroCommandIsDoneEventArgs(ResponseStatus.Cancel));
                return;
            }

            interaction.HttpAccount.CopyTo(_currentAccount);
            IsDone?.Invoke(this, new MacroCommandIsDoneEventArgs(ResponseStatus.Success));
        }
Exemple #3
0
        private void AddHttpAccountCallback(HttpAccountInteraction interaction)
        {
            if (!interaction.Success)
            {
                IsDone?.Invoke(this, new MacroCommandIsDoneEventArgs(ResponseStatus.Cancel));
                return;
            }

            var httpAccounts = _accountsProvider.Settings.HttpAccounts;

            httpAccounts.Add(interaction.HttpAccount);

            var collectionView = CollectionViewSource.GetDefaultView(httpAccounts);

            collectionView.MoveCurrentTo(interaction.HttpAccount);

            IsDone?.Invoke(this, new MacroCommandIsDoneEventArgs(ResponseStatus.Success));
        }
Exemple #4
0
        public void SetUp()
        {
            var translationUpdater = new TranslationUpdater(new TranslationFactory(null), new ThreadManager());

            _httpAccount = new HttpAccount
            {
                AccountId             = new Guid().ToString(),
                Url                   = "www.pdfforge.org",
                UserName              = "******",
                Password              = "******",
                IsBasicAuthentication = true
            };

            _httpAccountInteraction = new HttpAccountInteraction(_httpAccount, "HttpAccountTestTitle");

            _viewModel = new HttpAccountViewModel(translationUpdater);
            _viewModel.SetPasswordAction = s => { };
        }
        public override void Execute(object parameter)
        {
            _currentAccount = parameter as HttpAccount;
            if (_currentAccount == null)
            {
                return;
            }

            var httpAccounts = _currentSettingsProvider.Settings.ApplicationSettings.Accounts.HttpAccounts;

            if (!httpAccounts.Contains(_currentAccount))
            {
                return;
            }

            var interaction = new HttpAccountInteraction(_currentAccount.Copy(), Translation.EditHttpAccount);

            _interactionRequest.Raise(interaction, UpdateHttpAccountsCallback);
        }