Esempio n. 1
0
 public State()
 {
     RepositoryUrl       = InitOrDefault(App.RepositoryKey, Properties.Settings.Default.Repository);
     UpdateCheckInterval = (PeriodInterval)Enum.Parse(typeof(PeriodInterval),
                                                      InitOrDefault(App.UpdateCheckIntervalKey, Properties.Settings.Default.UpdateCheckInterval));
     SelectedPackages   = new ObservableCollection <PackageIndex>();
     SelectedRepository = AsyncState <Repository, string> .NotStarted();
 }
Esempio n. 2
0
        private void BindPackageList()
        {
            Repository repoLoading;

            App.Store.Observe()
            .SubscribeOnDispatcher()
            .ObserveOnDispatcher()
            .Select(state => state.SelectedRepository)
            .DistinctUntilChanged()
            .Subscribe(repo =>
            {
                switch (repo.State)
                {
                case TAsyncState.NotStarted:
                    repoLoading = new Repository(App.Store.State.RepositoryUrl);
                    App.Store.State.SelectedRepository = AsyncState <Repository, string> .Loading();

                    repoLoading.Refresh().ContinueWith(result =>
                    {
                        if (result.Exception != null)
                        {
                            throw result.Exception;
                        }
                        App.Store.State.SelectedRepository = AsyncState <Repository, string> .Success(repoLoading);
                    });
                    break;

                case TAsyncState.Loading:
                    break;

                case TAsyncState.Success:
                    var packages = repo.Value.PackagesIndex.Values
                                   //.Where(x => x.Os.Keys.Contains("windows"))
                                   .ToList();
                    var filter = repo.Value.Meta.PrimaryFilter;

                    switch (filter)
                    {
                    case "category":
                        FilterBy <CategoryFilter>(packages);
                        break;

                    case "language":
                        FilterBy <LanguageFilter>(packages);
                        break;
                    }
                    break;

                case TAsyncState.Failure:
                    break;
                }
            });
        }