/// <summary> /// Parse the editControl's text into wcf binary xml /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ParseEditedXML(object sender, EventArgs e) { XmlDocument document = new XmlDocument(); bDirty = true; try { document.LoadXml(editControl.Text); binaryContent = WcfBinaryConverter.ConvertXmlToWcfBinary(document); } catch (XmlException) { // it's perfectly possible that the user did not enter valid XML. // the binaryContent will not have been overwritten, so do nothing } }
/// <summary> /// Update the controls with the new binary content /// </summary> private void UpdateControlContent() { try { XmlDocument document = WcfBinaryConverter.ConvertWcfBinaryMessageToXml(binaryContent); if (document == null || document.ChildNodes.Count == 0) { this.Clear(); } else { viewControl.LoadXml(document); } } catch (XmlException ex) { log.LogString(ex.ToString()); viewControl.DisplayError(ex.Message); } }