private void RenderConversation() { ConversationTextBox.Visibility = Visibility.Collapsed; ConversationTextBox = new ConvesationTextBox(); ConversationTextBox.Document.Blocks.Clear(); conversationPanel.Children.Add(ConversationTextBox); if (Conversation == null) { ConversationTextBox.Document.Blocks.Add(new Paragraph(new Italic(new Run("No conversation selected.")))); _renderCompleteEvent.Set(); return; } _renderer = new ConversationRendererRichText(DisplayOptions, Conversation); ConversationTextBox.Dispatcher.BeginInvoke( DispatcherPriority.Normal, new NextMessageDelegate(RenderNextMessage), 40); ConversationTextBox.Dispatcher.BeginInvoke( DispatcherPriority.SystemIdle, new ClearTextBoxesDelegate(ClearTextBoxes)); }
protected void WriteConversationContents(StreamWriter writer, IConversation conversation, IDisplayOptionsReadOnly displayOptions, IAttachmentExportLocator attachmentExportLocator) { IConversationRenderer renderer = GetRenderer(conversation, displayOptions, attachmentExportLocator); while (renderer.HasUnprocessedMessages) { const int RenderBufferSize = 5000; string exportableString = renderer.RenderMessagesAsString(RenderBufferSize); writer.Write(exportableString); } }
/// <summary> /// "Reimagines" a well-formatted XML file using a renderer of your choice. /// </summary> /// <param name="messageFilePath">XML file containing SMS log</param> /// <param name="outputPath">directory in which to place output</param> /// <param name="mapper"><see cref="IMessageMapper" /> for configuring AutoMapper</param> /// <param name="renderer"><see cref="IConversationRenderer" /> with which to process the data</param> public static void Process( string messageFilePath, string outputPath, IMessageMapper mapper, IConversationRenderer renderer ) { mapper.Configure(); Directory.CreateDirectory( outputPath ); var serializer = new XmlSerializer( typeof(smses) ); var data = (smses) serializer.Deserialize( new StreamReader( messageFilePath ) ); var bucket = Mapper.Map<MessageBucket>( data ); var conversations = bucket.SelectConversations(); renderer.Render( conversations, outputPath ); }