Ejemplo n.º 1
0
        /// <summary>
        /// 检查更新
        /// </summary>
        public static void checkUpdate(DbManager db, MainFrm mainFrm, bool isDefault)
        {
            Dictionary <string, string> sysConfig = db.getRow2Dic("sysConfig");
            string version            = sysConfig["version"];
            string updateUrl          = sysConfig["updateUrl"];
            string localUpdateExeName = sysConfig["localUpdateExeName"];


            try
            {
                string urlStr = updateUrl + @"?type=version&isTest=0&version=" + version;
                string html   = HttpSend.GetSend(urlStr); //获取页面报文
                if (html != "false" && html != "")
                {
                    //如果对话框已经打开,就不要再提示了
                    if (isOpenUpdateDialog)
                    {
                        return;
                    }
                    DialogResult result = MessageBox.Show("发现系统更新,要现在升级吗?", "系统更新", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    isOpenUpdateDialog = true;
                    if (result == DialogResult.Yes)
                    {
                        isOpenUpdateDialog = false;
                        string defaultPath = getSystemDefaultDirectory();
                        db.close();
                        Process p = new Process();
                        p.StartInfo.UseShellExecute = true;
                        p.StartInfo.FileName        = localUpdateExeName;
                        p.StartInfo.Arguments       = "mainCallBack";
                        p.Start();
                        mainFrm.Dispose();
                        mainFrm.Close();
                    }
                    else if (result == DialogResult.No)
                    {
                        isOpenUpdateDialog = false;
                    }
                }
                else
                {
                    if (!isDefault)
                    {
                        MessageBox.Show("当前已是最新版本【" + version + "】");
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("检查升级失败!原因为:" + ex.Message);;
            }
        }
Ejemplo n.º 2
0
 public PlugManager(MainFrm mainFrm, GroupBox groupbox, ImageList imageList)
 {
     this.mainFrm   = mainFrm;
     this.groupbox  = groupbox;
     this.imageList = imageList;
 }
Ejemplo n.º 3
0
 public SettingFrm(MainFrm mainFrm, DbManager db)
 {
     this.mainFrm = mainFrm;
     this.db      = db;
 }
Ejemplo n.º 4
0
 public FirstUseFrm(MainFrm mainFrm)
 {
     InitializeComponent();
     this.mainFrm = mainFrm;
 }