예제 #1
0
        internal static frmWebBrowser CreateAndBrowse(string caption, string url)
        {
            int?windowNo = Numerator.NextNumber;

            if (!windowNo.HasValue)
            {
                _instanceCnt++;
                windowNo = _instanceCnt;
            }

            frmWebBrowser frm        = new frmWebBrowser();
            string        tmpCaption = String.Format("WebBrowser {0}", windowNo);

            if (!String.IsNullOrEmpty(caption))
            {
                tmpCaption = caption;
            }

            frm.Text     = tmpCaption;
            frm.TabText  = tmpCaption;
            frm.WindowNo = windowNo;

            string tmpUrl = url;

            if (String.IsNullOrEmpty(url) && ConfigHelper.Current != null && ConfigHelper.Current.GeneralOptions != null)
            {
                tmpUrl = ConfigHelper.Current.GeneralOptions.WebBrowser_HomeUrl;
            }


            //if (String.IsNullOrEmpty(url))
            //{
            //  if (ConfigHelper.Current != null && ConfigHelper.Current.GeneralOptions != null)
            //  {
            //    tmpUrl = ConfigHelper.Current.GeneralOptions.WebBrowser_HomeUrl;
            //    if (String.IsNullOrEmpty(tmpUrl))
            //    {
            //      tmpUrl = Properties.Resources.DefaultHomePage;
            //    }
            //  }
            //  else
            //  {
            //    tmpUrl = Properties.Resources.DefaultHomePage;
            //  }
            //}

            if (!String.IsNullOrEmpty(tmpUrl))
            {
                frm.ManualNavigate(tmpUrl);
            }

            return(frm);
        }