void UpdateCheckerCallback(Utils.UpdateChecker uc, Utils.UpdateCheckerResult result) { try { if (!result.Success) { return; } V8Reader.Properties.Settings.Default.LastUpdateCheck = DateTime.Now.Date; V8Reader.Properties.Settings.Default.Save(); if (result.Updates.Count > 0) { var answer = MessageBox.Show("Обнаружены новые версии. Обновить программу?", "Обновление", MessageBoxButton.YesNo, MessageBoxImage.Question); if (answer == MessageBoxResult.Yes) { var UpdWnd = new Utils.UpdatesWnd(); UpdWnd.Updates = result.Updates; UpdWnd.Show(); } } } catch { #if DEBUG throw; #endif } }
void DownloadFileCompleted(IAsyncResult asynchronousResult) { RequestState state = (RequestState)asynchronousResult.AsyncState; UpdateCheckerResult CheckResult = new UpdateCheckerResult(); try { HttpWebRequest myHttpWebRequest = (HttpWebRequest)state.request; state.response = (HttpWebResponse)myHttpWebRequest.EndGetResponse(asynchronousResult); CheckResult.Updates = LoadResult(state.response); CheckResult.Success = true; } catch (Exception exc) { CheckResult.Exception = exc; CheckResult.Success = false; } finally { if (state.response != null) { state.response.Close(); } } state.ResultHandler(this, CheckResult); }
void UpdateCheckerCallback(Utils.UpdateChecker uc, Utils.UpdateCheckerResult result) { try { if (!result.Success) { throw result.Exception; } if (result.Updates.Count > 0) { var UpdWnd = new Utils.UpdatesWnd(); UpdWnd.Updates = result.Updates; UpdWnd.Owner = this; UpdWnd.Show(); } else { MessageBox.Show("Новых версий нет.", "V8 Viewer", MessageBoxButton.OK, MessageBoxImage.Information); } } catch (System.Net.WebException webExc) { MessageBox.Show(webExc.ToString()); return; } catch (Exception exc) { Utils.UIHelper.DefaultErrHandling(exc); } }