コード例 #1
0
        public static VirtualWebDir CreateWebSite(LimnorProject project, string websitename, Form owner)
        {
            bool          iisError = false;
            VirtualWebDir webSite  = project.GetTestWebSite(owner);

            if (webSite == null)
            {
                webSite = IisUtility.FindLocalWebSiteByName(owner, websitename, out iisError);
            }
            if (webSite == null && !iisError)
            {
                webSite = IisUtility.FindLocalWebSite(websitename);
                if (webSite == null)
                {
                    //create the web site
                    DialogProjectOutput dlg = new DialogProjectOutput();
                    dlg.LoadData(project, websitename);
                    if (dlg.ShowDialog(owner) == DialogResult.OK)
                    {
                        if (dlg.WebSite != null)
                        {
                            webSite = dlg.WebSite;
                        }
                    }
                }
            }
            return(webSite);
        }
コード例 #2
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);
 }