private void CheckUpdateButton_Click(object sender, RoutedEventArgs e) { CheckUpdateButton.Visibility = Visibility.Hidden; AutoUpdare.Update au = new AutoUpdare.Update(); VersionMessage.Content = au.CompareVersions(); if (au.newversion == true) { DownloadNowButton.Visibility = Visibility.Visible; } }
async private void DownloadNowButton_Click(object sender, RoutedEventArgs e) { DownloadNowButton.Visibility = Visibility.Hidden; DownloadMessages.Visibility = Visibility.Visible; downloadPB.Visibility = Visibility.Visible; Downloadlog.Visibility = Visibility.Visible; AutoUpdare.Update au = new AutoUpdare.Update(); DownloadMessages.Content = "Соединяюсь с сервером..."; await Task.Delay(3000); downloadPB.Value = +20; DownloadMessages.Content = "Получаю версии файлов..."; au.GetFilesInfo(); downloadPB.Value = downloadPB.Value = +20; await Task.Delay(3000); DownloadMessages.Content = "Сравниваю версии файлов"; au.CompareFilesVersions(); DownloadMessages.Content = "Скачиваю файлы..."; downloadPB.Value = downloadPB.Value + 20; await Task.Delay(3000); DownloadMessages.Content = au.Download(); downloadPB.Value = downloadPB.Value + 20; await Task.Delay(3000); DownloadMessages.Content = "Просматриваю ChangeLog..."; Properties.Settings.Default.changelog = ""; Properties.Settings.Default.changelog = au.GetChangelog(); Properties.Settings.Default.Save(); downloadPB.Value = downloadPB.Value + 20; await Task.Delay(3000); downloadPB.Value = downloadPB.Value + 20; DownloadMessages.Content = "Программа перезапустится через 5 секунд..."; await Task.Delay(5000); string path = System.IO.Directory.GetCurrentDirectory(); Properties.Settings.Default.Save(); System.Diagnostics.Process.Start(path + @"/Update/Updater.exe"); Environment.Exit(0); }