예제 #1
0
        protected override void DoConstruct()
        {
            base.DoConstruct();

            if (SelectCommand == null)
            {
                SelectCommand = new PropertyButton {
                    Text = "None"
                };
            }
            SelectCommand.ClickEventHandler = ClickEventHandler;
        }
예제 #2
0
        protected override void createProperties()
        {
            base.createProperties();

            Property p = new PropertyString("", "Image path to save");

            p.eValueChanged += pathChanged;
            properties.Add("path", p);

            p = new PropertyButton("Read", "open image from file");
            p.eValueChanged += open;
            properties.Add("save", p);

            properties.Add("outChannels1", new PropertyChannels(false, true));
            properties.Add("outVectors2", new PropertyVectors(false, true));
            properties.Add("outChannels2", new PropertyChannels(false, true));
        }
예제 #3
0
파일: Merge.cs 프로젝트: JoePelz/NodeShop
        protected override void createProperties()
        {
            base.createProperties();

            Property p = new PropertySelection(options, (int)method, "merge operator");

            p.eValueChanged          += e_OpChanged;
            properties["mergeMethod"] = p;

            p = new PropertyButton("Swap", "Swap inputs A and B");
            p.eValueChanged      += e_SwapInputs;
            properties["btnSwap"] = p;

            properties.Add("inColorA", new PropertyColor(true, false));
            properties.Add("inColorB", new PropertyColor(true, false));
            properties.Add("outColor", new PropertyColor(false, true));
        }
예제 #4
0
        protected override void createProperties()
        {
            base.createProperties();

            Property p = new PropertyFloat(ratio, 0.0f, 1.0f, "Mix ratio");

            p.eValueChanged       += e_RatioChanged;
            properties["mixRatio"] = p;

            p = new PropertyButton("Swap", "Swap inputs A and B");
            p.eValueChanged      += e_SwapInputs;
            properties["btnSwap"] = p;

            properties.Add("inColorA", new PropertyColor(true, false));
            properties.Add("inColorB", new PropertyColor(true, false));
            properties.Add("outColor", new PropertyColor(false, true));
        }
예제 #5
0
        protected override void createProperties()
        {
            base.createProperties();

            //create filepath property
            Property p = new PropertyString("", "Image path to save");

            p.eValueChanged += pathChanged;
            properties.Add("path", p);

            p = new PropertyButton("open", "load channels from file");
            p.eValueChanged += open;
            properties.Add("open", p);

            p = new PropertyButton("info", "stats on the file read");
            p.eValueChanged += (a, b) => { check(); };
            properties.Add("info", p);

            properties.Add("outChannels", new PropertyChannels(false, true));
        }
예제 #6
0
        protected override void createProperties()
        {
            base.createProperties();

            //create filepath property
            Property p = new PropertyString("", "Image path to save");

            p.eValueChanged += pathChanged;
            properties.Add("path", p);

            p = new PropertyButton("Save", "save image to file");
            p.eValueChanged += save;
            properties.Add("save", p);

            p = new PropertyButton("Check", "check file stats");
            p.eValueChanged += check;
            properties.Add("check", p);

            properties.Add("inChannels", new PropertyChannels(true, false));
        }
예제 #7
0
파일: FormEditObject.cs 프로젝트: Slion/CIC
        /// <summary>
        /// Set an object property value from the state of the given control.
        ///
        /// Extend this function to support reading new types of properties.
        /// </summary>
        /// <param name="aObject"></param>
        private static void SetObjectPropertyValueFromControl(T aObject, PropertyInfo aInfo, Control aControl)
        {
            if (aInfo.PropertyType == typeof(int))
            {
                NumericUpDown ctrl = (NumericUpDown)aControl;
                aInfo.SetValue(aObject, (int)ctrl.Value);
            }
            else if (aInfo.PropertyType == typeof(float))
            {
                NumericUpDown ctrl = (NumericUpDown)aControl;
                aInfo.SetValue(aObject, (float)ctrl.Value);
            }
            else if (aInfo.PropertyType.IsEnum)
            {
                // Instantiate our enum
                object enumValue = Activator.CreateInstance(aInfo.PropertyType);
                // Parse our enum from combo box
                enumValue = Enum.Parse(aInfo.PropertyType, ((ComboBox)aControl).SelectedItem.ToString());
                //enumValue = ((ComboBox)aControl).SelectedValue;
                // Set enum value
                aInfo.SetValue(aObject, enumValue);
            }
            else if (aInfo.PropertyType == typeof(bool))
            {
                CheckBox ctrl = (CheckBox)aControl;
                aInfo.SetValue(aObject, ctrl.Checked);
            }
            else if (aInfo.PropertyType == typeof(string))
            {
                TextBox ctrl = (TextBox)aControl;
                aInfo.SetValue(aObject, ctrl.Text);
            }
            else if (aInfo.PropertyType == typeof(PropertyFile))
            {
                Button       ctrl  = (Button)aControl;
                PropertyFile value = new PropertyFile {
                    FullPath = ctrl.Text
                };
                aInfo.SetValue(aObject, value);
            }
            else if (aInfo.PropertyType == typeof(PropertyComboBox))
            {
                ComboBox ctrl = (ComboBox)aControl;
                if (ctrl.SelectedItem != null)
                {
                    // Apparently you can still get the SelectedValue even when no ValueMember was set
                    string           currentItem = ctrl.SelectedValue.ToString();
                    PropertyComboBox value       = (PropertyComboBox)aInfo.GetValue(aObject);
                    // Make sure the value actually changed before doing anything
                    // Shall we do that for every control?
                    if (value.CurrentItem != currentItem)
                    {
                        value.CurrentItem = currentItem;
                        //Not strictly needed but makes sure the set method is called
                        aInfo.SetValue(aObject, value);
                        //
                        aObject.OnPropertyChanged(aInfo.Name);
                    }
                }
            }
            else if (aInfo.PropertyType == typeof(PropertyButton))
            {
                Button         ctrl  = (Button)aControl;
                PropertyButton value = new PropertyButton {
                    Text = ctrl.Text
                };
                aInfo.SetValue(aObject, value);
            }
            else if (aInfo.PropertyType == typeof(PropertyCheckedListBox))
            {
                CheckedListBox         ctrl         = (CheckedListBox)aControl;
                PropertyCheckedListBox value        = (PropertyCheckedListBox)aInfo.GetValue(aObject);
                List <string>          checkedItems = new List <string>();
                foreach (string item in ctrl.CheckedItems)
                {
                    checkedItems.Add(item);
                }
                value.CheckedItems = checkedItems;

                //value.CurrentItem = currentItem;
                //Not strictly needed but makes sure the set method is called
                aInfo.SetValue(aObject, value);
                //
                //aObject.OnPropertyChanged(aInfo.Name);
            }

            //TODO: add support for other types here
        }