public static OpenUrl ( string strUrlToOpen, PwEntry peDataSource ) : void | ||
strUrlToOpen | string | |
peDataSource | PwEntry | |
Результат | void |
private static void OnDownloadCompleted(object sender, DownloadDataCompletedEventArgs e) { string strXmlFile = NetUtil.GZipUtf8ResultToString(e); if (strXmlFile == null) { if (e.Error != null) { if (m_tsResultsViewer == null) { MessageService.ShowWarning(KPRes.UpdateCheckingFailed, e.Error); } else if (e.Error.Message != null) { CheckForUpdate.SetTsStatus(KPRes.UpdateCheckingFailed + " " + e.Error.Message); } } else { ReportStatusEx(KPRes.UpdateCheckingFailed, true); } return; } XmlDocument xmlDoc = new XmlDocument(); try { xmlDoc.LoadXml(strXmlFile); } catch (Exception) { StructureFail(); return; } XmlElement xmlRoot = xmlDoc.DocumentElement; if (xmlRoot == null) { StructureFail(); return; } if (xmlRoot.Name != ElemRoot) { StructureFail(); return; } uint uVersion = 0; foreach (XmlNode xmlChild in xmlRoot.ChildNodes) { if (xmlChild.Name == ElemVersionU) { uint.TryParse(xmlChild.InnerText, out uVersion); } else if (xmlChild.Name == ElemVersionStr) { // strVersion = xmlChild.InnerText; } } if (uVersion > PwDefs.Version32) { if (m_tsResultsViewer == null) { if (MessageService.AskYesNo(KPRes.ChkForUpdNewVersion + MessageService.NewParagraph + KPRes.HomepageVisitQuestion)) { WinUtil.OpenUrl(PwDefs.HomepageUrl, null); } } else { CheckForUpdate.SetTsStatus(KPRes.ChkForUpdNewVersion); } } else if (uVersion == PwDefs.Version32) { ReportStatusEx(KPRes.ChkForUpdGotLatest, false); } else { ReportStatusEx(KPRes.UnknownFileVersion, true); } }