当前位置:首页 > Windows程序 > 正文

C#实现程序的版本升级更新

2024-03-31 Windows程序

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Text; using System.Windows.Forms; using System.IO; using System.Threading; using System.Net; using System.Xml; using Update; namespace UpdateTest { public partial class Form1 : Form { public Form1() { InitializeComponent(); checkUpdate(); } public void checkUpdate() { SoftUpdate app = new SoftUpdate(Application.ExecutablePath, "BlogWriter"); app.UpdateFinish += new UpdateState(app_UpdateFinish); try { if (app.IsUpdate && MessageBox.Show("检查到新版本,是否更新?", "Update", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { Thread update = new Thread(new ThreadStart(app.Update)); update.Start(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } } void app_UpdateFinish() { MessageBox.Show("更新完成,,请重新启动程序!", "Update", MessageBoxButtons.OK, MessageBoxIcon.Information); } } }

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/57949.html

Jm-杰米博客Jamie
草根站长的技术交流乐园!IT不会不要紧快来好好学习吧!
  • 20786文章总数
  • 7494635访问次数
  • 建站天数
  • 友情链接