コード例 #1
0
        public IObservable <T> GetSelectedItem(IObservable <bool> ischecked)
        {
            var ca = this.SelectSelected();

            var cb = (this as InteractiveCollectionViewModel <T, IConvertible>).ChildSubject.Where(_ => _.Value.Interaction == Interaction.Select && (int)_.Value.Value > 0).Select(_ => _.Key);

            var xx = ca.Merge(cb)
                     .CombineLatest(ischecked, (a, b) => new { a, b }).Where(_ => Checked.Contains(_.a) || _.b == false);

            return(xx.Select(_ => _.a));
        }
コード例 #2
0
        private void Init()
        {
            Interactions.Where(_ => _.Value.Interaction == Interaction.Check && (bool?)_.Value.Value == true).Subscribe(_ =>
            {
                Checked.Add(_.Key);
                if (Unchecked.Contains(_.Key))
                {
                    Unchecked.Remove(_.Key);
                }
            });

            ChildSubject.Where(_ => _.Value.Interaction == Interaction.Check && (bool?)_.Value.Value == true).Subscribe(_ =>
            {
                Checked.Add(_.Key);
                if (Unchecked.Contains(_.Key))
                {
                    Unchecked.Remove(_.Key);
                }
            });

            Interactions.Where(_ => _.Value.Interaction == Interaction.Check && !((bool?)_.Value.Value == true)).Subscribe(_ =>
            {
                Unchecked.Add(_.Key);
                if (Checked.Contains(_.Key))
                {
                    Checked.Remove(_.Key);
                }
            });

            ChildSubject.Where(_ => _.Value.Interaction == Interaction.Check && !((bool?)_.Value.Value == true)).Subscribe(_ =>
            {
                Unchecked.Add(_.Key);
                if (Checked.Contains(_.Key))
                {
                    Checked.Remove(_.Key);
                }
            });
        }
コード例 #3
0
        public IObservable <List <T> > SelectCheckedChildItems(IObservable <bool> ischecked, string childrenpath)
        {
            var x = GetSelectedItem(ischecked);

            return(x.Select(_ => ReflectionHelper.RecursivePropValues(_, childrenpath).Cast <T>().Where(a => Checked.Contains(a)).ToList()));
        }