Пример #1
0
        public void PerformUpdate(IAutoUpdaterClient client, VersionInfo versionInfo)
        {
            switch (formFactory.Create <FUpdate>().ShowDialog())
            {
            case DialogResult.Yes:     // Install
                // TODO: The app process might need to be killed/restarted before/after installing
                autoUpdater.DownloadAndInstallUpdate(versionInfo).ContinueWith(result =>
                {
                    if (result.Result)
                    {
                        client.InstallComplete();
                    }
                    else
                    {
                        MessageBox.Show(MiscResources.InstallFailed, MiscResources.InstallFailedTitle,
                                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                });
                break;

            case DialogResult.OK:     // Download
                var saveDialog = new SaveFileDialog
                {
                    FileName = versionInfo.FileName
                };
                if (saveDialog.ShowDialog() == DialogResult.OK)
                {
                    // TODO: Display progress while downloading
                    autoUpdater.DownloadUpdate(versionInfo, saveDialog.FileName);
                }
                break;
            }
        }
Пример #2
0
 public void PerformUpdate(IAutoUpdaterClient client, VersionInfo versionInfo)
 {
     switch (formFactory.Create<FUpdate>().ShowDialog())
     {
         case DialogResult.Yes: // Install
             // TODO: The app process might need to be killed/restarted before/after installing
             autoUpdater.DownloadAndInstallUpdate(versionInfo).ContinueWith(result =>
             {
                 if (result.Result)
                 {
                     client.InstallComplete();
                 }
                 else
                 {
                     MessageBox.Show(MiscResources.InstallFailed, MiscResources.InstallFailedTitle,
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             });
             break;
         case DialogResult.OK: // Download
             var saveDialog = new SaveFileDialog
             {
                 FileName = versionInfo.FileName
             };
             if (saveDialog.ShowDialog() == DialogResult.OK)
             {
                 // TODO: Display progress while downloading
                 autoUpdater.DownloadUpdate(versionInfo, saveDialog.FileName);
             }
             break;
     }
 }