Exemplo n.º 1
0
        /// <summary>
        /// 开始下载
        /// </summary>
        /// <param name="downloadList"></param>
        private void StartDownload(List <DownloadFileInfo> downloadList)
        {
            FrmDownloadProgress dp = new FrmDownloadProgress(downloadList);

            if (dp.ShowDialog() == DialogResult.OK)
            {
                if (DialogResult.Cancel == dp.ShowDialog())
                {
                    //更新失败,回滚
                    RollBack();
                    return;
                }
                //更新成功
                Config.SaveConfig(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ConstFile.FILENAME), config);
                //删除更新临时文件
                Directory.Delete(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ConstFile.TEMPFOLDERNAME), true);
                //删除备份文件
                DeleteOld(AppDomain.CurrentDomain.BaseDirectory);
                //弹出提示
                MessageBox.Show(ConstFile.APPLYTHEUPDATE, ConstFile.MESSAGETITLE, MessageBoxButtons.OK, MessageBoxIcon.Information);
                //重启程序
                CommonUnitity.RestartApplication();
            }
        }
Exemplo n.º 2
0
 private void ShowErrorAndRestartApplication()
 {
     MessageBox.Show(ConstFile.NOTNETWORK, ConstFile.MESSAGETITLE, MessageBoxButtons.OK, MessageBoxIcon.Information);
     CommonUnitity.RestartApplication();
 }