コード例 #1
0
ファイル: SettingsViewModel.cs プロジェクト: runt18/CodeHub
        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);
            });
        }
コード例 #2
0
        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);
            });
        }
コード例 #3
0
 public PushRegistrationsController(IPushNotificationRegistrationService pushNotificationRegistrationService,
                                    IMapper mapper)
 {
     _pushNotificationRegistrationService = pushNotificationRegistrationService;
     _mapper = mapper;
 }