public override void Run()
 {
     if (this.Owner is GridPanel)
     {
         object focusRow = (this.Owner as GridPanel).GetFocusRow();
         if (focusRow != null)
         {
             PropertyInfo property = focusRow.GetType().GetProperty(this.PropertyName);
             if (property != null)
             {
                 GridAttribute ga = null;
                 DisplayNameAttribute attribute2 = null;
                 foreach (Attribute attribute3 in property.GetCustomAttributes(false))
                 {
                     if (attribute3 is GridAttribute)
                     {
                         ga = (GridAttribute) attribute3;
                     }
                     if (attribute3 is DisplayNameAttribute)
                     {
                         attribute2 = (DisplayNameAttribute) attribute3;
                     }
                 }
                 if (ga != null)
                 {
                     GridPanel gp = new GridPanel(ga, property.GetValue(focusRow, null));
                     GridDialog dialog = new GridDialog(gp);
                     dialog.Text = attribute2.DisplayName;
                     dialog.Show();
                 }
             }
         }
     }
 }
Esempio n. 2
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     IWindowsFormsEditorService service = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService;
     if (service != null)
     {
         GridAttribute ga = null;
         DisplayNameAttribute attribute2 = null;
         foreach (Attribute attribute3 in context.PropertyDescriptor.Attributes)
         {
             if (attribute3 is GridAttribute)
             {
                 ga = (GridAttribute) attribute3;
             }
             if (attribute3 is DisplayNameAttribute)
             {
                 attribute2 = (DisplayNameAttribute) attribute3;
             }
         }
         if (ga != null)
         {
             GridPanel gp = new GridPanel(ga, value);
             GridDialog dialog = new GridDialog(gp);
             dialog.Text = attribute2.DisplayName;
             service.ShowDialog(dialog);
         }
     }
     return value;
 }