Пример #1
0
        private void frmLogin_Load(object sender, EventArgs e)
        {
            DateTime dt = DateTime.Now;

            M.Start(panelEx2, "今天是 " + dt.GetDateTimeFormats('D')[1].ToString() + "   欢迎您", Point.Add(labelX3.Location, new Size(0, labelX3.Height)), new Size(390, 100));
            //labelX3.Text = ;// +" " + dt.GetDateTimeFormats('D')[2].ToString();//星期六 2005年11月5日
            //"今天是 " + dt.GetDateTimeFormats('D')[1].ToString() + "   欢迎您"
            AutoUpdate.AutoUpdate au = new AutoUpdate.AutoUpdate();
            try
            {
                au.Update();
            }
            catch (WebException exp)
            {
                MessageBox.Show(String.Format("无法找到指定资源\n\n{0}", exp.Message), "自动升级", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (XmlException exp)
            {
                MessageBox.Show(String.Format("下载的升级文件有错误\n\n{0}", exp.Message), "自动升级", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (NotSupportedException exp)
            {
                MessageBox.Show(String.Format("升级地址配置错误\n\n{0}", exp.Message), "自动升级", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (ArgumentException exp)
            {
                MessageBox.Show(String.Format("下载的升级文件有错误\n\n{0}", exp.Message), "自动升级", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            catch (Exception exp)
            {
                MessageBox.Show(String.Format("升级过程中发生错误\n\n{0}", exp.Message), "自动升级", MessageBoxButtons.OK, MessageBoxIcon.Error);
                LogHelper.Error(String.Format("升级过程中发生错误\n\n{0}", exp.Message));
            }
        }
Пример #2
0
 public int CheckVersion()
 {
     if (update == null)
     {
         update = new AutoUpdate();
     }
     return(update.CheckVersionInfo());
 }
Пример #3
0
        private void btn_check_Click(object sender, EventArgs e)
        {
            AutoUpdate.AutoUpdate UpdateInterface;
            Assembly currAsm = Assembly.GetExecutingAssembly();
            Uri      uri     = new Uri(Server);

            UpdateInterface = new AutoUpdate.AutoUpdate(uri, local);
            UpdateInterface.UpdateComplete += this.UpdateComplete;
            UpdateInterface.DoUpdate();
        }
Пример #4
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            var  serverIP        = "47.93.200.67";
            var  serverPort      = 19921;
            var  callBackExeName = "LSP.exe";
            var  title           = "在线更新";
            var  processName     = callBackExeName.Substring(0, callBackExeName.Length - 4);
            bool haveRun         = ESBasic.Helpers.ApplicationHelper.IsAppInstanceExist(processName);

            if (haveRun)
            {
                MessageBox.Show(Properties.Resources.TargetIsRunning);
                return;
            }

            var form = new AutoUpdate(serverIP, serverPort, callBackExeName, title);

            Application.Run(form);
        }
Пример #5
0
        private void frmProcess_Load(object sender, EventArgs e)
        {
            try
            {
                try
                {
                    System.Diagnostics.Process[] processes = System.Diagnostics.Process.GetProcessesByName("GiaoXu");
                    if (processes.Length > 0)
                    {
                        MessageBox.Show("Xin vui lòng đóng tất cả các chương trình QLGX đang chạy. Sau khi đóng xong tất cả, bấm nút OK để tiếp tục.");
                    }

                    foreach (System.Diagnostics.Process p in processes)
                    {
                        p.Kill();
                    }
                }
                catch
                { }

                //
                if (update == null)
                {
                    update = new AutoUpdate();
                    update.OnDownloading += new EventHandler(update_OnDownloading);
                    update.OnError       += new EventHandler(update_OnError);
                    update.OnFinished    += new EventHandler(update_OnFinished);
                    update.OnStart       += new EventHandler(update_OnStart);
                }
                threadStart = new ThreadStart(update.Execute);
                thread      = new Thread(threadStart);
                thread.Start();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Lỗi Exception (frmProcess, frmProcess_Load)", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }