Beispiel #1
0
        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;
                }
            }
        }
Beispiel #2
0
        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));
        }
Beispiel #3
0
        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)
                       ));
        }
Beispiel #4
0
        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);
        }
Beispiel #5
0
        public void UpdateGlyph()
        {
            FlowDocumentScrollViewer doc = this.TextNoteGlyph;

            doc.Document = TextNote.Load(this.Note);
        }