Beispiel #1
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?));
        }
Beispiel #2
0
        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?));
        }