private void OnAfterLabelEdit(Object sender, NodeLabelEditEventArgs e)
        {
            // null still returned if label unmodified (verified 2310)
            if (e.Label == null)
            {
                return;
            }

            String oldLabel = e.Node.Text;
            String newLabel = e.Label;

            bool labelIsLegal = true;

            if (!DeviceFilterEditorDialog.NewLabelIsLegal(
                    _designer.UnderlyingControl.Site,
                    _appliedFiltersList,
                    oldLabel,
                    newLabel,
                    SR.GetString(SR.AppliedDeviceFiltersDialog_Title)
                    ))
            {
                labelIsLegal = false;
            }
            else if (IsDefaultFilter(newLabel))
            {
                GenericUI.ShowWarningMessage(
                    SR.GetString(SR.AppliedDeviceFiltersDialog_Title),
                    SR.GetString(SR.DeviceFilterEditorDialog_IllegalDefaultName)
                    );
                labelIsLegal = false;
            }

            if (!labelIsLegal)
            {
                e.CancelEdit = true;
                return;
            }

            ((ChoiceTreeNode)e.Node).Name = newLabel;
            EnsureDefaultFilterAvailableXorApplied();
            SetDirty(true);
            UpdateUI();
        }
        private void OnEditFilters(Object sender, EventArgs e)
        {
            if (!ValidateAppliedFilters())
            {
                return;
            }
            DeviceFilterEditorDialog dialog = null;

            try
            {
                try
                {
                    dialog = new DeviceFilterEditorDialog(
                        _designer.UnderlyingControl.Site,
                        _webConfig
                        );
                }
                catch (TargetInvocationException ex)
                {
                    throw ex.InnerException;
                }
            }
            catch (CheckoutException ex)
            {
                if (ex == CheckoutException.Canceled)
                {
                    return;
                }
                throw;
            }
            catch (FileLoadException)
            {
                // This is how the constructor tells us it failed to read
                // web.config.
                return;
            }

            if (AvailableFilterIsSelected)
            {
                dialog.SelectFilterByName(_cbAvailableFilters.Text);
            }
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                Cursor oldCursor = null;
                try
                {
                    oldCursor   = this.Cursor;
                    this.Cursor = Cursors.WaitCursor;

                    // Fix for # 4667
                    // if (_currentDeviceSpecificID != null)
                    //{
                    LoadAvailableFilters();
                    //}
                    SaveChoices();
                    SetDirty(false);
                }
                finally
                {
                    this.Cursor = oldCursor;
                }
            }
        }
        private void OnEditFilters(Object sender, EventArgs e)
        {
            if(!ValidateAppliedFilters())
            {
                return;
            }
            DeviceFilterEditorDialog dialog = null;

            try
            {
                try
                {
                    dialog = new DeviceFilterEditorDialog(
                        _designer.UnderlyingControl.Site,
                        _webConfig
                        );
                }
                catch (TargetInvocationException ex)
                {
                    throw ex.InnerException;
                }
            }
            catch (CheckoutException ex)
            {
                if (ex == CheckoutException.Canceled)
                {
                    return;
                }
                throw;
            }
            catch (FileLoadException)
            {
                // This is how the constructor tells us it failed to read
                // web.config.
                return;
            }
            
            if(AvailableFilterIsSelected)
            {
                dialog.SelectFilterByName(_cbAvailableFilters.Text);
            }
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                Cursor oldCursor = null;
                try
                {
                    oldCursor = this.Cursor;
                    this.Cursor = Cursors.WaitCursor;

                    // Fix for # 4667
                    // if (_currentDeviceSpecificID != null)
                    //{
                    LoadAvailableFilters();
                    //}
                    SaveChoices();
                    SetDirty(false);
                }
                finally
                {
                    this.Cursor = oldCursor;
                }
            }
        }