private void control_SelectedIndexChanged(object sender, EventArgs e) { ComboBoxEx box = sender as ComboBoxEx; if (box == null) { return; } // Get the other CB on this row, then re-sort its items. int row = gridControl.IndexOf(box); var boxes = gridControl.GetControlFrom <ComboBox>(row); // If this is the last row and it now has both columns set, // add a new blank row if (row == gridControl.ItemCount - 1 && boxes.Left.SelectedIndex > -1 && boxes.Right.SelectedIndex > -1) { // By default the remove button in the empty row is disabled. // Now that the row has data, enable it. gridControl.GetButtonFrom(row).Enabled = true; AddEmptyRow(); } // Only trigger the event if both sides are set to something. // Otherwise, only half the mapping is set, and nothing will // have actually changed yet. if (boxes.Left.SelectedIndex > -1 && boxes.Right.SelectedIndex > -1) { MappingsChanged.RaiseEventEx(this); } }
void cbTable_SelectedIndexChanged(object sender, EventArgs e) { // Clear the mappings Mappings = new List <ColumnPropertyMapping>(); FromTableChanged.RaiseEventEx(this); MappingsChanged.RaiseEventEx(this); }
public void SetProjectionMappings(string secondaryContent, IReadOnlyList <ProjectionMapping> mappings) { // Changing projections can move caret to a visible area unexpectedly. // Save caret position so we can place it at the same location when // projections are re-established. SaveViewPosition(); var secondarySpans = CreateSecondarySpans(secondaryContent, mappings); if (IdenticalSpans(secondarySpans)) { return; } // While we are changing mappings map everything to the view mappings = mappings ?? new List <ProjectionMapping>(); MapEverythingToView(); // Now update language spans ContainedLanguageBuffer.ReplaceSpans(0, ContainedLanguageBuffer.CurrentSnapshot.SpanCount, secondarySpans, EditOptions.DefaultMinimalChange, this); if (secondarySpans.Count > 0) { // Update primary (view) buffer projected spans. View buffer spans are all tracking spans: // they either come from primary content or secondary content. Inert spans do not participate. var viewSpans = CreateViewSpans(mappings); if (viewSpans.Count > 0) { ViewBuffer.ReplaceSpans(0, ViewBuffer.CurrentSnapshot.SpanCount, viewSpans, EditOptions.DefaultMinimalChange, this); } } RestoreViewPosition(); MappingsChanged?.Invoke(this, EventArgs.Empty); }
async void RaiseMappingsChangedAsync() { if (MappingsChanged != null) { await new ThreadSwitcher(); MappingsChanged.Invoke(this, EventArgs.Empty); } }
async void RaiseMappingsChangedAsync() { if (MappingsChanged != null) { await MainLoop.SwitchThread(); MappingsChanged.Invoke(this, EventArgs.Empty); } }
async void RaiseMappingsChangedAsync() { if (MappingsChanged == null) { return; } await MainLoop.SwitchToThreadpool(); MappingsChanged?.Invoke(this, EventArgs.Empty); }
private void removeButton_Click(object sender, EventArgs e) { Button button = sender as Button; if (button == null) { return; } int row = gridControl.IndexOf(button); gridControl.RemoveRow(row); MappingsChanged.RaiseEventEx(this); }
void cbEntity_SelectedIndexChanged(object sender, EventArgs e) { Mappings = new List <ColumnPropertyMapping>(); ToEntityChanged.RaiseEventEx(this); MappingsChanged.RaiseEventEx(this); }
private static void RaiseMappingsChangedEvent() { PopulateMappingLists(); SaveMappings(); MappingsChanged?.Invoke(null, null); }