Exemplo n.º 1
0
 private void opeWeb(string pUrl, string pViewModel)
 {
     if (MessageBox.Show("是否在新窗口中打开指定系统?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         string[] arg = new string[2];
         arg[0] = ConfigureHelper.getWebUrl(conf.Main, pUrl);
         arg[1] = pViewModel;
         StartProcess(System.Reflection.Assembly.GetExecutingAssembly().Location, arg);
     }
     else
     {
         this.browserControl1.WebBrowser.Navigate(ConfigureHelper.getWebUrl(conf.Main, pUrl));
     }
 }
Exemplo n.º 2
0
        public static WindowSetting GetWindowSetting(string setting)
        {
            WindowSetting inWindowSetting  = JsonConvert.DeserializeObject <WindowSetting>(setting);
            WindowSetting newWindowSetting = Global.sysConfig.WindowConfig;

            newWindowSetting.Title        = string.IsNullOrEmpty(inWindowSetting.Title) ? newWindowSetting.Title : inWindowSetting.Title;
            newWindowSetting.Fixtitle     = inWindowSetting.Fixtitle;
            newWindowSetting.Width        = inWindowSetting.Width == null ? newWindowSetting.Width : inWindowSetting.Width;
            newWindowSetting.Height       = inWindowSetting.Height == null ? newWindowSetting.Height : inWindowSetting.Height;
            newWindowSetting.Modeless     = inWindowSetting.Modeless;
            newWindowSetting.Url          = ConfigureHelper.getWebUrl(inWindowSetting.Url, "");;
            newWindowSetting.Viewmodel    = string.IsNullOrEmpty(inWindowSetting.Viewmodel) ? newWindowSetting.Viewmodel : inWindowSetting.Viewmodel;
            newWindowSetting.Fullscreen   = inWindowSetting.Fullscreen;
            newWindowSetting.Statusbar    = inWindowSetting.Statusbar;
            newWindowSetting.Resizable    = inWindowSetting.Resizable;
            newWindowSetting.Maximize     = inWindowSetting.Maximize;
            newWindowSetting.Minimize     = inWindowSetting.Minimize;
            newWindowSetting.EscKeyEnable = inWindowSetting.EscKeyEnable;
            return(newWindowSetting);
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);


            //判断是否生成配置文件
            string file = System.AppDomain.CurrentDomain.BaseDirectory + "application.ini";

            if (!File.Exists(file))
            {
                SettingForm settingForm = new SettingForm();
                settingForm.ShowDialog();
            }
            //Updater update = new Updater();
            //update.CheckUpdate();
            //获取默认的系统配置
            Global.sysConfig = ConfigureHelper.getInitConfigure();
            //判断是否指定参数
            if (args != null && args.Length > 0)
            {
                Global.sysConfig.WindowConfig.Url       = args[0];
                Global.sysConfig.WindowConfig.Viewmodel = args.Length > 1 ? args[1] : "";
            }
            else
            {
                Global.sysConfig.WindowConfig.Url       = Global.sysConfig.MainUrl;
                Global.sysConfig.WindowConfig.Viewmodel = Global.sysConfig.DefaultViewModel;
            }

            Global.sysConfig.WindowConfig.IsMainForm = true;

            /*
             * string setting = Global.sysConfig.GetSetting();
             * frmScBrowser main = new frmScBrowser(setting);
             * Global.formList.Add(main);
             * main.LoadUrl(Global.sysConfig.WindowConfig.Url, "IE11");
             * Application.Run(main);
             */
            Application.Run(new MainForm());
        }
Exemplo n.º 4
0
        private void InitApp()
        {
            conf = ConfigureHelper.getInitConfigure();
            if (conf.Kiosk)
            {
                conf.Statusbar  = false;
                conf.Toolbar    = false;
                conf.Frame      = false;
                conf.Fullscreen = true;
            }
            this.Text   = conf.Title;
            this.Width  = conf.Width.Value;
            this.Height = conf.Height.Value;
            if (conf.Min_width != null && conf.Min_height != null)
            {
                this.MinimumSize = new Size(conf.Min_width.Value, conf.Min_height.Value);
            }

            if (conf.Max_width != null && conf.Max_height != null)
            {
                this.MaximumSize = new Size(conf.Max_width.Value, conf.Max_height.Value);
            }

            if (!conf.Statusbar)
            {
                this.statusStrip1.Visible = false;
            }

            if (!conf.Resizable)
            {
                this.FormBorderStyle = FormBorderStyle.FixedSingle;
            }

            if (!conf.Show_in_taskbar)
            {
                this.ShowInTaskbar = false;
            }

            if (!conf.Frame)
            {
                this.FormBorderStyle = FormBorderStyle.None;
            }

            string position = conf.Position;

            if (position.IndexOf(",") >= 0)
            {
                this.StartPosition = FormStartPosition.Manual;
                this.Location      = new Point();
            }
            else
            {
                this.StartPosition = FormStartPosition.CenterScreen;
            }
            if (string.IsNullOrEmpty(sUrl))
            {
                foreach (ScSystem ss in conf.SysList)
                {
                    if (ss.Deflt == "Y")
                    {
                        sUrl = ConfigureHelper.getWebUrl(conf.Main, ss.Url);
                        if (string.IsNullOrEmpty(sViewModel))
                        {
                            sViewModel = ss.Viewmodel;
                        }
                        break;
                    }
                }
            }

            if (string.IsNullOrEmpty(sUrl))
            {
                sUrl = conf.Main;
            }
            if (string.IsNullOrEmpty(sViewModel))
            {
                sViewModel = "IE7";//默认IE7
            }
            tssl_version.Text = sViewModel;
            ViewModelHelper.SetViewModel((ScWebBrowser.Constants.Browser_渲染模式)Enum.Parse(typeof(ScWebBrowser.Constants.Browser_渲染模式), sViewModel));
            InitSysList();
        }
Exemplo n.º 5
0
 private void savePage3()
 {
     ConfigureHelper.SaveWebapp(sysList);
 }
Exemplo n.º 6
0
        private void InitPage3()
        {
            //初始化菜单
            int count  = int.Parse(ini.IniReadValue("webapp", "webcount", "5"));//默认5个系统
            int gIndex = 1;

            while (gIndex <= count)
            {
                ScSystem si = null;
                if (gIndex <= 5)
                {
                    si = ScSystem.GetScSystem(ini.IniReadValue("webapp", "weburl" + gIndex, ConfigureHelper.getDfltUrl(gIndex.ToString())));
                }
                else
                {
                    si = ScSystem.GetScSystem(ini.IniReadValue("webapp", "weburl" + gIndex, ""));
                }
                if (si != null)
                {
                    sysList.Add(si);
                }
                gIndex++;
            }

            InitMenu(sysList);
        }
Exemplo n.º 7
0
        /// <summary>
        /// 获取系统初始化时的系统配置
        /// </summary>
        /// <returns></returns>
        public static Configure getInitConfigure()
        {
            Configure     conf        = new Configure();
            string        sectionName = "window";
            string        file        = System.AppDomain.CurrentDomain.BaseDirectory + "application.ini";
            IniFileHelper ini         = new IniFileHelper(file);

            conf.Main = ini.IniReadValue(sectionName, "main", "about:blank");

            try
            {
                #region 默认窗体配配置
                WindowSetting windowConf = new WindowSetting();
                windowConf.Title           = ini.IniReadValue(sectionName, "title", "杭州圣辰网络科技有限公司");
                windowConf.Fixtitle        = bool.Parse(ini.IniReadValue(sectionName, "fixtitle", "false"));
                windowConf.Width           = int.Parse(ini.IniReadValue(sectionName, "width", "1024"));
                windowConf.Height          = int.Parse(ini.IniReadValue(sectionName, "height", "768"));
                windowConf.Toolbar         = bool.Parse(ini.IniReadValue(sectionName, "toolbar", "true"));
                windowConf.Statusbar       = bool.Parse(ini.IniReadValue(sectionName, "statusbar", "true"));
                windowConf.Resizable       = bool.Parse(ini.IniReadValue(sectionName, "resizable", "true"));
                windowConf.Fullscreen      = bool.Parse(ini.IniReadValue(sectionName, "fullscreen", "false"));
                windowConf.Show_in_taskbar = bool.Parse(ini.IniReadValue(sectionName, "show_in_taskbar", "true"));
                windowConf.Frame           = bool.Parse(ini.IniReadValue(sectionName, "frame", "true"));
                windowConf.Position        = ini.IniReadValue(sectionName, "position", "center");

                string min_width = ini.IniReadValue(sectionName, "min_width");
                if (!string.IsNullOrEmpty(min_width))
                {
                    windowConf.Min_width = int.Parse(min_width);
                }
                string min_height = ini.IniReadValue(sectionName, "min_height");
                if (!string.IsNullOrEmpty(min_height))
                {
                    windowConf.Min_height = int.Parse(min_height);
                }
                string max_width = ini.IniReadValue(sectionName, "max_width");
                if (!string.IsNullOrEmpty(max_width))
                {
                    windowConf.Max_width = int.Parse(max_width);
                }
                string max_height = ini.IniReadValue(sectionName, "max_height");
                if (!string.IsNullOrEmpty(max_height))
                {
                    windowConf.Max_height = int.Parse(max_height);
                }
                windowConf.Show      = bool.Parse(ini.IniReadValue(sectionName, "show", "true"));
                windowConf.Kiosk     = bool.Parse(ini.IniReadValue(sectionName, "kiosk", "false"));
                windowConf.Showerror = bool.Parse(ini.IniReadValue(sectionName, "showerror", "false"));

                conf.WindowConfig = windowConf;
                #endregion

                conf.Defaultsys       = ini.IniReadValue("scwebapp", "defaultmain", "0");
                conf.DefaultViewModel = ini.IniReadValue("scwebapp", "defaultviewmodel", Enum.GetName(typeof(ScWebBrowser.Constants.Browser_渲染模式), ScWebBrowser.Constants.Browser_渲染模式.IE7));
                int count  = int.Parse(ini.IniReadValue("webapp", "webcount", "5"));//默认5个系统
                int gIndex = 1;
                while (gIndex <= count)
                {
                    ScSystem si = null;
                    if (gIndex <= 5)
                    {
                        si = ScSystem.GetScSystem(ini.IniReadValue("webapp", "weburl" + gIndex, getDfltUrl(gIndex.ToString())));
                    }
                    else
                    {
                        si = ScSystem.GetScSystem(ini.IniReadValue("webapp", "weburl" + gIndex, ""));
                    }
                    if (si != null)
                    {
                        if (si.Deflt == "Y")
                        {
                            conf.MainUrl          = ConfigureHelper.getWebUrl(conf.Main, si.Url);
                            conf.DefaultViewModel = si.Viewmodel;
                        }
                        conf.SysList.Add(si);
                    }
                    gIndex++;
                }
                //如果系统没有默认访问的his系统,则访问首页
                conf.MainUrl = string.IsNullOrEmpty(conf.MainUrl) ?  getWebUrl(conf.Main, "") : conf.MainUrl;
                return(conf);
            }catch (Exception ex) {
                MessageBox.Show("解析配置文件失败!" + ex.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(conf);
            }
        }