private void btnUpdateNow_Click(object sender, EventArgs e) { this.Visible = false;//隐藏当前窗口 UpdateForm updateForm = new UpdateForm(updateWork); if (updateForm.ShowDialog() == DialogResult.OK) { Application.Exit(); } }
static void Main(string[] args) { string processName = args[0]; //string processName = "应用程序名称"; UpdateWorker updateWorker = new UpdateWorker(); if (updateWorker.IsNeedUpdate()) { ProcessHelper.KillProgressIfExists(processName); //updateWorker.Do(); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); UpdateForm updateForm = new UpdateForm(updateWorker); updateForm.ShowDialog(); if (updateForm.DialogResult == DialogResult.OK) { ProcessHelper.StartProgress(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, processName)); } //Application.Run(new UpdateForm(updateWorker)); } }
private static void ShowUI() { var updateForm = new UpdateForm(); updateForm.ShowDialog(); }