public void CheckUpdates() { timerUpdate.Stop(); try { updater.GetElements(); if (updater.CheckUpdates(out string url, out string version)) { if (updateTh.ThreadState != ThreadState.Stopped) { updateTh.Abort(); } UpdateExisted?.Invoke(updater.URL + "/" + url, version); } else { MessageBox.Show("Обновлений не найдено."); timerUpdate.Start(); } } catch (Exception ex) { if (ex is System.Net.WebException) { MessageBox.Show("Подключение к интернету отсутствует."); } else { GetExceptionMessage(ex, "Main_Func.cs:118"); } } }
private void TH_Update(object um) { try { UpdateManager th_up = um as UpdateManager; th_up.GetElements(); if (th_up.CheckUpdates(out string url, out string version)) { Invoke((MethodInvoker)(() => { UpdateExisted?.Invoke(th_up.URL + "/" + url, version); })); } } catch (Exception ex) { if (!(ex is ThreadAbortException) && !(ex is System.Net.WebException)) { Invoke((MethodInvoker)(() => { Thread_Error(this, new EventArgs()); GetExceptionMessage(ex, "Main_Func.cs:118"); })); } } }