//===================================================================== private static void InitializeNumericUpDown(BaseEditorControl owner, Control control) { var numeric = control as NumericUpDown; if (numeric == null) { return; } // This is a hack :( // the NumericUpDownCell class has an actual NumericUpDown control internally that it uses // to paint. Every time it paints, it changes the value of the cell, marking the form as dirty // Clearly for these controls it is wrong to listen to the value changed event. The only // method to distinguish that control is via the fact its a real NumericUpDown control whose // parent is an DataGridView derived class var system = Assembly.GetAssembly(typeof(Form)); var dataGridView = system.GetType("System.Windows.Forms.DataGridView"); var parentType = numeric.Parent.GetType(); if (parentType.IsSubclassOf(dataGridView)) { return; } // We have filtered out numeric up down controls we don't care about // perform normal initialization now numeric.ValueChanged += owner.MakeDirty; }
//===================================================================== private static void InitializeRadioButton(BaseEditorControl owner, Control control) { var button = control as RadioButton; if (button == null) { return; } button.CheckedChanged += owner.MakeDirty; }
//===================================================================== private static void InitializePropertyGrid(BaseEditorControl owner, Control control) { var grid = control as PropertyGrid; if (grid == null) { return; } grid.PropertyValueChanged += owner.MakeDirty; }
//===================================================================== private static void InitializeCheckBox(BaseEditorControl owner, Control control) { var checkBox = control as CheckBox; if (checkBox == null) { return; } checkBox.CheckedChanged += owner.MakeDirty; checkBox.CheckStateChanged += owner.MakeDirty; }
//===================================================================== private static void InitializeComboBox(BaseEditorControl owner, Control control) { var comboBox = control as ComboBox; if (comboBox == null) { return; } comboBox.SelectedIndexChanged += owner.MakeDirty; comboBox.SelectedValueChanged += owner.MakeDirty; comboBox.ValueMemberChanged += owner.MakeDirty; }
//===================================================================== private static void InitializeAuraDataGridView(BaseEditorControl owner, Control control) { var gridView = control as AuraDataGridView; if (gridView == null) { return; } gridView.CellValueChanged += owner.MakeDirty; gridView.UserDeletedRow += owner.MakeDirty; gridView.UserAddedRow += owner.MakeDirty; gridView.RowsAdded += owner.MakeDirty; gridView.RowsRemoved += owner.MakeDirty; }
//===================================================================== private static void InitializeCheckedListBox(BaseEditorControl owner, Control control) { var listBox = control as CheckedListBox; if (listBox == null) { return; } listBox.ItemCheck += owner.MakeDirty; // These two events are work arounds for the lack of event after an item has // been checked in an item checkbox; in the validate caused by makeDirty, the // value of the CheckedItems member is outdated, and so the result of validation // is wrong. This causes validation to occur after the item check event whenever // something could have changed the check state listBox.MouseUp += owner.ReValidate; listBox.KeyUp += owner.ReValidate; }
//===================================================================== private static void InitializeTextBox(BaseEditorControl owner, Control control) { control.TextChanged += owner.MakeDirty; }
//===================================================================== private static void InitializeSequenceLinkLabel(BaseEditorControl owner, Control control) { control.TextChanged += owner.MakeDirty; }