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);
        }
Exemple #2
0
        /// <summary>
        /// 检查当前版本是否需要更新,
        /// 如果需要更新返回
        /// </summary>
        /// <param name="pVersion"></param>
        public string CheckUpdate()
        {
            string        file          = System.AppDomain.CurrentDomain.BaseDirectory + "application.ini";
            IniFileHelper ifh           = new IniFileHelper(file);
            bool          update        = bool.Parse(ifh.IniReadValue("application", "update", "false"));
            string        updateFileUrl = "";

            if (update)
            {
                string pVersion      = ifh.IniReadValue("application", "version", "0.0.0");
                string update_server = ifh.IniReadValue("application", "update_server", "");
                //1、发起http请求,获取当前的最新版本的版本号码及下载地址
                string      versionFile = HttpGet(update_server);
                UpdateFiles files       = JsonConvert.DeserializeObject <UpdateFiles>(versionFile);
                //ID为1的为系统主程序,其他为系统的插件,例如自动更新插件、控制台日志插件、诊间结算插件等,系统支持最小模块运行。即不加载任何插件运行
                if (files != null)
                {
                    foreach (UpdateFile uf in files.Filelist)
                    {
                        if (uf.Id == "1" && pVersion != uf.Version)
                        {
                            try
                            {
                                System.Diagnostics.Process.Start(Global.gAppPath + @"plugins\\updater\\Updater.exe", string.Format("{0} {1} {2} {3}", update_server.Replace("version.json", uf.File), Global.gAppPath, "ScWebBrowser.exe", uf.Version));
                            }
                            catch (Exception ex)
                            {
                                Global.ShowWarning(ex.Message);
                            }
                            System.Environment.Exit(0);
                        }
                    }
                }
            }
            return(updateFileUrl);
        }
Exemple #3
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);
            }
        }