Interaction logic for GetUpdateDialog.xaml
Наследование: Window
        private async static void CheckForVersionUpdate(bool alwaysShow = false)
        {
            if (!alwaysShow && !Properties.Settings.Default.CheckForUpdates)
            {
                return;
            }

            try
            {
                string onlineVersionString = "";
                var    response            = await theHttpClient.GetAsync("https://futureai.guru/LatestBrainSimVersion.txt");

                if (response.IsSuccessStatusCode)
                {
                    DateTime?fileDate = response.Content.Headers.LastModified?.DateTime;

                    var theStream = await response.Content.ReadAsByteArrayAsync();

                    using (var contentStream = new MemoryStream(theStream))
                    {
                        onlineVersionString = new StreamReader(contentStream, Encoding.UTF8).ReadToEnd();
                    }
                    Version onlineVersion   = new Version(onlineVersionString);
                    var     runningVersionx = System.Reflection.Assembly.GetExecutingAssembly().GetName();
                    Version runningVersion  = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
                    if (onlineVersion > runningVersion || alwaysShow)
                    {
                        string displayableOnlineVersion = onlineVersion.ToString() + "    (" + fileDate.ToString() + ")";

                        string s = "Currently Running:\n " + HelpAbout.GetBuildString();
                        s += "\n\nAvailable for Download: \n" + displayableOnlineVersion;
                        if (onlineVersion <= runningVersion)
                        {
                            s += "\nYou have the latest version";
                        }

                        GetUpdateDialog dlg = new GetUpdateDialog();
                        dlg.UpdateInfo.Content    = s;
                        dlg.cbDontAsk.IsChecked   = !Properties.Settings.Default.CheckForUpdates;
                        dlg.WindowStartupLocation = WindowStartupLocation.CenterScreen;
                        dlg.ShowDialog();
                    }
                }
            }
            catch
            {
                //it's not critical that we detect this, so just give up on any error
            }
        }