public SettingsViewModel(ISessionService applicationService, IFeaturesService featuresService, IAccountsRepository accountsService, IEnvironmentalService environmentalService, IPushNotificationRegistrationService pushNotificationsService) { Title = "Account Settings"; _sessionService = applicationService; _featuresService = featuresService; _accountsService = accountsService; _environmentService = environmentalService; _pushNotificationsService = pushNotificationsService; AccountImageUrl = applicationService.Account.AvatarUrl; GoToDefaultStartupViewCommand = ReactiveCommand.Create(); GoToDefaultStartupViewCommand.Subscribe(_ => { var vm = this.CreateViewModel <DefaultStartupViewModel>(); vm.WhenAnyValue(x => x.SelectedStartupView) .Subscribe(x => DefaultStartupViewName = x); NavigateTo(vm); }); GoToSyntaxHighlighterCommand = ReactiveCommand.Create().WithSubscription(_ => { var vm = this.CreateViewModel <SyntaxHighlighterViewModel>(); vm.SaveCommand.Subscribe(__ => SyntaxHighlighter = vm.SelectedTheme); NavigateTo(vm); }); DeleteAllCacheCommand = ReactiveCommand.Create(); GoToSourceCodeCommand = ReactiveCommand.Create().WithSubscription(_ => { var vm = this.CreateViewModel <RepositoryViewModel>(); vm.Init("thedillonb", "codehub"); NavigateTo(vm); }); ShowOrganizationsInEvents = applicationService.Account.ShowOrganizationsInEvents; this.WhenAnyValue(x => x.ShowOrganizationsInEvents).Skip(1).Subscribe(x => { applicationService.Account.ShowOrganizationsInEvents = x; accountsService.Update(applicationService.Account); }); ExpandOrganizations = applicationService.Account.ExpandOrganizations; this.WhenAnyValue(x => x.ExpandOrganizations).Skip(1).Subscribe(x => { applicationService.Account.ExpandOrganizations = x; accountsService.Update(applicationService.Account); }); ShowRepositoryDescriptionInList = applicationService.Account.ShowRepositoryDescriptionInList; this.WhenAnyValue(x => x.ShowRepositoryDescriptionInList).Skip(1).Subscribe(x => { applicationService.Account.ShowRepositoryDescriptionInList = x; accountsService.Update(applicationService.Account); }); }
public SettingsViewModel(IApplicationService applicationService, IFeaturesService featuresService, IDefaultValueService defaultValueService, IAccountsService accountsService, IAnalyticsService analyticsService) { _applicationService = applicationService; _featuresService = featuresService; _defaultValueService = defaultValueService; _accountsService = accountsService; _analyticsService = analyticsService; GoToDefaultStartupViewCommand = ReactiveCommand.Create(); GoToDefaultStartupViewCommand.Subscribe(_ => ShowViewModel(CreateViewModel <DefaultStartupViewModel>())); DeleteAllCacheCommand = ReactiveCommand.Create(); }
public SettingsViewModel(IApplicationService applicationService, IFeaturesService featuresService, IDefaultValueService defaultValueService, IAccountsService accountsService, IAnalyticsService analyticsService, IEnvironmentalService environmentalService) { _applicationService = applicationService; _featuresService = featuresService; _defaultValueService = defaultValueService; _accountsService = accountsService; _analyticsService = analyticsService; _environmentService = environmentalService; GoToDefaultStartupViewCommand = ReactiveCommand.Create(); GoToDefaultStartupViewCommand.Subscribe(_ => ShowViewModel(CreateViewModel <DefaultStartupViewModel>())); DeleteAllCacheCommand = ReactiveCommand.Create(); GoToSourceCodeCommand = ReactiveCommand.Create().WithSubscription(_ => { var vm = CreateViewModel <RepositoryViewModel>(); vm.RepositoryOwner = "thedillonb"; vm.RepositoryName = "codehub"; ShowViewModel(vm); }); }