public static IWorkbookFormatProvider GetFormatProvider(string extension) { IWorkbookFormatProvider formatProvider; switch (extension) { case XlsxFormat: formatProvider = new XlsxFormatProvider(); break; case CsvFormat: formatProvider = new CsvFormatProvider(); ((CsvFormatProvider)formatProvider).Settings.HasHeaderRow = true; break; case TxtFormat: formatProvider = new TxtFormatProvider(); break; case PdfFormat: formatProvider = new PdfFormatProvider(); break; default: formatProvider = null; break; } return(formatProvider); }
private void RadRichTextBox_CommandExecuting(object sender, CommandExecutingEventArgs e) { if (e.Command is SaveCommand) { e.Cancel = true; SaveDocument(); // A custom logic for saving document so you can change the properties of the Save File dialog. } if (e.Command is PasteCommand) { // Altering the PasteCommand to ensure only plain text is pasted in RadRichTextBox. // Obtain the content from the clipboard. RadDocument documentFromClipboard = ClipboardEx.GetDocument().ToDocument(); TxtFormatProvider provider = new TxtFormatProvider(); // Convert it to plain text. string plainText = provider.Export(documentFromClipboard); // Create a RadDocument instance from the plain text. RadDocument documentToInsert = provider.Import(plainText); // Set this document as a content to the clipboard. ClipboardEx.SetDocument(new DocumentFragment(documentToInsert)); } if (e.Command is InsertTableCommand) { // Disable the possibility to insert tables into the document. MessageBox.Show("Inserting tables is not allowed."); e.Cancel = true; } }
/// <summary> /// Get Supported providers for the import operation based on the file extension /// </summary> /// <param name="extension">the extension of the file we will import, used to discern the provider type</param> /// <returns>IFormatProvider<RadFlowDocument> that you can use to read that file and import it as an in-memory document you can convert to other formats</returns> IFormatProvider <RadFlowDocument> GetImportFormatProvider(string extension) { IFormatProvider <RadFlowDocument> fileFormatProvider; switch (extension) { case ".docx": fileFormatProvider = new DocxFormatProvider(); break; case ".rtf": fileFormatProvider = new RtfFormatProvider(); break; case ".html": fileFormatProvider = new HtmlFormatProvider(); break; case ".txt": fileFormatProvider = new TxtFormatProvider(); break; default: fileFormatProvider = null; break; } if (fileFormatProvider == null) { throw new NotSupportedException("The chosen file cannot be read with the supported providers."); } return(fileFormatProvider); }
public static void SaveDocument(RadFlowDocument document, string selectedFromat) { IFormatProvider<RadFlowDocument> formatProvider = null; switch (selectedFromat) { case "Docx": formatProvider = new DocxFormatProvider(); break; case "Rtf": formatProvider = new RtfFormatProvider(); break; case "Txt": formatProvider = new TxtFormatProvider(); break; } if (formatProvider == null) { return; } SaveFileDialog dialog = new SaveFileDialog(); dialog.Filter = String.Format("{0} files|*{1}|All files (*.*)|*.*", selectedFromat, formatProvider.SupportedExtensions.First()); dialog.FilterIndex = 1; if (dialog.ShowDialog() == true) { using (var stream = dialog.OpenFile()) { formatProvider.Export(document, stream); } } }
private void ImportFromString(string input) { #region radwordsprocessing-formats-and-conversion-txt-txtformatprovider_1 TxtFormatProvider provider = new TxtFormatProvider(); RadFlowDocument document = provider.Import(input); #endregion }
public static IWorkbookFormatProvider GetFormatProvider(string extension) { IWorkbookFormatProvider formatProvider; switch (extension) { case XlsxFormat: formatProvider = new XlsxFormatProvider(); break; case CsvFormat: formatProvider = new CsvFormatProvider(); ((CsvFormatProvider)formatProvider).Settings.HasHeaderRow = true; break; case TxtFormat: formatProvider = new TxtFormatProvider(); break; case PdfFormat: formatProvider = new PdfFormatProvider(); break; default: formatProvider = null; break; } return formatProvider; }
private string GetText() { TxtFormatProvider provider = new TxtFormatProvider(); Telerik.WinForms.Documents.Model.RadDocument document = this.txtSourceSQL.Document; return(provider.Export(document)); }
private void ExportToArray() { #region radwordsprocessing-formats-and-conversion-txt-txtformatprovider_3 TxtFormatProvider provider = new TxtFormatProvider(); RadFlowDocument document = CreateRadFlowDocument(); string output = provider.Export(document); #endregion }
public WatermarkRadRichTextBox() { InitializeComponent(); this.AttachToEvents(); this.FillInputBindingsCollection(); this.provider = new TxtFormatProvider(); }
private void UseCsvSettings() { #region radspreadprocessing-formats-and-conversion-txt-settings_0 TxtFormatProvider provider = new TxtFormatProvider(); provider.Settings.Delimiter = ';'; provider.Settings.Quote = '^'; provider.Settings.HasHeaderRow = true; #endregion }
public override void Close() { if (ValidateNote()) { TxtFormatProvider txtProvider = new TxtFormatProvider(); this.Note.Note = txtProvider.Export(this.ThisView.Note.Document); txtProvider = null; } this.TryClose(); }
private void Save(string format) { if (this.document == null) { Console.WriteLine("Cannot save. A document is not loaded."); return; } IFormatProvider <RadFlowDocument> formatProvider = null; switch (format) { case "docx": formatProvider = new DocxFormatProvider(); break; case "html": formatProvider = new HtmlFormatProvider(); break; case "rtf": formatProvider = new RtfFormatProvider(); break; case "txt": formatProvider = new TxtFormatProvider(); break; case "pdf": formatProvider = new PdfFormatProvider(); break; } if (formatProvider == null) { Console.WriteLine("Not supported document format."); return; } string path = "Converted." + format; using (FileStream stream = File.OpenWrite(path)) { formatProvider.Export(this.document, stream); } Console.WriteLine("Document converted."); ProcessStartInfo psi = new ProcessStartInfo() { FileName = path, UseShellExecute = true }; Process.Start(psi); }
private void ImportFromFile() { #region radwordsprocessing-formats-and-conversion-txt-txtformatprovider_0 TxtFormatProvider provider = new TxtFormatProvider(); using (Stream input = File.OpenRead("Sample.txt")) { RadFlowDocument document = provider.Import(input); } #endregion }
void EmailBodyContent_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { var mimePartVm = e.NewValue as MimePartVm; if (mimePartVm != null) { RadDocument content = null; var plain = true; if (!String.IsNullOrEmpty(mimePartVm.MIMEpart.ContentSubtype)) { if (mimePartVm.MIMEpart.ContentSubtype.Equals("html")) { content = new HtmlFormatProvider().Import(mimePartVm.RawContent); plain = false; } else if (mimePartVm.MIMEpart.ContentSubtype.Equals("rtf")) { content = new RtfFormatProvider().Import(mimePartVm.RawContent); plain = false; } /* else if (mimePartVm.Data.ContentSubtype.Equals("pdf")) * { * content = new PdfFormatProvider().Import(mimePartVm.RawContent); * }*/ else { content = new TxtFormatProvider().Import(mimePartVm.RawContent); //content = new XamlFormatProvider().Import(mimePartVm.RawContent); } } else { // content = new XamlFormatProvider().Import(mimePartVm.RawContent); //TxtFormatProvider formatProvider = new TxtFormatProvider(); content = new TxtFormatProvider().Import(mimePartVm.RawContent); //content = new TxtDataProvider(mimePartVm.RawContent); } if (plain) { foreach (var span in content.EnumerateChildrenOfType <Span>()) { span.FontSize = 12; } } content.LineSpacing = 1.1; content.ParagraphDefaultSpacingAfter = 0; content.ParagraphDefaultSpacingBefore = 0; this.ContentTextBox.LineBreakingRuleLanguage = LineBreakingRuleLanguage.None; this.ContentTextBox.Document = content; } }
public static string GetTextFromRadDocText(string RadDoc) { if (RadDoc == null || RadDoc.Trim() == "") { return(""); } var d = new XamlFormatProvider().Import(RadDoc); var pr = new TxtFormatProvider(); return(pr.Export(d)); }
private void ExportToFile() { #region radwordsprocessing-formats-and-conversion-txt-txtformatprovider_2 TxtFormatProvider provider = new TxtFormatProvider(); using (Stream output = File.OpenWrite("sample.txt")) { RadFlowDocument document = CreateRadFlowDocument(); provider.Export(document, output); } #endregion }
private void SaveDocument(RadFlowDocument document, string selectedFormat) { string selectedFormatLower = selectedFormat.ToLower(); IFormatProvider <RadFlowDocument> formatProvider = null; switch (selectedFormatLower) { case "docx": formatProvider = new DocxFormatProvider(); break; case "rtf": formatProvider = new RtfFormatProvider(); break; case "txt": formatProvider = new TxtFormatProvider(); break; case "html": formatProvider = new HtmlFormatProvider(); break; case "pdf": formatProvider = new PdfFormatProvider(); break; } if (formatProvider == null) { Console.WriteLine("Uknown or not supported format."); return; } string path = "Sample document." + selectedFormat; using (FileStream stream = File.OpenWrite(path)) { formatProvider.Export(document, stream); } Console.Write("Document generated."); ProcessStartInfo psi = new ProcessStartInfo() { FileName = path, UseShellExecute = true }; Process.Start(psi); }
private void ExportTxt() { #region radspreadprocessing-formats-and-conversion-txt-txtformatprovider_1 Workbook workbook = new Workbook(); workbook.Worksheets.Add(); string fileName = "SampleFile.txt"; IWorkbookFormatProvider formatProvider = new TxtFormatProvider(); using (FileStream output = new FileStream(fileName, FileMode.Create)) { formatProvider.Export(workbook, output); } #endregion }
private void ExportTxt() { #region radspreadsheet-model-import-export-txtformatprovider-wpf_1 Workbook workbook = new Workbook(); workbook.Worksheets.Add(); string fileName = "SampleFile.txt"; IWorkbookFormatProvider formatProvider = new TxtFormatProvider(); using (FileStream output = new FileStream(fileName, FileMode.Create)) { formatProvider.Export(workbook, output); } #endregion }
private void OpenFile_Click(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog(); TxtFormatProvider formatProvider = new TxtFormatProvider(); ofd.Filter = "Text (tab delimited) (*.txt)|*.txt|All Files (*.*)|*.*"; if (ofd.ShowDialog() == true) { using (Stream input = ofd.OpenRead()) { this.radSpreadsheet.Workbook = formatProvider.Import(input); } } }
/// <summary> /// Get Supported providers for the export operation based on the file name, also gets its MIME type as an out parameter /// </summary> /// <param name="fileName">the file name you wish to export, the provider is discerned based on its extensiom</param> /// <param name="mimeType">an out parameter with the MIME type for this file so you can download it</param> /// <returns>IFormatProvider<RadFlowDocument> that you can use to export the original document to a certain file format</returns> IFormatProvider <RadFlowDocument> GetExportFormatProvider(string fileName, out string mimeType) { // we get both the provider and the MIME type to use only one swtich-case IFormatProvider <RadFlowDocument> fileFormatProvider; string extension = Path.GetExtension(fileName); switch (extension) { case ".docx": fileFormatProvider = new DocxFormatProvider(); mimeType = "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; break; case ".rtf": fileFormatProvider = new RtfFormatProvider(); mimeType = "application/rtf"; break; case ".html": fileFormatProvider = new HtmlFormatProvider(); mimeType = "text/html"; break; case ".txt": fileFormatProvider = new TxtFormatProvider(); mimeType = "text/plain"; break; case ".pdf": fileFormatProvider = new pdfProviderNamespace.PdfFormatProvider(); mimeType = "application/pdf"; break; default: fileFormatProvider = null; mimeType = string.Empty; break; } if (fileFormatProvider == null) { throw new NotSupportedException("The chosen format cannot be exported with the supported providers."); } return(fileFormatProvider); }
private void ImportWorkbookFromTxtUsingOpenFileDialog() { #region radspreadsheet-model-import-export-txtformatprovider-silverlight_1 Workbook workbook; OpenFileDialog openFileDialog = new OpenFileDialog(); IWorkbookFormatProvider formatProvider = new TxtFormatProvider(); openFileDialog.Filter = "TXT (tab delimited) (*.txt)|*.txt|All Files (*.*)|*.*"; if (openFileDialog.ShowDialog() == true) { using (Stream input = openFileDialog.File.OpenRead()) { workbook = formatProvider.Import(input); } } #endregion }
private void ImportTxt() { #region radspreadsheet-model-import-export-txtformatprovider-wpf_0 string fileName = "SampleFile.txt"; if (!File.Exists(fileName)) { throw new FileNotFoundException(String.Format("File {0} was not found!", fileName)); } Workbook workbook; IWorkbookFormatProvider formatProvider = new TxtFormatProvider(); using (FileStream input = new FileStream(fileName, FileMode.Open)) { workbook = formatProvider.Import(input); } #endregion }
private void Save(string format) { if (this.document == null) { Console.WriteLine("Cannot save. A document is not loaded."); return; } IFormatProvider <RadFlowDocument> formatProvider = null; switch (format) { case "docx": formatProvider = new DocxFormatProvider(); break; case "html": formatProvider = new HtmlFormatProvider(); break; case "rtf": formatProvider = new RtfFormatProvider(); break; case "txt": formatProvider = new TxtFormatProvider(); break; case "pdf": formatProvider = new PdfFormatProvider(); break; } if (formatProvider == null) { Console.WriteLine("Not supported document format."); return; } using (var stream = File.OpenWrite("Converted." + format)) { formatProvider.Export(this.document, stream); Console.WriteLine("The document is converted and saved."); } }
private void ImportTxt() { string fileName = "SampleFile.txt"; if (!File.Exists(fileName)) { throw new FileNotFoundException(String.Format("File {0} was not found!", fileName)); } #region radspreadprocessing-formats-and-conversion-txt-txtformatprovider_0 Workbook workbook; IWorkbookFormatProvider formatProvider = new TxtFormatProvider(); using (FileStream input = new FileStream(fileName, FileMode.Open)) { workbook = formatProvider.Import(input); } #endregion }
public void ExportWorkbookToTxt() { #region radspreadsheet-model-import-export-txtformatprovider-silverlight_2 Workbook workbook = new Workbook(); workbook.Worksheets.Add(); SaveFileDialog saveFileDialog = new SaveFileDialog(); TxtFormatProvider formatProvider = new TxtFormatProvider(); saveFileDialog.Filter = "TXT (tab delimited) (*.txt)|*.txt|All Files (*.*)|*.*"; if (saveFileDialog.ShowDialog() == true) { using (Stream output = saveFileDialog.OpenFile()) { formatProvider.Export(workbook, output); } } #endregion }
private void SaveDocument(RadFlowDocument document, string selectedFormat) { string selectedFormatLower = selectedFormat.ToLower(); IFormatProvider <RadFlowDocument> formatProvider = null; switch (selectedFormatLower) { case "docx": formatProvider = new DocxFormatProvider(); break; case "rtf": formatProvider = new RtfFormatProvider(); break; case "txt": formatProvider = new TxtFormatProvider(); break; case "html": formatProvider = new HtmlFormatProvider(); break; case "pdf": formatProvider = new PdfFormatProvider(); break; } if (formatProvider == null) { Console.WriteLine("Uknown or not supported format!"); return; } using (var stream = File.OpenWrite("Sample document." + selectedFormat)) { Console.WriteLine("Exporting to {0}...", selectedFormat); formatProvider.Export(document, stream); Console.WriteLine("Done."); } }
public SpellCheckTextBox() { #region default values of simple rich textbox LayoutMode = DocumentLayoutMode.Flow; DocumentInheritsDefaultStyleSettings = true; AcceptsReturn = false; AcceptsTab = false; AutoInsertHyperlinks = false; FontFamily = new FontFamily("Trebuchet MS"); IsImageMiniToolBarEnabled = false; IsContextMenuEnabled = true; IsSelectionMiniToolBarEnabled = false; HorizontalScrollBarVisibility = ScrollBarVisibility.Disabled; VerticalScrollBarVisibility = ScrollBarVisibility.Disabled; #endregion _txtFormatProvider = new TxtFormatProvider(); LostFocus += UserControl_LostFocus; if (!App.IsDesignTime) { RadCompositionInitializer.Catalog = new TypeCatalog( // format providers - we only use the TxtFormatProvider typeof(TxtFormatProvider), // the default English spellchecking dictionary typeof(RadEn_USDictionary), // dialogs typeof(EditCustomDictionaryDialog), typeof(SpellCheckingDialog) ); // Next method call are required only to work around limitations for using MEF this.ContextMenu = new Telerik.Windows.Controls.RichTextBoxUI.ContextMenu(); var contextMenu = (Telerik.Windows.Controls.RichTextBoxUI.ContextMenu)ContextMenu; contextMenu.ContentBuilder = new NodeTextInputContextMenuBuilder(this); contextMenu.Showing += ContextMenuOnShowing; contextMenu.Closed += ContextMenuOnClosed; } }
private async Task Generate() { RadFlowDocument document = this.CreateDocument(); IFormatProvider <RadFlowDocument> formatProvider = null; string exampleName = null; switch (selectedExportFormat) { case "Docx": formatProvider = new DocxFormatProvider(); exampleName = "example.docx"; break; case "Rtf": formatProvider = new RtfFormatProvider(); exampleName = "example.rtf"; break; case "Html": formatProvider = new HtmlFormatProvider(); exampleName = "example.html"; break; case "Txt": formatProvider = new TxtFormatProvider(); exampleName = "example.txt"; break; } using (MemoryStream stream = new MemoryStream()) { formatProvider.Export(document, stream); stream.Seek(0, SeekOrigin.Begin); await this.fileViewerService.View(stream, exampleName); } }
public static void SaveDocument(RadFlowDocument document, string selectedFromat) { IFormatProvider <RadFlowDocument> formatProvider = null; switch (selectedFromat) { case "Docx": formatProvider = new DocxFormatProvider(); break; case "Rtf": formatProvider = new RtfFormatProvider(); break; case "Txt": formatProvider = new TxtFormatProvider(); break; } if (formatProvider == null) { return; } SaveFileDialog dialog = new SaveFileDialog(); dialog.Filter = String.Format("{0} files|*{1}|All files (*.*)|*.*", selectedFromat, formatProvider.SupportedExtensions.First()); dialog.FilterIndex = 1; if (dialog.ShowDialog() == true) { using (var stream = dialog.OpenFile()) { formatProvider.Export(document, stream); } } }
private async void ExportCommandExecute() { this.OpenSample(); IFormatProvider <RadFlowDocument> formatProvider = null; string exampleName = null; switch (this.selectedExportFormat) { case "PDF files(*.pdf)": formatProvider = new PdfFormatProvider(); exampleName = "example.pdf"; break; case "RTF files(*.rtf)": formatProvider = new RtfFormatProvider(); exampleName = "example.rtf"; break; case "HTML files(*.html)": formatProvider = new HtmlFormatProvider(); exampleName = "example.html"; break; case "TXT files(*.txt)": formatProvider = new TxtFormatProvider(); exampleName = "example.txt"; break; } using (MemoryStream stream = new MemoryStream()) { formatProvider.Export(this.flowDocument, stream); stream.Seek(0, SeekOrigin.Begin); await this.fileViewerService.View(stream, exampleName); } }
private Field GetField(string processSystemName, PropertyInfo property, IDynamicObject self, bool isGsUpdate, CultureInfo culture = null) { var containsNumbers = false; var temp = property.GetValue(self, null); if (typeof(DateTime?).IsAssignableFrom(property.PropertyType)) { containsNumbers = true; var attrib = (DateTimeFormatAttribute[])property.GetCustomAttributes(typeof(DateTimeFormatAttribute), false); var displayType = attrib.Select(x => x.Value).FirstOrDefault(); var propValue = (DateTime?)property.GetValue(self, null); if (propValue != null) { switch (displayType) { case "Date": temp = propValue.Value.ToString(Constants.DefaultShortDateFormat, CultureInfo.InvariantCulture); break; case "Time": temp = propValue.Value.ToString(Constants.DefaultShortTimeFormat, CultureInfo.InvariantCulture); break; case "DateTime": temp = propValue.Value.ToString(Constants.DefaultShortDateTimeFormat, CultureInfo.InvariantCulture); break; default: throw new VeyronException("Not definited time : " + displayType); } } } var crossRefAtrib = (CrossRefFieldAttribute[])property.GetCustomAttributes(typeof(CrossRefFieldAttribute), false); if (crossRefAtrib.Count() != 0) { var enumerable = temp as IEnumerable<object>; if (enumerable != null) { var items = enumerable.ToArray(); var fieldName = crossRefAtrib.Select(x => x.RefFieldName).FirstOrDefault(); if (items.Any()) { var firstItemType = items[0].GetType(); var fieldProperty = firstItemType.GetPropertyByName(fieldName); if (fieldProperty != null) { var list = items.Select(item => (fieldProperty.GetValue(item, null) ?? string.Empty).ToString()).ToList(); temp = list.Any() ? list.Aggregate((a, b) => a + ", " + b) : null; } } else { temp = string.Empty; } } else { if (!isGsUpdate) { var crossRefId = temp as int?; if (crossRefId != null) { var crossRefValue = TheDynamicTypeManager.GetCrossReferenceItem(processSystemName, property.Name, (int)crossRefId); if (crossRefValue != null) { temp = crossRefValue.__DisplayName; } } } } } var fieldEditorAtribute = (FieldEditorAttribute[])property.GetCustomAttributes(typeof(FieldEditorAttribute), false); if (fieldEditorAtribute.Count() != 0) { var atribute = fieldEditorAtribute.FirstOrDefault(); if (atribute.DataType == "Checkbox") { var checkBoxValue = temp as bool?; var isSwithTogle = (IsSwitchToggleAttribute[])property.GetCustomAttributes(typeof(IsSwitchToggleAttribute), false); if (isSwithTogle.Count() != 0) { var switchTogleValue = (isSwithTogle.FirstOrDefault().Value as bool?).Value; if (switchTogleValue) { if (!checkBoxValue.HasValue) { temp = ((UndefinedLabelAttribute[])property.GetCustomAttributes(typeof(UndefinedLabelAttribute), false)) .FirstOrDefault().Value.ToString(); } else if (checkBoxValue.Value) { temp = ((TrueLabelAttribute[])property.GetCustomAttributes(typeof(TrueLabelAttribute), false)).FirstOrDefault() .Value.ToString(); } else { temp = ((FalseLabelAttribute[])property.GetCustomAttributes(typeof(FalseLabelAttribute), false)).FirstOrDefault() .Value.ToString(); } } else { if (!checkBoxValue.HasValue) { temp = null; } else if (checkBoxValue.Value) { temp = "True"; } else { temp = "False"; } } } } if (atribute.DataType == "Approval") { var result = temp as string; var approval = temp as IApprovalEdit; if (approval != null) { result = approval.ApprovalState; } temp = result.ToApprovalState().GetDisplayName(); } if (atribute.DataType == "RichText") { var richText = temp as string; if (!string.IsNullOrEmpty(richText)) { var htmlProvider = new HtmlFormatProvider(); var document = htmlProvider.Import(richText); var textProvider = new TxtFormatProvider(); temp = textProvider.Export(document); } } if (atribute.DataType == "FileProcess") { var file = temp as IFileProcess; if (file != null) { temp = file.OriginalFileName; } } } string value = temp == null ? null : temp.ToString(); if (!containsNumbers && IsNumber(value)) { containsNumbers = true; } if (value == null || string.IsNullOrWhiteSpace(value)) { return null; } var field = culture != null ? GetLocalizedFieldName(property.Name, culture) : property.Name; return new Field(field, value, Field.Store.YES, containsNumbers ? Field.Index.NOT_ANALYZED : Field.Index.ANALYZED, Field.TermVector.WITH_POSITIONS); }
public void NoteSave() { if (ValidateNote()) { TxtFormatProvider txtProvider = new TxtFormatProvider(); this.Note.Note = txtProvider.Export(this.NotesView.CurrentNote.Document); txtProvider = null; NotesView.NoteGrid.Enable(defaultFocusDelegate); NotesView.NoteData.Disable(); this.Notes.AddOrReplace(this.Note.Clone()); AssistantNoteMode = (int)AssistantViewMode.ReadOnly; NotifyOfPropertyChange(() => NotesCount); NotifyOfPropertyChange(() => Notes); UpdateSummaryNotes(); } NotifyOfPropertyChange(() => CanNoteAdd); NotifyOfPropertyChange(() => CanNoteEdit); NotifyOfPropertyChange(() => CanNoteRemove); }
private void ReceiveNewEmail() { var newEmail = EmailService.GetEmails(1).First(); newEmail.Status = EmailStatus.Unread; var provider = new TxtFormatProvider(); string emailContentText = provider.Export(newEmail.Content); this.desktopAlertManager.ShowAlert(new DesktopAlertParameters { Header = newEmail.Sender, Content = newEmail.Subject + emailContentText, Icon = new Image { Source = Application.Current.FindResource("DesktopAlertIcon") as ImageSource, Width = 48, Height = 48 }, IconColumnWidth = 48, IconMargin = new Thickness(10, 0, 20, 0), Command = new DelegateCommand(this.OnAlertCommandExecuted), CommandParameter = newEmail }); this.ReceivedEmails.Add(newEmail); }
private void webClient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e) { TxtFormatProvider formatProvider = new TxtFormatProvider(); Workbook workbook = formatProvider.Import(e.Result); }