Esempio n. 1
0
        private void OnClickEditStylesButton(Object source, EventArgs e)
        {
            StylesEditorDialog dialog;

            try
            {
                dialog = new StylesEditorDialog(
                    _styleSheet,
                    this,
                    (null != _tmpCurrentStyle) ? _tmpCurrentStyle.Name : null
                    );
            }
            catch (ArgumentException ex)
            {
                Debug.Fail(ex.ToString());
                // Block user from entering StylesEditorDialog until they fix
                // duplicate style declarations.
                return;
            }

            StylesEditorDialog.StyleRenamedEventHandler renameHandler =
                new StylesEditorDialog.StyleRenamedEventHandler(OnStyleRenamedInEditor);
            StylesEditorDialog.StyleDeletedEventHandler deleteHandler =
                new StylesEditorDialog.StyleDeletedEventHandler(OnStyleDeletedInEditor);
            dialog.StyleRenamed += renameHandler;
            dialog.StyleDeleted += deleteHandler;
            try
            {
                _deviceSpecificEditor.BeginExternalDeviceSpecificEdit();
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    _deviceSpecificEditor.EndExternalDeviceSpecificEdit(
                        true /* commit changes */);
                    OnInternalChange();

                    ((IDeviceSpecificDesigner)this).RefreshHeader(0);
                    // using mergingContext 0 because this implementation does not use the param.
                    if (_mergedUI.CbStyles.Items.Count == 0)
                    {
                        _deviceSpecificEditor.Refresh(null, null); // force the clean up and
                        // disabling of the filter controls.
                        _tmpCurrentStyle = null;
                    }

                    _deviceSpecificEditor.UnderlyingObjectsChanged();
                }
                else
                {
                    _deviceSpecificEditor.EndExternalDeviceSpecificEdit(
                        false /* do not commit changes */);
                }
            }
            finally
            {
                dialog.StyleRenamed -= renameHandler;
                dialog.StyleDeleted -= deleteHandler;
            }
        }
        private void OnClickEditStylesButton(Object source, EventArgs e)
        {

            StylesEditorDialog dialog;
            
            try
            {
                dialog = new StylesEditorDialog(
                    _styleSheet,
                    this,
                    (null != _tmpCurrentStyle) ? _tmpCurrentStyle.Name : null
                );
            }
            catch(ArgumentException ex)
            {
                Debug.Fail(ex.ToString());
                // Block user from entering StylesEditorDialog until they fix
                // duplicate style declarations.
                return;
            }
            
            StylesEditorDialog.StyleRenamedEventHandler renameHandler =
                new StylesEditorDialog.StyleRenamedEventHandler(OnStyleRenamedInEditor);
            StylesEditorDialog.StyleDeletedEventHandler deleteHandler =
                new StylesEditorDialog.StyleDeletedEventHandler(OnStyleDeletedInEditor);
            dialog.StyleRenamed += renameHandler;
            dialog.StyleDeleted += deleteHandler;
            try
            {
                _deviceSpecificEditor.BeginExternalDeviceSpecificEdit();
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    _deviceSpecificEditor.EndExternalDeviceSpecificEdit(
                        true /* commit changes */ );
                    OnInternalChange();

                    ((IDeviceSpecificDesigner) this).RefreshHeader(0);
                    // using mergingContext 0 because this implementation does not use the param.
                    if (_mergedUI.CbStyles.Items.Count == 0)
                    {
                        _deviceSpecificEditor.Refresh(null, null); // force the clean up and 
                        // disabling of the filter controls.
                        _tmpCurrentStyle = null;
                    }

                    _deviceSpecificEditor.UnderlyingObjectsChanged();
                }
                else
                {
                    _deviceSpecificEditor.EndExternalDeviceSpecificEdit(
                        false /* do not commit changes */ );
                }
            }
            finally
            {
               dialog.StyleRenamed -= renameHandler;
               dialog.StyleDeleted -= deleteHandler;
            }
        }