Beispiel #1
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());
        }
Beispiel #2
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();
        }