Пример #1
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (context != null && context.Instance != null && provider != null)
     {
         IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
         if (edSvc != null)
         {
             LimnorWebApp wapp = context.Instance as LimnorWebApp;
             if (wapp == null)
             {
                 ClassPointer cp = context.Instance as ClassPointer;
                 if (cp != null)
                 {
                     wapp = cp.ObjectInstance as LimnorWebApp;
                 }
             }
             if (wapp != null)
             {
                 Form         frmOwner = null;
                 Type         t        = edSvc.GetType();
                 PropertyInfo pif0     = t.GetProperty("OwnerGrid");
                 if (pif0 != null)
                 {
                     object       g  = pif0.GetValue(edSvc, null);
                     PropertyGrid pg = g as PropertyGrid;
                     if (pg != null)
                     {
                         frmOwner = pg.FindForm();
                     }
                 }
                 DialogProjectOutput dlg = new DialogProjectOutput();
                 dlg.LoadData(wapp.Project, wapp.TestWebSiteName(frmOwner));
                 if (edSvc.ShowDialog(dlg) == System.Windows.Forms.DialogResult.OK)
                 {
                     if (dlg.WebSite != null)
                     {
                         value            = dlg.WebSite.WebName;
                         wapp.WebSiteName = dlg.WebSite.WebName;
                     }
                 }
             }
         }
     }
     return(value);
 }
 public SessionVariableCollection(LimnorWebApp owner)
 {
     _owner = owner;
 }
Пример #3
0
 public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
 {
     if (context != null && context.Instance != null && provider != null)
     {
         IWindowsFormsEditorService edSvc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
         if (edSvc != null)
         {
             SessionVariable           sv  = context.Instance as SessionVariable;
             SessionVariableCollection svc = context.Instance as SessionVariableCollection;
             if (svc == null)
             {
                 LimnorWebApp wa = context.Instance as LimnorWebApp;
                 if (wa != null)
                 {
                     svc = wa.GlobalVariables;
                 }
                 else
                 {
                     SessionVariableCollection.PropertyDescriptorNewSessionVariable psdv = context.PropertyDescriptor as SessionVariableCollection.PropertyDescriptorNewSessionVariable;
                     if (psdv != null)
                     {
                         svc = psdv.Owner;
                     }
                     else
                     {
                         SessionVariableCollection.PropertyDescriptorSessionVariable psdv0 = context.PropertyDescriptor as SessionVariableCollection.PropertyDescriptorSessionVariable;
                         if (psdv0 != null)
                         {
                             svc = psdv0.Owner;
                         }
                     }
                 }
             }
             if (svc != null)
             {
                 DlgSessionVariable dlg = new DlgSessionVariable();
                 dlg.LoadData(svc, sv);
                 if (edSvc.ShowDialog(dlg) == System.Windows.Forms.DialogResult.OK)
                 {
                     if (sv != null)
                     {
                         sv.Name  = dlg.Return.Name;
                         sv.Value = dlg.Return.Value;
                     }
                     else
                     {
                         svc.Add(dlg.Return);
                     }
                     value = dlg.Return;
                     IDevClassReferencer dcr = svc.Owner as IDevClassReferencer;
                     if (dcr != null)
                     {
                         IDevClass dc = dcr.GetDevClass();
                         if (dc != null)
                         {
                             dc.NotifyChange(dcr, context.PropertyDescriptor.Name);
                         }
                     }
                 }
             }
         }
     }
     return(value);
 }