private void UpdateCheck() { try { this.Dispatcher.Invoke(new Action(delegate() { this.IsUpdateChecking = true; })); UpdateHelper helper = new UpdateHelper(Consts.Application.UpdateCheckURL, Consts.Application.Version); helper.IsUpdateAvailable(); Parameters.LastUpdateDate = DateTime.Now; if (UpdateHelper.IsVersionHigher(helper.AvailableVersion())) { this.Dispatcher.Invoke(new Action(delegate() { if (MessageBox.Show(String.Format(Properties.Resources.UpdateAvailableFormat, Consts.Application.Version, helper.AvailableVersion()), Properties.Resources.UpdateAvailableTitle, MessageBoxButton.OKCancel, MessageBoxImage.Information, MessageBoxResult.OK) == MessageBoxResult.OK) { helper.StartUpdate(this.Owner); } })); } else { MessageBox.Show(String.Format(Properties.Resources.NoUpdatesFormat, Consts.Application.Version), Properties.Resources.NoUpdatesTitle, MessageBoxButton.OK, MessageBoxImage.Information); } } catch (Exception ex) { Log.Write(ex); } finally { this.Dispatcher.Invoke(new Action(delegate() { this.IsUpdateChecking = false; })); } }
private void UpdateCheck() { try { UpdateHelper helper = new UpdateHelper(Consts.Application.UpdateCheckURL, Consts.Application.Version); helper.IsUpdateAvailable(); Parameters.LastUpdateDate = DateTime.Now; if (UpdateHelper.IsVersionHigher(helper.AvailableVersion())) { this.Dispatcher.Invoke(new Action(delegate() { this.Show(); this.WindowState = WindowState.Normal; this.Activate(); if (MessageBox.Show(String.Format(Properties.Resources.UpdateAvailableFormat, Consts.Application.Version, helper.AvailableVersion()), Properties.Resources.UpdateAvailableTitle, MessageBoxButton.OKCancel, MessageBoxImage.Information, MessageBoxResult.OK) == MessageBoxResult.OK) { helper.StartUpdate(this); } })); } } catch (Exception ex) { Log.Write(ex); } }