private static bool TryGetFactor(NXmlElement element, string attribute, out double result) { string str = NStringHelpers.SafeTrim(element.GetAttributeValue(attribute)); if (str == null || str.Length == 0) { result = 0; return(false); } bool isPercent = str[str.Length - 1] == '%'; if (isPercent) { str = str.Substring(0, str.Length - 1); } if (Double.TryParse(str, NumberStyles.Any, CultureInfo.InvariantCulture, out result) == false) { return(false); } if (isPercent) { result = result / 100; } return(true); }
private void OnGoButtonClick(NEventArgs arg1) { string address = NStringHelpers.SafeTrim(m_NavigationTextBox.Text); if (address == null || address.Length == 0) { return; } if (NFile.Exists(address)) { // Load from file using (Stream stream = NFile.OpenRead(address)) { LoadSource(stream); LoadHtml(stream, address); } return; } // Load from URI try { address = NormalizeUri(address); m_Stopwatch = NStopwatch.StartNew(); m_PreviewRichText.LoadFromUri(new NUri(address, ENUriKind.RelativeOrAbsolute)); } catch (Exception ex) { m_Stopwatch.Stop(); NMessageBox.Show(ex.Message, "Error", ENMessageBoxButtons.OK, ENMessageBoxIcon.Error); } }