public ApplicationService(IAccountsService accounts) { Accounts = accounts; _timer = new Timer(1000 * 60 * 45); // 45 minutes _timer.AutoReset = true; _timer.Elapsed += (sender, e) => { if (Account == null) return; try { var ret = Client.RefreshToken(LoginViewModel.ClientId, LoginViewModel.ClientSecret, Account.RefreshToken); if (ret == null) return; Account.RefreshToken = ret.RefreshToken; Account.Token = ret.AccessToken; accounts.Update(Account); UsersModel userInfo; Client = Client.BearerLogin(Account.Token, out userInfo); } catch { // Do nothing.... } }; }
/// <summary> /// /// </summary> public TestConnectionManager( IAccountsService accountsService, IProjectsService projectsService, ITemplatesService templateService, ICacheManager cacheManager) : base(accountsService, projectsService, templateService, cacheManager) { }
public TradingViewModel(ViewModelContext viewModelContext, AccountViewModel accountViewModel, SymbolsViewModel symbolsViewModel, TradeViewModel tradeViewModel, OrdersViewModel ordersViewModel, IWpfExchangeService exchangeService, IAccountsService accountsService, IChartHelper chartHelper) : base(viewModelContext) { AccountViewModel = accountViewModel; SymbolsViewModel = symbolsViewModel; TradeViewModel = tradeViewModel; OrdersViewModel = ordersViewModel; Symbols = new ObservableCollection <SymbolViewModel>(); symbolObservableSubscriptions = new Dictionary <string, IDisposable>(); this.exchangeService = exchangeService; this.accountsService = accountsService; this.chartHelper = chartHelper; ObserveSymbols(); ObserveAccount(); ObserveTrade(); ObserveOrders(); CloseCommand = new ViewModelCommand(Close); }
public ApplicationService(IAccountsService accounts) { Accounts = accounts; _timer = new Timer(1000 * 60 * 45); // 45 minutes _timer.AutoReset = true; _timer.Elapsed += (sender, e) => { if (Account == null) { return; } try { var ret = Client.RefreshToken(LoginViewModel.ClientId, LoginViewModel.ClientSecret, Account.RefreshToken); if (ret == null) { return; } Account.RefreshToken = ret.RefreshToken; Account.Token = ret.AccessToken; accounts.Update(Account); UsersModel userInfo; Client = Client.BearerLogin(Account.Token, out userInfo); } catch { // Do nothing.... } }; }
public TransactionService(IAccountsService accountsService, ITransactionsRepository transactionsRepository, IMapper mapper) { _accountsService = accountsService; _transactionsRepository = transactionsRepository; _mapper = mapper; _transactionSemaphore = new SemaphoreSlim(1, 1); }
public static async Task <string> GenerateAccessToken( IAccountsService accountsService, string userName, string ipAddress = default, DateTime?creationDate = default, string issuer = default, string audience = default, string signingKey = default, double?durationInMinutes = default) { try { return((await accountsService.GenerateAccessTokenAsync( userName: userName, ipAddress: ipAddress ?? "127.0.0.1", creationDate: creationDate ?? DateTime.UtcNow, issuer: issuer, audience: audience, signingKey: signingKey, durationInMinutes: durationInMinutes)).AccessToken); } catch (Exception ex) { throw new Exception($"Exception thrown on the test helper method 'GenerateAccessToken' with the message: {ex.Message}"); } }
public AccountController( IAccountsService accountService, SignInManager <ApplicationUser> signInManager) { _accountService = accountService; _signInManager = signInManager; }
public TransactionsController( ITransactionService transaction, IAccountsService account) { _transaction = transaction; _account = account; }
public AccountsTransactionMonitoringService(IAccountsService accountsService, IWeb3ProviderService web3ProviderService) { _accountsService = accountsService; _web3ProviderService = web3ProviderService; _timer = Observable.Timer(TimeSpan.FromMilliseconds(500), _updateInterval, RxApp.MainThreadScheduler) .Select(_ => ProcessCompletedTransactions().ToObservable()).Concat().Subscribe(); }
private async Task attachUserToContext(HttpContext context, IAccountsService accountService, string token) { try { var tokenHandler = new JwtSecurityTokenHandler(); var key = Encoding.ASCII.GetBytes(_appSettings.Secret); tokenHandler.ValidateToken(token, new TokenValidationParameters { ValidateIssuerSigningKey = true, IssuerSigningKey = new SymmetricSecurityKey(key), ValidateIssuer = false, ValidateAudience = false, // set clockskew to zero so tokens expire exactly at token expiration time (instead of 5 minutes later) ClockSkew = TimeSpan.Zero }, out SecurityToken validatedToken); var jwtToken = (JwtSecurityToken)validatedToken; var email = jwtToken.Claims.First(x => x.Type == "email").Value; // attach user to context on successful jwt validation context.Items["Account"] = await accountService.GetAccount(email); } catch { // do nothing if jwt validation fails // user is not attached to context so request won't have access to secure routes } }
public AccountsTests(TinyBankFixture fixture) { _account = fixture.Scope.ServiceProvider .GetRequiredService <IAccountsService>(); _customer = fixture.Scope.ServiceProvider .GetRequiredService <ICustomerService>(); }
public AccountController(IAccountsService accountsService, UserManager <User> userManager, SignInManager <User> signInManager) { this.accountsService = accountsService; _userManager = userManager; }
public AccountsController( SignInManager <ApplicationUser> signInManager, IAccountsService accountsService) { _signInManager = signInManager; _accountsService = accountsService; }
public ProjectsViewModel(IApplicationService applicationService, IAccountsService accountsService) { Account = accountsService.ActiveAccount; GoToProjectCommand = new ReactiveCommand(); Projects = new ReactiveCollection <Project>(new [] { CreatePersonalProject(accountsService.ActiveAccount) }); LoadCommand.RegisterAsyncTask(async x => { var getAllProjects = applicationService.StashClient.Projects.GetAll(); using (Projects.SuppressChangeNotifications()) { Projects.Clear(); Projects.Add(CreatePersonalProject(accountsService.ActiveAccount)); Projects.AddRange(await getAllProjects.ExecuteAsyncAll()); } }); GoToProjectCommand.OfType <Project>().Subscribe(x => { var vm = this.CreateViewModel <RepositoriesViewModel>(); vm.ProjectKey = x.Key; vm.Name = x.Name; ShowViewModel(vm); }); }
public AccountsController(IAccountsService userService, IStudentsService studentsService, IParentsService parentsService, ITeachersService teachersService) { service = userService; this.studentsService = studentsService; this.parentsService = parentsService; this.teachersService = teachersService; }
public KraScoresController(IKraInputScoresService InputScoreService, IKraScoreCalculator ScoreCalculator, IExcelReportGenerator ReportGenerator, IAccountsService Account) { this.InputScoreService = InputScoreService; this.ScoreCalculator = ScoreCalculator; this.ReportGenerator = ReportGenerator; this.Account = Account; }
public ApplicationService(IAccountsService accountsService) { _accountsService = accountsService; System.Net.ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true; accountsService.WhenAnyObservable(x => x.ActiveAccountChanged).StartWith(accountsService.ActiveAccount).Subscribe(account => { if (account == null) { Client = null; GitHubClient = null; } else { var githubAccount = (GitHubAccount)account; var domain = githubAccount.Domain ?? Client.DefaultApi; if (!string.IsNullOrEmpty(githubAccount.OAuth)) { Client = Client.BasicOAuth(githubAccount.OAuth, domain); GitHubClient = new GitHubClient(new ProductHeaderValue("CodeHub"), new InMemoryCredentialStore(new Credentials(githubAccount.OAuth)), new Uri(domain)); } else if (githubAccount.IsEnterprise || !string.IsNullOrEmpty(githubAccount.Password)) { Client = Client.Basic(githubAccount.Username, githubAccount.Password, domain); GitHubClient = new GitHubClient(new ProductHeaderValue("CodeHub"), new InMemoryCredentialStore(new Credentials(githubAccount.Username, githubAccount.Password)), new Uri(domain)); } } }); }
public AccountController( IAccountsService accountsService, IMapper mapper) { _accountsService = accountsService; _mapper = mapper; }
public AccountSettingManager(IAccountsService accountsService, IProjectsService projectsService, ITemplatesService templateService, ICacheManager cacheManager) : base(accountsService, projectsService, templateService, cacheManager) { _accountsRepository = new AccountsRepository(); }
public StartupViewModel( IApplicationService applicationService = null, IAccountsService accountsService = null) { _applicationService = applicationService ?? GetService <IApplicationService>(); _accountsService = accountsService ?? GetService <IAccountsService>(); }
public AccountsController(IAccountsService accountsService, UserManager <User> userManager, SignInManager <User> signInManager, IMapper mapper) { this.accountsService = accountsService; this.userManager = userManager; this.signInManager = signInManager; this.mapper = mapper; }
public GetCustomerDetailQueryHandler(IApplicationDbContext context, IMapper mapper, IAccountsService accountsService, IHttpContextAccessor httpContextAccessor) { _context = context; _mapper = mapper; _accountsService = accountsService; _httpContextAccessor = httpContextAccessor; }
public AccountsViewModel(IAccountsService accountsService) { _accountsService = accountsService; Accounts = new ReactiveList<IAccount>(accountsService); LoginCommand = ReactiveCommand.Create(); GoToAddAccountCommand = ReactiveCommand.Create(); DeleteAccountCommand = ReactiveCommand.Create(); DeleteAccountCommand.OfType<IAccount>().Subscribe(x => { if (Equals(accountsService.ActiveAccount, x)) ActiveAccount = null; accountsService.Remove(x); Accounts.Remove(x); }); LoginCommand.OfType<IAccount>().Subscribe(x => { if (Equals(accountsService.ActiveAccount, x)) DismissCommand.ExecuteIfCan(); else { ActiveAccount = x; MessageBus.Current.SendMessage(new LogoutMessage()); DismissCommand.ExecuteIfCan(); } }); GoToAddAccountCommand.Subscribe(_ => ShowViewModel(CreateViewModel<IAddAccountViewModel>())); this.WhenActivated(d => Accounts.Reset(accountsService)); }
public MeterReadingValidationService( IMetersRepository metersRepository, IAccountsService accountsService) { _MetersRepository = metersRepository; _AccountsService = accountsService; }
public AccountsTransactionMonitoringService(IAccountsService accountsService, IWeb3ProviderService web3ProviderService) { _accountsService = accountsService; _web3ProviderService = web3ProviderService; _timer = Observable.Timer(TimeSpan.FromMilliseconds(500), _updateInterval, RxApp.MainThreadScheduler) .Subscribe(async _ => await ProcessCompletedTransactions().ConfigureAwait(false)); }
public LoginViewModel(IAccountsService accountsService) { LoginCommand = new ReactiveCommand(this.WhenAny(x => x.Username, x => x.Password, x => x.Domain, (u, p, d) => !string.IsNullOrEmpty(u.Value) && !string.IsNullOrEmpty(p.Value) && !string.IsNullOrEmpty(d.Value))); LoginCommand.RegisterAsyncTask(async x => { var domain = Domain.TrimEnd('/'); var client = AtlassianStashSharp.StashClient.CrateBasic(new Uri(domain), Username, Password); var info = await client.Users[Username].Get().ExecuteAsync(); var account = new Account { Username = Username, Password = Password, Domain = domain }; if (string.IsNullOrEmpty(account.AvatarUrl)) { var selfLink = info.Data.Links["self"].FirstOrDefault(); if (selfLink != null && !string.IsNullOrEmpty(selfLink.Href)) { account.AvatarUrl = selfLink.Href + "/avatar.png"; } } accountsService.Insert(account); accountsService.ActiveAccount = account; LoggedInAcconut = account; MessageBus.Current.SendMessage(new LogoutMessage()); //DismissCommand.ExecuteIfCan(); }); }
public AccountsController(IAccountsService accountsService, SignInManager <User> signInManager, UserManager <User> userManager) { _accountsService = accountsService; _signInManager = signInManager; _userManager = userManager; }
/// <summary> /// /// </summary> /// <param name="itemsRepository"></param> /// <param name="mappingRepository"></param> /// <param name="itemsService"></param> /// <param name="mappingManager"></param> /// <param name="importManager"></param> /// <param name="accountsService"></param> /// <param name="projectsService"></param> /// <param name="templateService"></param> /// <param name="cacheManager"></param> /// <param name="gcAccountSettings"></param> public UpdateManager( IItemsRepository itemsRepository, IMappingRepository mappingRepository, IItemsService itemsService, IMappingManager mappingManager, IImportManager importManager, IAccountsService accountsService, IProjectsService projectsService, ITemplatesService templateService, ICacheManager cacheManager, GCAccountSettings gcAccountSettings) : base(accountsService, projectsService, templateService, cacheManager) { ItemsRepository = itemsRepository; MappingRepository = mappingRepository; ItemsService = itemsService; MappingManager = mappingManager; ImportManager = importManager; GcAccountSettings = gcAccountSettings; }
public TradingViewModel(ViewModelContext viewModelContext, AccountViewModel accountViewModel, SymbolsViewModel symbolsViewModel, TradePanelViewModel tradePanelViewModel, IWpfExchangeService exchangeService, IAccountsService accountsService, IOrderBookHelperFactory orderBookHelperFactory, ITradeHelperFactory tradeHelperFactory, IChartHelper chartHelper) : base(viewModelContext) { AccountViewModel = accountViewModel; SymbolsViewModel = symbolsViewModel; TradeViewModel = tradePanelViewModel; this.exchangeService = exchangeService; this.accountsService = accountsService; this.orderBookHelperFactory = orderBookHelperFactory; this.tradeHelperFactory = tradeHelperFactory; this.chartHelper = chartHelper; ObserveSymbols(); ObserveAccount(); ObserveTrade(); }
public AccountController(UserManager <ApplicationUser> userManager, SignInManager <ApplicationUser> signinManager, IAccountsService accountsService) { _userManager = userManager ?? throw new ArgumentNullException(nameof(userManager)); _signinManager = signinManager ?? throw new ArgumentNullException(nameof(signinManager)); _accountsService = accountsService ?? throw new ArgumentNullException(nameof(accountsService)); }
public CouplesController() { _accountService = new AccountsService(); _coupleService = new CouplesService(); _personService = new PersonsService(); _presentListService = new PresentListService(); }
public LoginService( IAccountsService accountsService, IApplicationService applicationService) { _accountsService = accountsService; _applicationService = applicationService; }
public ErrorService(IHttpClientService httpClient, IJsonSerializationService jsonSerialization, IEnvironmentService environmentService, IAccountsService accountsService) { _jsonSerialization = jsonSerialization; _environmentService = environmentService; _accountsService = accountsService; _httpClient = httpClient.Create(); _httpClient.Timeout = new TimeSpan(0, 0, 10); _httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); }
public ApplicationService(IAccountsService accounts, IMvxViewDispatcher viewDispatcher, IFeaturesService features, IPushNotificationsService pushNotifications, IAlertDialogService alertDialogService) { _viewDispatcher = viewDispatcher; _pushNotifications = pushNotifications; Accounts = accounts; _features = features; _alertDialogService = alertDialogService; }
public LoginViewModel(IApplicationService applicationService, IAccountsService accountsService) { _applicationService = applicationService; _accountsService = accountsService; LoginCommand = ReactiveCommand.CreateAsyncTask( this.WhenAnyValue(x => x.Code).Select(x => x != null), t => Login()); LoginCommand.Subscribe(x => MessageBus.Current.SendMessage(new LogoutMessage())); }
public PersonalCabinetController( IUsersService usersService, IAccountsService accountsService, ITradingSystemService tradingSystemService, IStatService statService) { _usersService = usersService; _accountsService = accountsService; _tradingSystemService = tradingSystemService; _statService = statService; }
public StartupViewModel(IAccountsService accountsService, ILoginService loginService) { _accountsService = accountsService; _loginService = loginService; GoToMainCommand = ReactiveCommand.Create().WithSubscription(_ => ShowViewModel(CreateViewModel<MenuViewModel>())); GoToAccountsCommand = ReactiveCommand.Create().WithSubscription(_ => ShowViewModel(CreateViewModel<AccountsViewModel>())); GoToNewUserCommand = ReactiveCommand.Create().WithSubscription(_ => ShowViewModel(CreateViewModel<NewAccountViewModel>())); BecomeActiveWindowCommand = ReactiveCommand.Create(); LoadCommand = ReactiveCommand.CreateAsyncTask(x => Load()); }
protected BaseMenuViewModel(IAccountsService accountsService) { AccountsService = accountsService; DeletePinnedRepositoryCommand = ReactiveCommand.Create(); PinnedRepositories = new ReactiveList<PinnedRepository>(AccountsService.ActiveAccount.PinnnedRepositories); DeletePinnedRepositoryCommand.OfType<PinnedRepository>() .Subscribe(x => { AccountsService.ActiveAccount.PinnnedRepositories.Remove(x); AccountsService.Update(AccountsService.ActiveAccount); PinnedRepositories.Remove(x); }); }
public LoginViewModel(ILoginService loginFactory, IAccountsService accountsService) { _loginFactory = loginFactory; WebDomain = "https://github.com"; GoToOldLoginWaysCommand = new ReactiveCommand(); GoToOldLoginWaysCommand.Subscribe(_ => ShowViewModel(CreateViewModel<AddAccountViewModel>())); LoginCommand = new ReactiveCommand(this.WhenAnyValue(x => x.Code, x => !string.IsNullOrEmpty(x))); LoginCommand.RegisterAsyncTask(_ => Login(Code)) .Subscribe(x => accountsService.ActiveAccount = x); }
public AddAccountViewModel(ILoginService loginFactory, IAccountsService accountsService) { _loginFactory = loginFactory; this.WhenAnyValue(x => x.AttemptedAccount).Where(x => x != null).Subscribe(x => { Username = x.Username; Password = x.Password; Domain = x.Domain; }); LoginCommand = new ReactiveCommand(this.WhenAnyValue(x => x.Username, y => y.Password, (x, y) => !string.IsNullOrEmpty(x) && !string.IsNullOrEmpty(y))); LoginCommand.RegisterAsyncTask(_ => Login()) .Subscribe(x => accountsService.ActiveAccount = x); }
public SettingsViewModel(IApplicationService applicationService, IFeaturesService featuresService, IDefaultValueService defaultValueService, IAccountsService accountsService, IAnalyticsService analyticsService) { _applicationService = applicationService; _featuresService = featuresService; _defaultValueService = defaultValueService; _accountsService = accountsService; _analyticsService = analyticsService; GoToDefaultStartupViewCommand = new ReactiveCommand(); GoToDefaultStartupViewCommand.Subscribe(_ => ShowViewModel(CreateViewModel<DefaultStartupViewModel>())); DeleteAllCacheCommand = new ReactiveCommand(); }
public AccountsViewModel(IAccountsService accountsService) { SelectAccountCommand.OfType<BitbucketAccount>().Subscribe(x => { if (accountsService.ActiveAccount?.Id == x.Id) { DismissCommand.ExecuteIfCan(); } else { accountsService.SetActiveAccount(x); MessageBus.Current.SendMessage(new LogoutMessage()); } }); }
public LoginViewModel(ILoginService loginFactory, IAccountsService accountsService) { _loginFactory = loginFactory; WebDomain = "https://github.com"; GoToOldLoginWaysCommand = ReactiveCommand.Create(); GoToOldLoginWaysCommand.Subscribe(_ => ShowViewModel(CreateViewModel<AddAccountViewModel>())); var loginCommand = ReactiveCommand.CreateAsyncTask( this.WhenAnyValue(x => x.Code).Select(x => !string.IsNullOrEmpty(x)), _ => Login(Code)); loginCommand.Subscribe(x => accountsService.ActiveAccount = x); loginCommand.Subscribe(x => MessageBus.Current.SendMessage(new LogoutMessage())); LoginCommand = loginCommand; }
protected DefaultStartupViewModel(IAccountsService accountsService, Type menuViewModelType) { AccountsService = accountsService; SelectedStartupView = AccountsService.ActiveAccount.DefaultStartupView; this.WhenAnyValue(x => x.SelectedStartupView).Skip(1).Subscribe(x => { AccountsService.ActiveAccount.DefaultStartupView = x; AccountsService.Update(AccountsService.ActiveAccount); DismissCommand.ExecuteIfCan(); }); StartupViews = new ReactiveList<string>(from p in menuViewModelType.GetRuntimeProperties() let attr = p.GetCustomAttributes(typeof(PotentialStartupViewAttribute), true).ToList() where attr.Count == 1 && attr[0] is PotentialStartupViewAttribute select ((PotentialStartupViewAttribute)attr[0]).Name); }
public StartupViewModel(IAccountsService accountsService, IAccountValidatorService accountValidator) { AccountsService = accountsService; AccountValidator = accountValidator; GoToMainCommand = ReactiveCommand.Create(); GoToAccountsCommand = ReactiveCommand.Create(); GoToNewUserCommand = ReactiveCommand.Create(); BecomeActiveWindowCommand = ReactiveCommand.Create(); GoToAccountsCommand.Subscribe(_ => ShowViewModel(CreateViewModel<AccountsViewModel>())); GoToNewUserCommand.Subscribe(_ => ShowViewModel(CreateViewModel<IAddAccountViewModel>())); GoToMainCommand.Subscribe(_ => ShowViewModel(CreateViewModel<IMainViewModel>())); LoadCommand = ReactiveCommand.CreateAsyncTask(x => Load()); }
public AddAccountViewModel(ILoginService loginFactory, IAccountsService accountsService) { _loginFactory = loginFactory; this.WhenAnyValue(x => x.AttemptedAccount).Where(x => x != null).Subscribe(x => { Username = x.Username; Password = x.Password; Domain = x.Domain; }); var loginCommand = ReactiveCommand.CreateAsyncTask( this.WhenAnyValue(x => x.Username, y => y.Password, (x, y) => !string.IsNullOrEmpty(x) && !string.IsNullOrEmpty(y)), _ => Login()); loginCommand.Subscribe(x => accountsService.ActiveAccount = x); loginCommand.Subscribe(x => MessageBus.Current.SendMessage(new LogoutMessage())); LoginCommand = loginCommand; }
public AccountsViewModel(IAccountsService accountsService) { _accountsService = accountsService; _accounts = new ReactiveList<GitHubAccount>(accountsService.OrderBy(x => x.Username)); this.WhenActivated(d => _accounts.Reset(accountsService.OrderBy(x => x.Username))); Accounts = _accounts.CreateDerivedCollection(CreateAccountItem); this.WhenAnyValue(x => x.ActiveAccount) .Subscribe(x => { foreach (var account in Accounts) account.Selected = Equals(account.Account, x); }); DeleteAccountCommand = ReactiveCommand.Create(); DeleteAccountCommand.OfType<GitHubAccount>().Subscribe(x => { if (Equals(accountsService.ActiveAccount, x)) ActiveAccount = null; accountsService.Remove(x); _accounts.Remove(x); }); LoginCommand = ReactiveCommand.Create(); LoginCommand.OfType<GitHubAccount>().Subscribe(x => { if (Equals(accountsService.ActiveAccount, x)) DismissCommand.ExecuteIfCan(); else { ActiveAccount = x; MessageBus.Current.SendMessage(new LogoutMessage()); DismissCommand.ExecuteIfCan(); } }); DismissCommand = ReactiveCommand.Create(this.WhenAnyValue(x => x.ActiveAccount).Select(x => x != null)) .WithSubscription(x => base.DismissCommand.ExecuteIfCan(x)); GoToAddAccountCommand = ReactiveCommand.Create() .WithSubscription(_ => ShowViewModel(CreateViewModel<NewAccountViewModel>())); }
protected BaseAccountsViewModel(IAccountsService accountsService) { _accountsService = accountsService; }
public DefaultStartupViewModel(IAccountsService accountsService) : base(accountsService, typeof(MenuViewModel)) { }
public AccountsViewModel(IAccountsService accountsService) { _accountsService = accountsService; }
public DefaultStartupViewModel(IAccountsService accountsService) { _accountsService = accountsService; _menuViewModelType = typeof(MenuViewModel); }
protected BaseDefaultStartupViewModel(IAccountsService accountsService, Type menuViewModelType) { _accountsService = accountsService; _menuViewModelType = menuViewModelType; }
public LoginFactory(IAccountsService accounts) { _accounts = accounts; }
public StartupViewModel(IAccountsService accountsService, IApplicationService applicationService) { _accountsService = accountsService; _applicationService = applicationService; }
public LoginService(IAccountsService accounts) { _accounts = accounts; }
public AccountsViewModel(IAccountsService accountsService, ILoginFactory loginFactory, IApplicationService applicationService) : base(accountsService) { _loginFactory = loginFactory; _applicationService = applicationService; }
public LoginViewModel(IAccountsService accountsService) { _accountsService = accountsService; }
public AccountsViewModel(IAccountsService accountsService, ILoginService loginService, IApplicationService applicationService) : base(accountsService) { _loginService = loginService; _applicationService = applicationService; }
public MenuViewModel(IApplicationService applicationService, IAccountsService accountsService) : base(accountsService) { _applicationService = applicationService; GoToNotificationsCommand = new ReactiveCommand(); GoToNotificationsCommand.Subscribe(_ => { var vm = CreateViewModel<NotificationsViewModel>(); ShowViewModel(vm); }); GoToAccountsCommand = new ReactiveCommand(); GoToAccountsCommand.Subscribe(_ => CreateAndShowViewModel<AccountsViewModel>()); GoToProfileCommand = new ReactiveCommand(); GoToProfileCommand.Subscribe(_ => { var vm = CreateViewModel<ProfileViewModel>(); vm.Username = Account.Username; ShowViewModel(vm); }); GoToMyIssuesCommand = new ReactiveCommand(); GoToMyIssuesCommand.Subscribe(_ => CreateAndShowViewModel<MyIssuesViewModel>()); GoToUpgradesCommand = new ReactiveCommand(); GoToUpgradesCommand.Subscribe(_ => CreateAndShowViewModel<UpgradesViewModel>()); GoToAboutCommand = new ReactiveCommand(); GoToAboutCommand.Subscribe(_ => CreateAndShowViewModel<AboutViewModel>()); GoToRepositoryCommand = new ReactiveCommand(); GoToRepositoryCommand.OfType<RepositoryIdentifier>().Subscribe(x => { var vm = CreateViewModel<RepositoryViewModel>(); vm.RepositoryOwner = x.Owner; vm.RepositoryName = x.Name; ShowViewModel(vm); }); GoToSettingsCommand = new ReactiveCommand(); GoToSettingsCommand.Subscribe(_ => CreateAndShowViewModel<SettingsViewModel>()); GoToNewsCommand = new ReactiveCommand(); GoToNewsCommand.Subscribe(_ => CreateAndShowViewModel<NewsViewModel>()); GoToOrganizationsCommand = new ReactiveCommand(); GoToOrganizationsCommand.Subscribe(_ => { var vm = CreateViewModel<OrganizationsViewModel>(); vm.Username = Account.Username; ShowViewModel(vm); }); GoToTrendingRepositoriesCommand = new ReactiveCommand(); GoToTrendingRepositoriesCommand.Subscribe(_ => CreateAndShowViewModel<RepositoriesTrendingViewModel>()); GoToExploreRepositoriesCommand = new ReactiveCommand(); GoToExploreRepositoriesCommand.Subscribe(_ => CreateAndShowViewModel<RepositoriesExploreViewModel>()); GoToOrganizationEventsCommand = new ReactiveCommand(); GoToOrganizationEventsCommand.OfType<string>().Subscribe(name => { var vm = CreateViewModel<UserEventsViewModel>(); vm.Username = name; ShowViewModel(vm); }); GoToOrganizationCommand = new ReactiveCommand(); GoToOrganizationCommand.OfType<string>().Subscribe(name => { var vm = CreateViewModel<OrganizationViewModel>(); vm.Name = name; ShowViewModel(vm); }); GoToOwnedRepositoriesCommand = new ReactiveCommand(); GoToOwnedRepositoriesCommand.Subscribe(_ => { var vm = CreateViewModel<UserRepositoriesViewModel>(); vm.Username = Account.Username; ShowViewModel(vm); }); GoToStarredRepositoriesCommand = new ReactiveCommand(); GoToStarredRepositoriesCommand.Subscribe(_ => CreateAndShowViewModel<RepositoriesStarredViewModel>()); GoToPublicGistsCommand = new ReactiveCommand(); GoToPublicGistsCommand.Subscribe(_ => CreateAndShowViewModel<PublicGistsViewModel>()); GoToStarredGistsCommand = new ReactiveCommand(); GoToStarredGistsCommand.Subscribe(_ => CreateAndShowViewModel<StarredGistsViewModel>()); GoToMyGistsCommand = new ReactiveCommand(); GoToMyGistsCommand.Subscribe(_ => { var vm = CreateViewModel<UserGistsViewModel>(); vm.Username = Account.Username; ShowViewModel(vm); }); GoToMyEvents = new ReactiveCommand(); GoToMyEvents.Subscribe(_ => { var vm = CreateViewModel<UserEventsViewModel>(); vm.Username = Account.Username; ShowViewModel(vm); }); LoadCommand = new ReactiveCommand(); LoadCommand.Subscribe(_ => { var notificationRequest = applicationService.Client.Notifications.GetAll(); notificationRequest.RequestFromCache = false; notificationRequest.CheckIfModified = false; applicationService.Client.ExecuteAsync(notificationRequest) .ContinueWith(t => Notifications = t.Result.Data.Count); applicationService.Client.ExecuteAsync(applicationService.Client.AuthenticatedUser.GetOrganizations()) .ContinueWith(t => Organizations = t.Result.Data.Select(y => y.Login).ToList()); }); }
public ApplicationService(IAccountsService accounts, IMvxViewDispatcher viewDispatcher) { _viewDispatcher = viewDispatcher; Accounts = accounts; }