Beispiel #1
0
        private static Control GetRandomValueControl(int i, List <ObjectId> ids)
        {
            var ci = MathExt.IsEven(i);// rnd.Next(0, 1);

            if (ci)
            {
                var ivm = new IntListValueVM {
                    Value = i, AllowCustomValue = DateTime.Now.Ticks % 2 == 0
                };
                ivm.WhenAnyValue(v => v.Value).Skip(1).Subscribe(s => UpdateValue(s, ids));
                return(new IntListValueView(ivm));
            }

            var ilvm = new IntValueVM {
                Value = i, Min = 1, Max = 10
            };

            ilvm.WhenAnyValue(v => v.Value).Skip(1).Subscribe(s => UpdateValue(s, ids));
            return(new IntValueView(ilvm));
        }
Beispiel #2
0
        private static PalettePropVM GetIntListProp(List <Circle> ents, string propName, bool isReadObly, bool allowCustomValue)
        {
            var vm = new IntListValueVM
            {
                Values = new List <int> {
                    1, 10, 50, 100, 500, 1000
                },
                Value            = GetValue(ents.GroupBy(g => (int)g.Radius).Select(s => s.Key)),
                AllowCustomValue = allowCustomValue,
                IsReadOnly       = isReadObly,
                Min = 1, Max = 1000
            };

            vm.WhenAnyValue(v => v.Value).Skip(1).Subscribe(s => UpdateValue(s, ents.Select(e => e.Id).ToList()));
            return(new PalettePropVM
            {
                Name = propName,
                ValueControl = new IntListValueView(vm),
                Tooltip = $"Help IntListValueVM isReadObly={isReadObly}, allowCustomValue={allowCustomValue}"
            });
        }