public TimeSheetTypeEditorControl(TimeSheetType tsType) { InitializeComponent(); this.Value = tsType; this.Load += (s, e) => { var catalogDataSource = MethodHelper .EnumToListKeyValuePair <TimeSheetCatalog>() .Filter(kv => ((KeyValuePair <string, TimeSheetCatalog>)kv).Value == this.Value.Catalog); this.catalogComboBox.DataSource = catalogDataSource; this.catalogComboBox.DisplayMember = "Key"; this.catalogComboBox.ValueMember = "Value"; this.timeSheetTypeBindingSource.DataSource = this.Value; }; this.btnUpdate.Click += (s, e) => { OnValueUpdated(); this.Hide(); }; }
public TimeSheetTypeEditorForm(TimeSheetType tsType) { InitializeComponent(); this.Value = tsType; this.Paint += (s, e) => { using (Pen pen = new Pen(Color.Black, 2)) { e.Graphics.DrawRectangle(pen, e.ClipRectangle); } }; this.Load += (s, e) => { var catalogDataSource = MethodHelper .EnumToListKeyValuePair <TimeSheetCatalog>() .Filter(kv => ((KeyValuePair <string, TimeSheetCatalog>)kv).Value == this.Value.Catalog); this.catalogComboBox.DataSource = catalogDataSource; this.catalogComboBox.DisplayMember = "Key"; this.catalogComboBox.ValueMember = "Value"; this.timeSheetTypeBindingSource.DataSource = this.Value; }; this.btnUpdate.Click += (s, e) => { ClosePopup(); _valueChanged = true; this.EditingControlDataGridView.NotifyCurrentCellDirty(true); OnValueUpdated(); }; }