public async static Task <NewVersionInfo> RequestInfoAsync(string url)
        {
            NewVersionInfo info = new NewVersionInfo();

            HttpWebRequest request = Requests.CreateDefaultRequest(url);
            string         result  = await Requests.ReadResponseStringAsync(request);

            XElement rootElement     = XElement.Parse(result);
            XElement versionElement  = rootElement.Element("version");
            XElement downloadElement = rootElement.Element("download");
            XElement executeElement  = rootElement.Element("execute");
            XElement filesElement    = rootElement.Element("files");

            info.Version = Version.Parse(versionElement.Value);
            info.Link    = downloadElement.Value;
            info.Execute = executeElement.Value;
            info.Files   = filesElement.Value;

            return(info);
        }
        public async void CheckForUpdates(bool raisedManually = false)
        {
            if (m_checkingUpdates)
            {
                return;
            }

            m_checkingUpdates = true;
            bool newVersion = false;

            NewVersionInfo?info = null;

            try
            {
                info = await NewVersionInfo.RequestInfoAsync(Global.UpdateVersionLink);
            }
            catch
            {
                try
                {
                    info = await NewVersionInfo.RequestInfoAsync(Global.AdditionalUpdateVersionLink);
                }
                catch
                {
                    if (raisedManually)
                    {
                        Global.MessageBox(this, Global.GetStringResource("StringCheckUpdatesError"), MessageBoxExPredefinedButtons.Ok);
                    }
                }
            }

            Version currentVersion = Version.Parse(FileVersionInfo.GetVersionInfo(Assembly.GetExecutingAssembly().Location).ProductVersion);

            if (info != null && info.Value.Version > currentVersion)
            {
                newVersion = true;
            }

            if (raisedManually && !newVersion)
            {
                Global.MessageBox(this, Global.GetStringResource("StringNoUpdatesFound"), MessageBoxExPredefinedButtons.Ok);
            }
            if (newVersion && Global.MessageBox(this, Global.GetStringResource("StringUpdateAvailable"), MessageBoxExPredefinedButtons.YesNo) == MessageBoxExButton.Yes)
            {
                UpdateViewModel dialogViewModel = new UpdateViewModel(info.Value.Link);
                Global.Dialogs.ShowDialog(this, dialogViewModel);
                if (!dialogViewModel.DownloadSuccessful)
                {
                    Global.MessageBox(this, Global.GetStringResource("StringUpdateDownloadError"), MessageBoxExPredefinedButtons.Ok);
                }
                else if (!dialogViewModel.ExtractSuccessful)
                {
                    Global.MessageBox(this, Global.GetStringResource("StringUpdateExtractError"), MessageBoxExPredefinedButtons.Ok);
                }

                if (dialogViewModel.DownloadSuccessful && dialogViewModel.ExtractSuccessful)
                {
                    string basePath = Global.AppDataPath + Path.DirectorySeparatorChar + Global.UpdateExtractDirectory;
                    string appDir   = AppDomain.CurrentDomain.BaseDirectory;
                    while (appDir.EndsWith("\\"))
                    {
                        appDir = appDir.Remove(appDir.Length - 1);
                    }
                    Process.Start($"{basePath}{Path.DirectorySeparatorChar}{info.Value.Execute}", $"\"{basePath}{Path.DirectorySeparatorChar}{info.Value.Files}\" \"{appDir}\"");
                    NeedClose();
                }
            }

            m_checkingUpdates = false;
        }