/// <summary> /// Handles when a filter is removed from the collection. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="MapDrawFilterHelperCollectionEventArgs"/> instance containing the event data.</param> void _filterCollection_Removed(MapDrawFilterHelperCollection sender, MapDrawFilterHelperCollectionEventArgs e) { // Remove the filter from the ToolBarControl's DropDownItems FilterToolStripItem ftsi; if (!_tsFilters.TryGetValue(e.Filter, out ftsi)) { const string errmsg = "Failed to find FilterToolStripItem for filter `{0}`."; if (log.IsErrorEnabled) { log.ErrorFormat(errmsg, e.Filter); } Debug.Fail(string.Format(errmsg, e.Filter)); return; } Debug.Assert(ftsi.Filter == e.Filter); _tsFilters.Remove(e.Filter); ftsi.Dispose(); // If the filter we just got rid of was the active one, set the active filter to null if (e.Filter == _currentFilter) { _currentFilter = null; } }
/// <summary> /// Handles hwen a filter is added to the collection. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="MapDrawFilterHelperCollectionEventArgs"/> instance containing the event data.</param> void _filterCollection_Added(MapDrawFilterHelperCollection sender, MapDrawFilterHelperCollectionEventArgs e) { // Add the new filter to the ToolBarControl's DropDownItems var ftsi = new FilterToolStripItem(e.Filter, e.FilterName); ftsi.CheckedChanged += ftsi_CheckedChanged; _tsFilters.Add(e.Filter, ftsi); var s = ToolBarControl.ControlSettings.AsSplitButtonSettings(); s.DropDownItems.Insert(0, ftsi); }
/// <summary> /// Handles when a filter is removed from the collection. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="MapDrawFilterHelperCollectionEventArgs"/> instance containing the event data.</param> void _filterCollection_Removed(MapDrawFilterHelperCollection sender, MapDrawFilterHelperCollectionEventArgs e) { // Remove the filter from the ToolBarControl's DropDownItems FilterToolStripItem ftsi; if (!_tsFilters.TryGetValue(e.Filter, out ftsi)) { const string errmsg = "Failed to find FilterToolStripItem for filter `{0}`."; if (log.IsErrorEnabled) log.ErrorFormat(errmsg, e.Filter); Debug.Fail(string.Format(errmsg, e.Filter)); return; } Debug.Assert(ftsi.Filter == e.Filter); _tsFilters.Remove(e.Filter); ftsi.Dispose(); // If the filter we just got rid of was the active one, set the active filter to null if (e.Filter == _currentFilter) _currentFilter = null; }
/// <summary> /// Handles hwen a filter is added to the collection. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="MapDrawFilterHelperCollectionEventArgs"/> instance containing the event data.</param> void _filterCollection_Added(MapDrawFilterHelperCollection sender, MapDrawFilterHelperCollectionEventArgs e) { // Add the new filter to the ToolBarControl's DropDownItems var ftsi = new FilterToolStripItem(e.Filter, e.FilterName); ftsi.CheckedChanged += ftsi_CheckedChanged; _tsFilters.Add(e.Filter, ftsi); var s = ToolBarControl.ControlSettings.AsSplitButtonSettings(); s.DropDownItems.Insert(0, ftsi); }