Ejemplo n.º 1
0
        internal void FirePropertyValueChangedEvent(PropertyValueChangedEventArgs e)
        {
            PropertyValueChangedEventHandler del = OnPropertyValueChanged;

            if (del != null)
            {
                del(this, e);
            }
        }
        /// <summary>
        /// Extends BeginInvoke so that when a state object is not needed, null does not need to be passed.
        /// <example>
        /// propertyvaluechangedeventhandler.BeginInvoke(s, e, callback);
        /// </example>
        /// </summary>
        public static IAsyncResult BeginInvoke(this PropertyValueChangedEventHandler propertyvaluechangedeventhandler, Object s, PropertyValueChangedEventArgs e, AsyncCallback callback)
        {
            if (propertyvaluechangedeventhandler == null)
            {
                throw new ArgumentNullException("propertyvaluechangedeventhandler");
            }

            return(propertyvaluechangedeventhandler.BeginInvoke(s, e, callback, null));
        }
Ejemplo n.º 3
0
 public SettingsPropertyGrid()
 {
     Dock = DockStyle.Fill;
     PropertyValueChanged +=new PropertyValueChangedEventHandler(SettingsPropertyGrid_PropertyValueChanged);
 }
 public SettingsPropertyGrid()
 {
     Dock = DockStyle.Fill;
     PropertyValueChanged += new PropertyValueChangedEventHandler(SettingsPropertyGrid_PropertyValueChanged);
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Subscribing to any changes of the controls by type
        /// </summary>
        /// <param name="type"></param>
        /// <param name="control">where to look</param>
        /// <param name="callback"></param>
        /// <param name="except">Optional the exception list with names what should be ignored</param>
        public static void noticeAboutChanges(Type type, Form control, EventHandler callback, string[] except = null)
        {
            foreach (Control ctrl in getControls(control,
                                                 c =>
                                                 c.GetType() == type
                                                 &&
                                                 (
                                                     (except != null && !except.Contains(c.Name))
                                                     ||
                                                     except == null
                                                 )
                                                 ))
            {
                if (type == typeof(CheckBox))
                {
                    ((CheckBox)ctrl).CheckedChanged -= callback;
                    ((CheckBox)ctrl).CheckedChanged += callback;
                    continue;
                }

                if (type == typeof(RadioButton))
                {
                    ((RadioButton)ctrl).CheckedChanged -= callback;
                    ((RadioButton)ctrl).CheckedChanged += callback;
                    continue;
                }

                if (type == typeof(TextBox))
                {
                    ((TextBox)ctrl).TextChanged -= callback;
                    ((TextBox)ctrl).TextChanged += callback;
                    continue;
                }

                if (type == typeof(ListBox))
                {
                    ((ListBox)ctrl).SelectedIndexChanged -= callback;
                    ((ListBox)ctrl).SelectedIndexChanged += callback;
                    continue;
                }

                if (type == typeof(ComboBox))
                {
                    ((ComboBox)ctrl).TextChanged -= callback;
                    ((ComboBox)ctrl).TextChanged += callback;
                    continue;
                }

                if (type == typeof(RichTextBox))
                {
                    ((RichTextBox)ctrl).TextChanged -= callback;
                    ((RichTextBox)ctrl).TextChanged += callback;
                    continue;
                }

                if (type == typeof(CheckedListBox))
                {
                    ItemCheckEventHandler call = (sender, e) => { callback(sender, (EventArgs)e); };
                    ((CheckedListBox)ctrl).ItemCheck -= call;
                    ((CheckedListBox)ctrl).ItemCheck += call;
                    continue;
                }

                if (type == typeof(DataGridView) || type == typeof(DataGridViewExt))
                {
                    DataGridViewCellEventHandler call = (sender, e) => { callback(sender, (EventArgs)e); };
                    ((DataGridView)ctrl).CellValueChanged -= call;
                    ((DataGridView)ctrl).CellValueChanged += call;
                    continue;
                }

                if (type == typeof(PropertyGrid))
                {
                    PropertyValueChangedEventHandler call = (sender, e) => { callback(sender, (EventArgs)e); };
                    ((PropertyGrid)ctrl).PropertyValueChanged -= call;
                    ((PropertyGrid)ctrl).PropertyValueChanged += call;
                    continue;
                }
            }
        }
Ejemplo n.º 6
0
 public void SetPropertyValueChanged(PropertyValueChangedEventHandler propertyValueChangedEventHandler)
 {
     propertyGrid.PropertyValueChanged += propertyValueChangedEventHandler;
 }