コード例 #1
0
 public PublicGistsViewModel(IApplicationService applicationService)
 {
     Title       = "Public Gists";
     LoadCommand = ReactiveCommand.CreateAsyncTask(t =>
                                                   GistsCollection.SimpleCollectionLoad(applicationService.Client.Gists.GetPublicGists(), t as bool?));
     LoadCommand.ExecuteIfCan();
 }
コード例 #2
0
        public UserGistsViewModel(IApplicationService applicationService)
        {
            _applicationService = applicationService;
            Username            = _applicationService.Account.Username;

            GoToCreateGistCommand = ReactiveCommand.Create();
            GoToCreateGistCommand.Subscribe(_ =>
            {
                var vm = CreateViewModel <GistCreateViewModel>();
                ShowViewModel(vm);
            });

            this.WhenAnyValue(x => x.Username).Subscribe(x =>
            {
                if (IsMine)
                {
                    Title = "My Gists";
                }
                else if (x == null)
                {
                    Title = "Gists";
                }
                else if (x.EndsWith("s", StringComparison.OrdinalIgnoreCase))
                {
                    Title = x + "' Gists";
                }
                else
                {
                    Title = x + "'s Gists";
                }
            });

            LoadCommand = ReactiveCommand.CreateAsyncTask(t =>
                                                          GistsCollection.SimpleCollectionLoad(applicationService.Client.Users[Username].Gists.GetGists(), t as bool?));
        }
コード例 #3
0
ファイル: UserGistsViewModel.cs プロジェクト: yhtsnda/CodeHub
        public UserGistsViewModel(IApplicationService applicationService)
        {
            _applicationService = applicationService;
            Username            = _applicationService.Account.Username;

            GoToCreateGistCommand = ReactiveCommand.Create();
            GoToCreateGistCommand.Subscribe(_ =>
            {
                var vm = CreateViewModel <GistCreateViewModel>();
                ShowViewModel(vm);
            });

            LoadCommand = ReactiveCommand.CreateAsyncTask(t =>
                                                          GistsCollection.SimpleCollectionLoad(applicationService.Client.Users[Username].Gists.GetGists(), t as bool?));
        }
コード例 #4
0
 public StarredGistsViewModel(IApplicationService applicationService)
 {
     Title       = "Starred Gists";
     LoadCommand = ReactiveCommand.CreateAsyncTask(t =>
                                                   GistsCollection.SimpleCollectionLoad(applicationService.Client.Gists.GetStarredGists(), t as bool?));
 }