Exemple #1
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);
            });
        }
Exemple #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);
            });
        }
Exemple #3
0
 public ErrorService(IHttpClientService httpClient, IJsonSerializationService jsonSerialization, IEnvironmentalService environmentService)
 {
     _jsonSerialization  = jsonSerialization;
     _environmentService = environmentService;
     _httpClient         = httpClient.Create();
     _httpClient.Timeout = new TimeSpan(0, 0, 10);
     _httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
 }
        public SettingsViewModel(IApplicationService applicationService, IEnvironmentalService environmentalService)
        {
            ApplicationService   = applicationService;
            EnvironmentalService = environmentalService;
            DeleteCacheCommand   = new ReactiveCommand();
//            SaveCredentials = ApplicationService.Account.SaveCredentials;
//
//            this.WhenAnyValue(x => x.SaveCredentials).Skip(1).Subscribe(x =>
//            {
//                ApplicationService.Account.SaveCredentials = x;
//                ApplicationService.Accounts.Update(ApplicationService.Account);
//            });
        }
Exemple #5
0
        public AboutViewModel(IEnvironmentalService environmentService)
        {
            _environmentService = environmentService;

            GoToSourceCodeCommand = new ReactiveCommand();
            GoToSourceCodeCommand.Subscribe(x =>
            {
                var vm = CreateViewModel<RepositoryViewModel>();
                vm.RepositoryOwner = "thedillonb";
                vm.RepositoryName = "codehub";
                ShowViewModel(vm);
            });
        }
Exemple #6
0
        public AboutViewModel(IEnvironmentalService environmentService)
        {
            _environmentService = environmentService;

            GoToSourceCodeCommand = ReactiveCommand.Create();
            GoToSourceCodeCommand.Subscribe(x =>
            {
                var vm             = CreateViewModel <RepositoryViewModel>();
                vm.RepositoryOwner = "thedillonb";
                vm.RepositoryName  = "codehub";
                ShowViewModel(vm);
            });
        }
        public SettingsViewModel(IApplicationService applicationService, IEnvironmentalService environmentalService)
        {
            SyncWithGitHub = applicationService.Account.SyncWithGitHub;

            LogoutCommand = ReactiveCommand.Create();
            LogoutCommand.Select(_ => new LogoutMessage()).Subscribe(x => applicationService.Logout());

            GoToSourceCode = ReactiveCommand.Create();
            GoToSourceCode.Subscribe(_ =>
            {
                var vm = CreateViewModel<RepositoryViewModel>();
                vm.RepositoryIdentifier = new BaseRepositoryViewModel.RepositoryIdentifierModel("thedillonb", "repostumble");
                ShowViewModel(vm);
            });

            Version = environmentalService.ApplicationVersion;

            this.WhenAnyValue(x => x.SyncWithGitHub).Skip(1).Subscribe(x =>
            {
                applicationService.Account.SyncWithGitHub = x;
                applicationService.Account.Save();
            });
        }
        public SettingsViewModel(IApplicationService applicationService, IEnvironmentalService environmentalService)
        {
            SyncWithGitHub = applicationService.Account.SyncWithGitHub;

            LogoutCommand = ReactiveCommand.Create();
            LogoutCommand.Select(_ => new LogoutMessage()).Subscribe(x => applicationService.Logout());

            GoToSourceCode = ReactiveCommand.Create();
            GoToSourceCode.Subscribe(_ =>
            {
                var vm = CreateViewModel <RepositoryViewModel>();
                vm.RepositoryIdentifier = new BaseRepositoryViewModel.RepositoryIdentifierModel("thedillonb", "repostumble");
                ShowViewModel(vm);
            });

            Version = environmentalService.ApplicationVersion;

            this.WhenAnyValue(x => x.SyncWithGitHub).Skip(1).Subscribe(x =>
            {
                applicationService.Account.SyncWithGitHub = x;
                applicationService.Account.Save();
            });
        }
Exemple #9
0
        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);
            });
        }