Esempio n. 1
0
        public void LoadAsync()
        {
            var providers = ProvidersFactory.CreateProviders(ProfileManager.DataProviders);
            var accounts  = AccountsFactory.GetAccounts(providers, IsInProfile);

            LoadAccounts(accounts);
        }
Esempio n. 2
0
        private void HandleNewAccount()
        {
            var credentials = BuildCredentialDetails();

            if (!credentials.Any(nameValue => string.IsNullOrEmpty(nameValue.Value)))
            {
                IsBusy = true;
                NewAccounts.Clear();

                var observableProvider = ProvidersFactory.CreateProvider(new ProviderDescriptor(SelectedCompany.Name, credentials, null));
                var accounts           = AccountsFactory.GetAccounts(observableProvider, (a) => true);
                accounts.ObserveOn(new DispatcherSynchronizationContext()).Subscribe((account) =>
                {
                    var newAccount = new AccountViewModel(account);
                    _accountMap.Add(account, newAccount);
                    NewAccounts.Add(newAccount);
                },
                                                                                     (error) =>
                {
                    Error  = error.Message;
                    IsBusy = false;
                },
                                                                                     () =>
                {
                    IsBusy = false;
                });
            }
        }