コード例 #1
0
ファイル: AutoUpdaterUI.cs プロジェクト: royal50911/naps2
        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
ファイル: AutoUpdaterUI.cs プロジェクト: lapuinka/naps2
 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;
     }
 }
コード例 #3
0
ファイル: AutoUpdaterUI.cs プロジェクト: royal50911/naps2
 private void CheckForUpdate(IAutoUpdaterClient client)
 {
     if (GetAutoUpdateStatus() == AutoUpdateStatus.Enabled)
     {
         autoUpdater.CheckForUpdate().ContinueWith(updateInfo =>
         {
             if (updateInfo.Result.HasUpdate)
             {
                 client.UpdateAvailable(updateInfo.Result.VersionInfo);
             }
         });
     }
 }
コード例 #4
0
ファイル: AutoUpdaterUI.cs プロジェクト: royal50911/naps2
 public void OnApplicationStart(IAutoUpdaterClient client)
 {
     if (userConfigManager.Config.LastUpdateCheckDate == null)
     {
         userConfigManager.Config.LastUpdateCheckDate = DateTime.Now;
         userConfigManager.Save();
     }
     if (DateTime.Now - userConfigManager.Config.LastUpdateCheckDate > UpdateCheckInterval)
     {
         PromptToEnableAutomaticUpdates();
         CheckForUpdate(client);
     }
 }
コード例 #5
0
ファイル: AutoUpdaterUI.cs プロジェクト: lapuinka/naps2
 private void CheckForUpdate(IAutoUpdaterClient client)
 {
     if (GetAutoUpdateStatus() == AutoUpdateStatus.Enabled)
     {
         autoUpdater.CheckForUpdate().ContinueWith(updateInfo =>
         {
             if (updateInfo.Result.HasUpdate)
             {
                 client.UpdateAvailable(updateInfo.Result.VersionInfo);
             }
         });
     }
 }
コード例 #6
0
ファイル: AutoUpdaterUI.cs プロジェクト: lapuinka/naps2
 public void OnApplicationStart(IAutoUpdaterClient client)
 {
     if (userConfigManager.Config.LastUpdateCheckDate == null)
     {
         userConfigManager.Config.LastUpdateCheckDate = DateTime.Now;
         userConfigManager.Save();
     }
     if (DateTime.Now - userConfigManager.Config.LastUpdateCheckDate > UpdateCheckInterval)
     {
         PromptToEnableAutomaticUpdates();
         CheckForUpdate(client);
     }
 }