public static void CheckTranslationRequests(Dispatcher dispatcher) { try { string cultureName = App.CurrentCulture.Name; if (!cultureName.StartsWith("en", StringComparison.OrdinalIgnoreCase)) { SettingsStringCache checkedVersion = DialogAbout.TranslationRequestVersion(); if (!Version.TryParse(checkedVersion.Value, out Version version) || version < DialogAbout.CurrentVersion()) { string text = null; using (WebClient client = new WebClient()) { client.UseDefaultCredentials = true; text = client.DownloadString(new Uri("https://www.LogicCircuit.org/TranslationRequests.txt")); } if (!string.IsNullOrWhiteSpace(text) && text.Contains(cultureName)) { dispatcher.BeginInvoke( new Action(() => App.Mainframe.InformationMessage( "If you can help translating this program to any language you are fluent in please contact me at:\n" + "<Hyperlink NavigateUri=\"https://www.logiccircuit.org/contact.html\">https://www.logiccircuit.org/contact.html</Hyperlink>" )), DispatcherPriority.ApplicationIdle ); } checkedVersion.Value = DialogAbout.CurrentVersion().ToString(); } } } catch (Exception exception) { Tracer.Report("DialogAbout.CheckTranslationRequests", exception); // ignore all exception here } }
public static void CheckVersion(Dispatcher dispatcher) { try { if (VersionChecker.NeedToCheck()) { VersionChecker checker = new VersionChecker(); checker.Check((version, error) => { if (error == null && version != null && DialogAbout.CurrentVersion() < version) { dispatcher.BeginInvoke( new Action(() => DialogAbout.ShowNewVersionAvailable(version)), DispatcherPriority.ApplicationIdle ); } }); } } catch (Exception exception) { App.Mainframe.ReportException(exception); } }
public DialogAbout() { this.Version = DialogAbout.CurrentVersion(); this.DataContext = this; this.InitializeComponent(); }