Ejemplo n.º 1
0
        public StatusViewModel(IRepoActionHandler actionHandler) {
            DisplayName = "Downloads";

            var activeStatusModObservable = actionHandler
                .WhenAnyValue(x => x.ActiveStatusMod)
                .ObserveOn(RxApp.MainThreadScheduler);

            activeStatusModObservable
                .BindTo(this, x => x.ActiveStatusMod);

            activeStatusModObservable
                .Where(x => x == null)
                .Select(_ => false)
                .BindTo(this, x => x.IsOpen);

            this.WhenAnyValue(x => x.ActiveStatusMod.Repo)
                .Where(x => x == null)
                .Select(_ => false)
                .ObserveOn(RxApp.MainThreadScheduler)
                .BindTo(this, x => x.IsOpen);

            this.WhenAnyValue(x => x.ActiveStatusMod.Repo.Items)
                .Select(x => x == null ? null : x.CreateDerivedCollection(i => i, scheduler: RxApp.MainThreadScheduler))
                .ObserveOn(RxApp.MainThreadScheduler)
                .BindTo(this, x => x.StatusItems);

            this.WhenAnyValue(x => x.ActiveStatusMod.Repo.Info)
                .ObserveOn(RxApp.MainThreadScheduler)
                .BindTo(this, x => x.Info);

            Sort = new StatusModSorter();

            //SortDescriptions = new ReactiveList<SortDescription> { new SortDescription("Progress", ListSortDirection.Ascending) };
        }
Ejemplo n.º 2
0
        public StatusViewModel(IRepoActionHandler actionHandler)
        {
            DisplayName = "Downloads";

            var activeStatusModObservable = actionHandler
                                            .WhenAnyValue(x => x.ActiveStatusMod)
                                            .ObserveOn(RxApp.MainThreadScheduler);

            activeStatusModObservable
            .BindTo(this, x => x.ActiveStatusMod);

            activeStatusModObservable
            .Where(x => x == null)
            .Select(_ => false)
            .BindTo(this, x => x.IsOpen);

            this.WhenAnyValue(x => x.ActiveStatusMod.Repo)
            .Where(x => x == null)
            .Select(_ => false)
            .ObserveOn(RxApp.MainThreadScheduler)
            .BindTo(this, x => x.IsOpen);

            this.WhenAnyValue(x => x.ActiveStatusMod.Repo.Items)
            .Select(x => x == null ? null : x.CreateDerivedCollection(i => i, scheduler: RxApp.MainThreadScheduler))
            .ObserveOn(RxApp.MainThreadScheduler)
            .BindTo(this, x => x.StatusItems);

            this.WhenAnyValue(x => x.ActiveStatusMod.Repo.Info)
            .ObserveOn(RxApp.MainThreadScheduler)
            .BindTo(this, x => x.Info);

            Sort = new StatusModSorter();

            //SortDescriptions = new ReactiveList<SortDescription> { new SortDescription("Progress", ListSortDirection.Ascending) };
        }