Ejemplo n.º 1
0
 /// <summary>
 /// 窗体加载事件
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 protected virtual void CheckUpdate_Load(object sender, EventArgs e, int type)
 {
     ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12; //解决极少部分系统(window server 2008R2 和极少部分win7)显示Could not create SSL/TLS secure channel
     Jnw.Common.AutoUpdate au = GetJnWCommonAutoUpdateInstance();
     au.KillProcess("KentCraft", true, false);
     //au.KillProcess("java", true);
     //au.KillProcess("javaw", true);
     //判断是否需要更新
     if (type == 1)
     {
         if (!au.CheckUpdate(_tipString))
         {
             NewestCallback newestCallback = new NewestCallback(delegate()
             {
                 au.OpenUpdate("KentCraft.exe");//程序文件名
                 Application.Exit();
             });
             newestCallback();
         }
     }
     else if (type == 2)
     {
         if (!au.CheckUpdate("192.168.1.1", "FileShare", "LoginAccount", "LoginPassword", _tipString))
         {
             NewestCallback newestCallback = new NewestCallback(() => Application.Exit());
             newestCallback();
         }
     }
 }
Ejemplo n.º 2
0
        protected virtual void btnConfirm_Click(object sender, EventArgs e)
        {
            Jnw.Common.AutoUpdate au = GetJnWCommonAutoUpdateInstance();
            //提示
            PromptConfirmMessageBox(delegate
                                    ()
            {
                //测试
                //au.KillProcess("FileName.vshost");
                au.KillProcess("KentCraft", true, false);
                au.KillProcess("java", true);
                au.KillProcess("javaw", true);

                this.Hide();
                AutoUpdate2 winFormau = new AutoUpdate2();
                winFormau.Show();
            });
        }