Пример #1
0
        private static PalettePropVM GetIntProp(List <Circle> ents, string propName, bool isReadObly)
        {
            var vm = new IntValueVM
            {
                Value      = GetValue(ents.GroupBy(g => (int)g.Radius).Select(s => s.Key)),
                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 IntValueView(vm),
                Tooltip = $"Help IntValueVM isReadObly={isReadObly}.",
            });
        }
Пример #2
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));
        }