/// <summary>
        /// Edits the specified object's value.
        /// </summary>
        /// <param name="designer"></param>
        /// <param name="objectToChange"></param>
        /// <param name="propName"></param>
        /// <returns></returns>
        public static object EditValue(ComponentDesigner designer, object objectToChange, string propName)
        {
            // Get PropertyDescriptor
            PropertyDescriptor descriptor = TypeDescriptor.GetProperties(objectToChange)[propName];

            // Create a Context
            NuGenEditorServiceContext context = new NuGenEditorServiceContext(designer, descriptor);

            // Get Editor
            UITypeEditor editor = descriptor.GetEditor(typeof(UITypeEditor)) as UITypeEditor;

            // Get value to edit
            object value = descriptor.GetValue(objectToChange);

            // Edit value
            object newValue = editor.EditValue(context, context, value);

            if (newValue != value)
            {
                try
                {
                    descriptor.SetValue(objectToChange, newValue);
                }
                catch (CheckoutException)
                {

                }
            }

            return newValue;
        }
 internal EditorServiceContext(
     ComponentDesigner designer,
     PropertyDescriptor prop,
     string newVerbText)
     : this(designer, prop)
 {
     this._designer.Verbs.Add(new DesignerVerb(
         newVerbText,
         new EventHandler(this.OnEditItems)));
 }
示例#3
0
 internal EditorServiceContext(ComponentDesigner designer, PropertyDescriptor prop)
 {
     this._designer = designer;
     this._targetProperty = prop;
     if (prop != null)
         return;
     prop = TypeDescriptor.GetDefaultProperty((object)designer.Component);
     if (prop == null || !typeof(ICollection).IsAssignableFrom(prop.PropertyType))
         return;
     this._targetProperty = prop;
 }
示例#4
0
 internal EditorServiceContext(ComponentDesigner designer, PropertyDescriptor prop)
 {
     _designer = designer;
     _targetProperty = prop;
     if (prop == null)
     {
         prop = TypeDescriptor.GetDefaultProperty(designer.Component);
         if ((prop != null) &&
             typeof(ICollection).IsAssignableFrom(prop.PropertyType))
         {
             _targetProperty = prop;
         }
     }
 }
    /// <summary>
    /// Initialize the designer by creating a SqlDataAdapterDesigner and delegating most of our
    /// functionality to it.
    /// </summary>
    /// <param name="component"></param>
    public override void Initialize(IComponent component)
    {
      base.Initialize(component);

      // Initialize a SqlDataAdapterDesigner through reflection and set it up to work on our behalf
      if (NpgsqlDataAdapterToolboxItem._vsdesigner != null)
      {
        Type type = NpgsqlDataAdapterToolboxItem._vsdesigner.GetType("Microsoft.VSDesigner.Data.VS.SqlDataAdapterDesigner");
        if (type != null)
        {
          _designer = (ComponentDesigner)Activator.CreateInstance(type);
          _designer.Initialize(component);
        }
      }
    }
        /// <summary>
        /// Initializes a new instance of the <see cref="EditorServiceContext"/> class.
        /// </summary>
        /// <param name="designer">The designer.</param>
        /// <param name="prop">A property descriptor.</param>
        internal NuGenEditorServiceContext(ComponentDesigner designer, PropertyDescriptor prop)
        {
            _designer = designer;
            _targetProperty = prop;

            if (prop == null)
            {
                prop = TypeDescriptor.GetDefaultProperty(designer.Component);
                if (prop != null && typeof(ICollection).IsAssignableFrom(prop.PropertyType))
                {
                    _targetProperty = prop;
                }
            }

            Debug.Assert(_targetProperty != null, "Need PropertyDescriptor for ICollection property to associate collectoin edtior with.");
        }
 public static object EditValue(ComponentDesigner designer, object objectToChange, string propName)
 {
     PropertyDescriptor prop = TypeDescriptor.GetProperties(objectToChange)[propName];
     EditorServiceContext context = new EditorServiceContext(designer, prop);
     UITypeEditor editor = prop.GetEditor(typeof(UITypeEditor)) as UITypeEditor;
     object obj2 = prop.GetValue(objectToChange);
     object obj3 = editor.EditValue(context, context, obj2);
     if (obj3 != obj2)
     {
         try
         {
             prop.SetValue(objectToChange, obj3);
         }
         catch (CheckoutException)
         {
         }
     }
     return obj3;
 }
 internal CollectionEditVerbManager(string text, ComponentDesigner designer, PropertyDescriptor prop, bool addToDesignerVerbs)
 {
     this._designer = designer;
     this._targetProperty = prop;
     if (prop == null)
     {
         prop = TypeDescriptor.GetDefaultProperty(designer.Component);
         if ((prop != null) && typeof(ICollection).IsAssignableFrom(prop.PropertyType))
         {
             this._targetProperty = prop;
         }
     }
     if (text == null)
     {
         text = System.Design.SR.GetString("ToolStripItemCollectionEditorVerb");
     }
     this._editItemsVerb = new DesignerVerb(text, new EventHandler(this.OnEditItems));
     if (addToDesignerVerbs)
     {
         this._designer.Verbs.Add(this._editItemsVerb);
     }
 }
示例#9
0
        public static DialogResult ShowDialog(this ComponentDesigner designer, Form dialog)
        {
            var context = new EditorServiceContext(designer);

            return(context.ShowDialog(dialog));
        }
示例#10
0
        public static IDictionary <string, List <Attribute> > GetRedirectedProperties(this ComponentDesigner d)
        {
            var ret = new Dictionary <string, List <Attribute> >();

            foreach (var prop in d.GetType().GetProperties(allInstBind))
            {
                foreach (RedirectedDesignerPropertyAttribute attr in prop.GetCustomAttributes(typeof(RedirectedDesignerPropertyAttribute), false))
                {
                    List <Attribute> attributes;
                    if (attr.ApplyOtherAttributes)
                    {
                        attributes = new List <Attribute>(Array.ConvertAll(prop.GetCustomAttributes(false), o => o as Attribute));
                        attributes.RemoveAll(a => a is RedirectedDesignerPropertyAttribute);
                    }
                    else
                    {
                        attributes = new List <Attribute>();
                    }
                    ret.Add(prop.Name, attributes);
                }
            }
            return(ret);
        }
		/// <summary>
		/// Initializes a new instance of the <see cref="NuGenCollectionEditorServiceContext"/> class.
		/// </summary>
		/// <exception cref="ArgumentNullException">
		/// <para><paramref name="designer"/> is <see langword="null"/>.</para>
		/// </exception>
		public NuGenCollectionEditorServiceContext(ComponentDesigner designer, PropertyDescriptor prop)
		{
			if (designer == null)
			{
				throw new ArgumentNullException("designer");
			}

			_designer = designer;
			_targetProperty = prop;

			if (prop == null)
			{
				prop = TypeDescriptor.GetDefaultProperty(designer.Component);

				if ((prop != null) && typeof(ICollection).IsAssignableFrom(prop.PropertyType))
				{
					_targetProperty = prop;
				}
			}
		}
		/// <summary>
		/// </summary>
		/// <param name="designer"></param>
		/// <param name="objectToChange"></param>
		/// <param name="propName"></param>
		/// <returns></returns>
		public static object EditValue(ComponentDesigner designer, object objectToChange, string propName)
		{
			PropertyDescriptor descriptor = TypeDescriptor.GetProperties(objectToChange)[propName];
			NuGenCollectionEditorServiceContext context = new NuGenCollectionEditorServiceContext(designer, descriptor);
			UITypeEditor editor = descriptor.GetEditor(typeof(UITypeEditor)) as UITypeEditor;
			object oldValue = descriptor.GetValue(objectToChange);
			object newValue = editor.EditValue(context, context, oldValue);
			
			if (newValue != oldValue)
			{
				try
				{
					descriptor.SetValue(objectToChange, newValue);
				}
				catch (CheckoutException)
				{
				}
			}

			return newValue;
		}
 private void EditValue(ComponentDesigner componentDesigner, IComponent iComponent, string propertyName) {
     // One more complication. The ListViewActionList classes uses an internal class, EditorServiceContext, to 
     // edit the items/columns/groups collections. So, we use reflection to bypass the data hiding.
     Type tEditorServiceContext = Type.GetType("System.Windows.Forms.Design.EditorServiceContext, System.Design");
     tEditorServiceContext.InvokeMember("EditValue", BindingFlags.InvokeMethod | BindingFlags.Static, null, null, new object[] { componentDesigner, iComponent, propertyName });
 }
 public WindowsFormsEditorServiceHelper(ComponentDesigner componentDesigner)
 {
     this._componentDesigner = componentDesigner;
 }
 public ListControlUnboundActionList(ComponentDesigner designer) : base(designer.Component)
 {
     this._designer = designer;
 }
 public LocalizableStringsActionList(ComponentDesigner designer) :
     base(designer.Component)
 {
     this.designer = designer;
 }
示例#17
0
 /// <summary>
 ///  Invokes the get inheritance attribute of the specified ComponentDesigner.
 /// </summary>
 protected InheritanceAttribute InvokeGetInheritanceAttribute(ComponentDesigner toInvoke)
 => toInvoke?.InheritanceAttribute;
 /// <summary>
 /// Initializes a new instance of the <see cref="EditorServiceContext"/> class.
 /// </summary>
 /// <param name="designer">The designer.</param>
 internal NuGenEditorServiceContext(ComponentDesigner designer)
 {
     _designer = designer;
 }
示例#19
0
 internal static object EditValue(ComponentDesigner designer, object objectToChange, string propName)
 {
     Type t = Type.GetType("System.Windows.Forms.Design.EditorServiceContext");
     if (t == null) t = Type.GetType("System.Windows.Forms.Design.EditorServiceContext, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
     if (t != null)
     {
         MethodInfo mi = t.GetMethod("EditValue");
         if (mi != null)
             return mi.Invoke(null, new object[] { designer, objectToChange, propName });
     }
     return null;
 }
 protected System.ComponentModel.InheritanceAttribute InvokeGetInheritanceAttribute(ComponentDesigner toInvoke)
 {
     return toInvoke.InheritanceAttribute;
 }
示例#21
0
 public CDDesignerCommandSet(ComponentDesigner componentDesigner)
 {
     _componentDesigner = componentDesigner;
 }
 internal ShadowPropertyCollection(ComponentDesigner designer)
 {
     this.designer = designer;
 }
 // Methods
 public ListViewActionList(ComponentDesigner designer)
     : base(designer.Component) {
     this._designer = designer;
 }
 public ListBoxItem(FilterColumn column, FilterColumnCollectionDialog owner, ComponentDesigner compDesigner)
 {
     this.column = column;
     this.owner = owner;
     this.compDesigner = compDesigner;
     if (this.compDesigner != null)
     {
         this.compDesigner.Initialize(column);
         TypeDescriptor.CreateAssociation(this.column, this.compDesigner);
     }
     ToolboxBitmapAttribute attribute = TypeDescriptor.GetAttributes(column)[FilterColumnCollectionDialog.toolboxBitmapAttributeType] as ToolboxBitmapAttribute;
     if (attribute != null)
     {
         this.toolboxBitmap = attribute.GetImage(column, false);
     }
     else
     {
         this.toolboxBitmap = this.owner.SelectedColumnsItemBitmap;
     }
     FilterColumnDesigner designer = compDesigner as FilterColumnDesigner;
     if (designer != null)
     {
         designer.LiveFilterControl = this.owner.liveFilterControl;
     }
 }
        void EditExpressionButtonClick()
        {
            try
            {
            #if DENALI
                packageDesigner = (ComponentDesigner)variablesToolWindowControl.GetType().GetProperty("PackageDesigner", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.FlattenHierarchy | System.Reflection.BindingFlags.Instance).GetValue(variablesToolWindowControl, null);
            #else
                packageDesigner = (ComponentDesigner)variablesToolWindowControl.GetType().InvokeMember("PackageDesigner", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.FlattenHierarchy | System.Reflection.BindingFlags.Instance, null, variablesToolWindowControl, null);
            #endif

                if (packageDesigner == null) return;

                Package package = packageDesigner.Component as Package;
                if (package == null) return;

                int selectedRow;
                int selectedCol;
                grid.GetSelectedCell(out selectedRow, out selectedCol);

                if (selectedRow < 0) return;

                Variable variable = GetVariableForRow(selectedRow);

                if (variable == null) return;

                DtsContainer sourceContainer = FindObjectForVariablePackagePath(package, variable.GetPackagePath());
                Variables variables = sourceContainer.Variables;
                VariableDispenser variableDispenser = sourceContainer.VariableDispenser;

                Konesans.Dts.ExpressionEditor.ExpressionEditorPublic editor = new Konesans.Dts.ExpressionEditor.ExpressionEditorPublic(variables, variableDispenser, variable);
                if (editor.ShowDialog() == DialogResult.OK)
                {
                    string expression = editor.Expression;
                    if (string.IsNullOrEmpty(expression) || string.IsNullOrEmpty(expression.Trim()))
                    {
                        expression = null;
                        variable.EvaluateAsExpression = false;
                    }
                    else
                    {
                        variable.EvaluateAsExpression = true;
                    }

                    variable.Expression = expression;
                    changesvc.OnComponentChanging(sourceContainer, null);
                    changesvc.OnComponentChanged(sourceContainer, null, null, null); //marks the package designer as dirty
                    SSISHelpers.MarkPackageDirty(package);

                    TypeDescriptor.Refresh(variable);
                    System.Windows.Forms.Application.DoEvents();

                    // Refresh the grid
                    variablesToolWindowControl.GetType().InvokeMember("FillGrid", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.FlattenHierarchy | System.Reflection.BindingFlags.Instance, null, variablesToolWindowControl, new object[] { });
                    SetButtonEnabled();
                    RefreshHighlights();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n\r\n" + ex.StackTrace);
            }
        }
 public CDDesignerCommandSet(ComponentDesigner componentDesigner) {
     this.componentDesigner = componentDesigner;
 }
 public ListBoxItem(System.Windows.Forms.DataGridViewColumn column, DataGridViewColumnCollectionDialog owner, ComponentDesigner compDesigner)
 {
     this.column = column;
     this.owner = owner;
     this.compDesigner = compDesigner;
     if (this.compDesigner != null)
     {
         this.compDesigner.Initialize(column);
         TypeDescriptor.CreateAssociation(this.column, this.compDesigner);
     }
     ToolboxBitmapAttribute attribute = TypeDescriptor.GetAttributes(column)[DataGridViewColumnCollectionDialog.toolboxBitmapAttributeType] as ToolboxBitmapAttribute;
     if (attribute != null)
     {
         this.toolboxBitmap = attribute.GetImage(column, false);
     }
     else
     {
         this.toolboxBitmap = this.owner.SelectedColumnsItemBitmap;
     }
     System.Windows.Forms.Design.DataGridViewColumnDesigner designer = compDesigner as System.Windows.Forms.Design.DataGridViewColumnDesigner;
     if (designer != null)
     {
         designer.LiveDataGridView = this.owner.liveDataGridView;
     }
 }
		/// <summary>
		/// Initializes a new instance of the <see cref="NuGenCollectionEditorServiceContext"/> class.
		/// </summary>
		public NuGenCollectionEditorServiceContext(ComponentDesigner designer)
		{
			_designer = designer;
		}
 internal EditorServiceContext(ComponentDesigner designer)
 {
     this._designer = designer;
 }
示例#30
0
 /// <summary>
 /// Invokes the get inheritance attribute of the specified ComponentDesigner.
 /// </summary>
 protected InheritanceAttribute InvokeGetInheritanceAttribute(ComponentDesigner toInvoke)
 {
     return(toInvoke.InheritanceAttribute);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="EditorServiceContext"/> class.
 /// </summary>
 /// <param name="designer">The designer.</param>
 /// <param name="prop">A property descriptor.</param>
 /// <param name="newVerbText">A new design verb.</param>
 internal NuGenEditorServiceContext(ComponentDesigner designer, PropertyDescriptor prop, string newVerbText)
     : this(designer, prop)
 {
     Debug.Assert(!string.IsNullOrEmpty(newVerbText), "newVerbText cannot be null or empty");
     _designer.Verbs.Add(new DesignerVerb(newVerbText, new EventHandler(this.OnEditItems)));
 }
        public static void RefreshHighlights()
        {
            try
            {
                if (bSkipHighlighting) return;
                if (variablesToolWindowControl == null) return;

            #if DENALI
                packageDesigner = (ComponentDesigner)variablesToolWindowControl.GetType().GetProperty("PackageDesigner", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.FlattenHierarchy | System.Reflection.BindingFlags.Instance).GetValue(variablesToolWindowControl, null);
            #else
                packageDesigner = (ComponentDesigner)variablesToolWindowControl.GetType().InvokeMember("PackageDesigner", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.FlattenHierarchy | System.Reflection.BindingFlags.Instance, null, variablesToolWindowControl, null);
            #endif
                if (packageDesigner == null) return;

                Package package = packageDesigner.Component as Package;
                if (package == null) return;

                List<string> listConfigPaths;
                lock (HighlightingToDo.cacheConfigPaths)
                {
                    if (HighlightingToDo.cacheConfigPaths.ContainsKey(package))
                        listConfigPaths = HighlightingToDo.cacheConfigPaths[package];
                    else
                        listConfigPaths = new List<string>();
                }

                for (int iRow = 0; iRow < grid.RowsNumber; iRow++)
                {
                    GridCell cell = grid.GetCellInfo(iRow, 0);
                    if (cell.CellData != null)
                    {
                        System.Diagnostics.Debug.WriteLine(cell.CellData.GetType().FullName);
                        Variable variable = GetVariableForRow(iRow);

            #if DENALI
                        // Denali doesn't need variable highlighting, it is built in. This is a quick fix to disable the highlighting
                        // for Denali only. The other code stays the same for backward compatability when compiled as 2005 or 2008 projects.
                        // We will retain the configuration highlighting though.
                        bool bHasExpression = false;
            #else
                        bool bHasExpression = variable.EvaluateAsExpression && !string.IsNullOrEmpty(variable.Expression);
            #endif
                        bool bHasConfiguration = false;
                        string sVariablePath = variable.GetPackagePath();
                        foreach (string configPath in listConfigPaths)
                        {
                            if (configPath.StartsWith(sVariablePath))
                            {
                                bHasConfiguration = true;
                                break;
                            }
                        }

                        System.Drawing.Bitmap icon = (System.Drawing.Bitmap)cell.CellData;
                        if (!bHasExpression && !bHasConfiguration && icon.Tag != null)
                        {
                            // Reset the icon because this one doesn't have an expression anymore
                            cell.CellData = icon.Tag;
                            icon.Tag = null;

                            try
                            {
                                bSkipHighlighting = true;
                                grid.Invalidate(true);
                            }
                            finally
                            {
                                bSkipHighlighting = false;
                            }

                            System.Diagnostics.Debug.WriteLine("un-highlighted variable");
                        }
                        else if ((bHasExpression || bHasConfiguration))
                        {
                            //save what the icon looked like originally so we can go back if they remove the expression
                            if (icon.Tag == null)
                                icon.Tag = icon.Clone();

                            //now update the icon to note this one has an expression
                            if (bHasExpression && !bHasConfiguration)
                                HighlightingToDo.ModifyIcon(icon, HighlightingToDo.expressionColor);
                            else if (bHasConfiguration && !bHasExpression)
                                HighlightingToDo.ModifyIcon(icon, HighlightingToDo.configurationColor);
                            else
                                HighlightingToDo.ModifyIcon(icon, HighlightingToDo.expressionColor, HighlightingToDo.configurationColor);
                            cell.CellData = icon;

                            try
                            {
                                bSkipHighlighting = true;
                                grid.Invalidate(true);
                            }
                            finally
                            {
                                bSkipHighlighting = false;
                            }

                            System.Diagnostics.Debug.WriteLine("highlighted variable");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.Message + "\r\n\r\n" + ex.StackTrace);
            }
        }
示例#33
0
 internal ShadowPropertyCollection(ComponentDesigner designer)
 {
     _designer = designer;
 }
        void MoveCopyButtonClick()
        {
            try
            {
                List<Variable> variables = GetSelectedVariables();
                if (variables.Count > 0)
                {
                    System.Collections.ArrayList variableDesigners = GetSelectedVariableDesigners();
            #if DENALI
                    packageDesigner = (ComponentDesigner)variablesToolWindowControl.GetType().GetProperty("PackageDesigner", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.FlattenHierarchy | System.Reflection.BindingFlags.Instance).GetValue(variablesToolWindowControl, null);
            #else
                    packageDesigner = (ComponentDesigner)variablesToolWindowControl.GetType().InvokeMember("PackageDesigner", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.GetProperty | System.Reflection.BindingFlags.FlattenHierarchy | System.Reflection.BindingFlags.Instance, null, variablesToolWindowControl, null);
            #endif
                    Package package = packageDesigner.Component as Package;

                    DtsContainer oCurrentScope = FindObjectForVariablePackagePath(package, variables[0].GetPackagePath());
                    BIDSHelper.SSIS.VariablesMove form = new BIDSHelper.SSIS.VariablesMove(package, oCurrentScope.ID, variables.Count);
                    DialogResult result = form.ShowDialog();
                    if (result == DialogResult.OK)
                    {
                        DtsContainer targetContainer = form.TargetContainer;
                        bool move = form.IsMove;
                        try
                        {
                            CopyVariables(variables, move, targetContainer, package, variableDesigners);
                        }
                        finally
                        {
                            //refresh the grid after the changes we've made
                            variablesToolWindowControl.GetType().InvokeMember("FillGrid", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.FlattenHierarchy | System.Reflection.BindingFlags.Instance, null, variablesToolWindowControl, new object[] { });
                            SetButtonEnabled();
                            RefreshHighlights();
                        }
                    }
                }
                else
                {
                    MessageBox.Show("Highlight one or more variables before clicking this button.", "BIDS Helper - Variable Scope Change", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            catch (VariableCopyException ex)
            {
                MessageBox.Show(ex.Message, "BIDS Helper", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message + "\r\n\r\n" + ex.StackTrace, "BIDS Helper", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
示例#35
0
 /// <summary>
 ///     <para>
 ///         Invokes the get inheritance attribute of the specified ComponentDesigner.
 ///     </para>
 /// </summary>
 protected InheritanceAttribute InvokeGetInheritanceAttribute(ComponentDesigner toInvoke)
 {
     throw new NotImplementedException(SR.NotImplementedByDesign);
 }
示例#36
0
 internal ShadowPropertyCollection(ComponentDesigner designer)
 {
     throw new NotImplementedException(SR.NotImplementedByDesign);
 }
示例#37
0
 public static object EditValue(ComponentDesigner designer, object objectToChange, string propName)
 {
     PropertyDescriptor prop = TypeDescriptor.GetProperties(objectToChange)[propName];
     EditorServiceContext editorServiceContext = new EditorServiceContext(designer, prop);
     UITypeEditor uiTypeEditor = prop.GetEditor(typeof(UITypeEditor)) as UITypeEditor;
     object obj1 = prop.GetValue(objectToChange);
     object obj2 = uiTypeEditor.EditValue((ITypeDescriptorContext)editorServiceContext, (IServiceProvider)editorServiceContext, obj1);
     if (obj2 != obj1)
     {
         try
         {
             prop.SetValue(objectToChange, obj2);
         }
         catch (CheckoutException ex)
         {
             throw ex;
         }
     }
     return obj2;
 }
 public static object EditValue(ComponentDesigner designer, object objectToChange, string propName)
 {
     PropertyDescriptor item = TypeDescriptor.GetProperties(objectToChange)[propName];
     EditorServiceContext editorServiceContext = new EditorServiceContext(designer, item);
     UITypeEditor editor = item.GetEditor(typeof(UITypeEditor)) as UITypeEditor;
     object @value = item.GetValue(objectToChange);
     object obj = editor.EditValue(editorServiceContext, editorServiceContext, @value);
     if (obj != @value)
     {
         try
         {
             item.SetValue(objectToChange, obj);
         }
         catch (CheckoutException)
         {
         }
     }
     return obj;
 }
示例#39
0
        public static System.Windows.Forms.DialogResult ShowDialog(this ComponentDesigner designer, System.Windows.Forms.Form dialog)
        {
            EditorServiceContext context = new EditorServiceContext(designer);

            return(context.ShowDialog(dialog));
        }