Exemplo n.º 1
0
        public override Int32 SaveWindowControls(StackPanel control, string name, Type type, object[] attributes)
        {
            int controlIndex = 0;

            controlIndex++;
            FrameTypeAttribute frameAtt = ReflectionExt.FindAttribute <FrameTypeAttribute>(attributes);

            ComboBox cbValue = (ComboBox)control.Children[controlIndex];

            if (!frameAtt.DashOnly)
            {
                return(cbValue.SelectedIndex);
            }
            else
            {
                int currentDashValue = -1;
                for (int ii = 0; ii < GraphicsManager.Actions.Count; ii++)
                {
                    if (GraphicsManager.Actions[ii].IsDash)
                    {
                        currentDashValue++;
                        if (currentDashValue == cbValue.SelectedIndex)
                        {
                            return(ii);
                        }
                    }
                }
            }
            return(0);
        }
Exemplo n.º 2
0
        public override void LoadWindowControls(StackPanel control, string parent, string name, Type type, object[] attributes, Int32 member)
        {
            LoadLabelControl(control, name);

            FrameTypeAttribute frameAtt = ReflectionExt.FindAttribute <FrameTypeAttribute>(attributes);

            ComboBox cbValue = new ComboBox();

            cbValue.VirtualizationMode = ItemVirtualizationMode.Simple;
            int chosenIndex = 0;

            List <string> items = new List <string>();

            for (int ii = 0; ii < GraphicsManager.Actions.Count; ii++)
            {
                if (!frameAtt.DashOnly || GraphicsManager.Actions[ii].IsDash)
                {
                    if (ii == (int)member)
                    {
                        chosenIndex = items.Count;
                    }
                    items.Add(GraphicsManager.Actions[ii].Name);
                }
            }

            var subject = new Subject <List <string> >();

            cbValue.Bind(ComboBox.ItemsProperty, subject);
            subject.OnNext(items);
            cbValue.SelectedIndex = Math.Min(Math.Max(0, chosenIndex), items.Count - 1);
            control.Children.Add(cbValue);
        }
Exemplo n.º 3
0
        public override void LoadWindowControls(StackPanel control, string parent, string name, Type type, object[] attributes, Int32 member)
        {
            LoadLabelControl(control, name);

            FrameTypeAttribute frameAtt = ReflectionExt.FindAttribute <FrameTypeAttribute>(attributes);
            NumericUpDown      nudValue = new NumericUpDown();

            nudValue.Minimum = Int32.MinValue;
            nudValue.Maximum = Int32.MaxValue;
            NumberRangeAttribute rangeAtt = ReflectionExt.FindAttribute <NumberRangeAttribute>(attributes);

            if (rangeAtt != null)
            {
                nudValue.Minimum = rangeAtt.Min;
                nudValue.Maximum = rangeAtt.Max;
            }
            nudValue.Value = member;

            control.Children.Add(nudValue);
        }