private MyIssuesFilterModel CreateFilterModel()
 {
     var model = new MyIssuesFilterModel();
     model.FilterType = _filter.Value;
     model.Open = _open.Value;
     model.Labels = _labels.Value;
     model.SortType = _sort.Value;
     model.Ascending = _asc.Value;
     return model;
 }
Ejemplo n.º 2
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (ReferenceEquals(this, obj))
            {
                return(true);
            }
            if (obj.GetType() != typeof(MyIssuesFilterModel))
            {
                return(false);
            }
            MyIssuesFilterModel other = (MyIssuesFilterModel)obj;

            return(Labels == other.Labels && FilterType == other.FilterType && Open == other.Open && Ascending == other.Ascending && SortType == other.SortType);
        }
Ejemplo n.º 3
0
        public MyIssuesViewModel(ISessionService sessionService)
            : base(sessionService)
        {
            _applicationService = sessionService;

            Title = "My Issues";
            Filter = MyIssuesFilterModel.CreateOpenFilter();

            _selectedFilter = this.WhenAnyValue(x => x.Filter)
                .Select(x =>
                {
                    if (x == null || _openFilter.Equals(x))
                        return 0;
                    return _closedFilter.Equals(x) ? 1 : -1;
                })
                .ToProperty(this, x => x.SelectedFilter);

            this.WhenAnyValue(x => x.Filter).Skip(1).Subscribe(_ =>
            {
                IssuesBacking.Clear();
                LoadCommand.ExecuteIfCan();
            });
 
            GoToFilterCommand = ReactiveCommand.Create();
            GoToFilterCommand.Subscribe(_ => {
                var vm = this.CreateViewModel<MyIssuesFilterViewModel>();
                vm.Ascending = Filter.Ascending;
                vm.FilterType = Filter.FilterType;
                vm.Labels = Filter.Labels;
                vm.State = Filter.Open;
                vm.SortType = Filter.SortType;
                vm.SaveCommand.Subscribe(__ => {
                    Filter = new MyIssuesFilterModel 
                    {
                        Ascending = vm.Ascending,
                        FilterType = vm.FilterType,
                        Labels = vm.Labels,
                        Open = vm.State,
                        SortType = vm.SortType
                    };
                    CustomFilterEnabled = true;
                });

                NavigateTo(vm);
            });
        }
Ejemplo n.º 4
0
 public MyIssuesFilterViewModel Init(MyIssuesFilterModel model)
 {
     Ascending = model.Ascending;
     FilterType = model.FilterType;
     Labels = model.Labels;
     State = model.Open;
     SortType = model.SortType;
     return this;
 }