public DialogText(string document) { this.HyperlinkCommand = new LambdaUICommand(Properties.Resources.CommandHyperlink, o => { try { DialogHyperlink dialog = new DialogHyperlink(this.editor) { Owner = this }; dialog.ShowDialog(); } catch (Exception exception) { App.Mainframe.ReportException(exception); } } ); this.InsertImageCommand = new LambdaUICommand(Properties.Resources.CommandInsertImage, o => this.InsertImage()); this.Document = document; this.DataContext = this; this.InitializeComponent(); if (!string.IsNullOrEmpty(this.Document)) { FlowDocument flowDoc = TextNote.Load(this.Document); if (flowDoc != null) { this.editor.Document = flowDoc; } } }
public bool Match(Regex regex) { FlowDocument doc = TextNote.Load(this.Note); TextRange range = new TextRange(doc.ContentStart, doc.ContentEnd); string text = range.Text; return(!string.IsNullOrEmpty(text) && regex.IsMatch(text)); }
public static bool IsValidText(string text) { FlowDocument doc = TextNote.Load(text); return(doc != null && ( !string.IsNullOrWhiteSpace(new TextRange(doc.ContentStart, doc.ContentEnd).Text) || !text.StartsWith("<FlowDocument", StringComparison.OrdinalIgnoreCase) )); }
private FlowDocumentScrollViewer CreateGlyph() { FlowDocumentScrollViewer doc = Symbol.Skin <FlowDocumentScrollViewer>(SymbolShape.TextNote); doc.DataContext = this; doc.Document = TextNote.Load(this.Note); Panel.SetZIndex(doc, this.Z); doc.RenderTransform = new RotateTransform(); return(doc); }
public void UpdateGlyph() { FlowDocumentScrollViewer doc = this.TextNoteGlyph; doc.Document = TextNote.Load(this.Note); }