Advertisement
Guest User

Untitled

a guest
Mar 24th, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.20 KB | None | 0 0
  1. private async void CheckVersion()
  2.         {
  3.             try
  4.             {
  5.                 var client = new HttpClient();
  6.  
  7.                 if (thisVersion < futureVersion)
  8.                 {
  9.                     var clientUpdater = new WebClient();
  10.                     clientUpdater.DownloadFileCompleted += Client_DownloadFileCompleted;
  11.                     clientUpdater.DownloadFileAsync(new Uri(@"http://taskbox.zzz.com.ua/TestViewer/TestViewer.exe"), "_temp.exe");
  12.                 }
  13.                 else
  14.                 {
  15.                     //сообщение о том, что у пользователя актуальная версия
  16.                 }
  17.             }
  18.             catch (Exception ex)
  19.             {
  20.                 //сообщение об ошибке
  21.             }
  22.         }
  23. private void Client_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
  24.         {
  25.             try
  26.             {
  27.                 Process.Start("updater.exe", "_temp.exe TestViewer.exe");
  28.                 Process.GetCurrentProcess().Kill();
  29.             }
  30.             catch (Exception ex)
  31.             {
  32.                 //сообщение об ошибке
  33.             }
  34.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement