private void OnLoadStateButtonClick(NEventArgs arg1) { if (m_MemoryStream == null) { return; } m_MemoryStream.Seek(0, SeekOrigin.Begin); try { NDomNodeDeserializer deserializer = new NDomNodeDeserializer(); NTestNode root = (NTestNode)deserializer.LoadFromStream(m_MemoryStream, ENPersistencyFormat.Binary)[0]; /* NDocumentBlock root = (NDocumentBlock)deserializer.LoadFromStream(m_MemoryStream, ENPersistencyFormat.Binary)[0]; * * if (root != null) * { * m_RichText.Document = new NRichTextDocument(root); * }*/ } catch (Exception ex) { NTrace.WriteLine(ex.Message); } }
private void OnSaveStateButtonClick(NEventArgs arg1) { try { m_MemoryStream = new MemoryStream(); NDomNodeSerializer serializer = new NDomNodeSerializer(); NTestNode testNode = new NTestNode(); testNode.SetValue(NTestNode.ExtendedPropertyEx, false); serializer.SaveToStream(new NNode[] { testNode }, m_MemoryStream, ENPersistencyFormat.Binary); // serializer.SaveToStream(new NNode[] { m_RichText.Content }, m_MemoryStream, ENPersistencyFormat.Binary); m_LoadStateButton.Enabled = true; } catch (Exception ex) { NTrace.WriteLine(ex.Message); } }