상속: TextElement, IInline
예제 #1
0
        public static bool TryCreate(Inline inline, out ImageInline imageInline)
        {
            imageInline = null;
            if (null == inline)
            {
                return false;
            }

            if (!IsImageInline(inline))
            {
                return false;
            }

            Span span = inline as Span;
            Run imagePath = span.Inlines[0] as Run;
            Run caption = span.Inlines[1] as Run;

            imageInline = new ImageInline
            {
                FilePath = imagePath.Text,
                Caption = caption.Text
            };

            return true;
        }
 public Paragraph AddToParentParagraph(Inline text)
 {
     var paragraph = new Paragraph();
     paragraph.Inlines.Add(text);
     Add(paragraph);
     return paragraph;
 }
 public virtual void Add(Inline inline)
 {
     var paragraph = _richTextBlock.Blocks.LastOrDefault() as Paragraph;
     if (paragraph == null)
     {
         paragraph = new Paragraph();
         paragraph.Inlines.Add(inline);
         Add(paragraph);
     }
     else
     {
         paragraph.Inlines.Add(inline);
     }
 }
예제 #4
0
        public static ImageInline Create(Inline inline)
        {
            if (null == inline)
            {
                throw new ArgumentNullException("inline");
            }

            if (!IsImageInline(inline))
            {
                throw new ArgumentException("Inline is not an image inline", "inline");
            }

            ImageInline result;
            if (!TryCreate(inline, out result))
            {
                throw new InvalidOperationException("Failed to create image inline");
            }

            return result;
        }
예제 #5
0
        public static bool IsImageInline(Inline inline)
        {
            bool isImageSpan = IsImageSpan(inline);
            bool isImageUIInline = IsImageInlineUIElement(inline);

            return isImageSpan || isImageUIInline;
        }
예제 #6
0
 private void outp(Inline r)
 {
     runOnUiThread(() => outp_ui(r));
 }
예제 #7
0
        private void outp_ui(Inline r)
        {
            var count = rtbConsole.Blocks.Count - blankLines; // ignore blank lines at end
            var idx = count - 1;
            var p = ((Paragraph)rtbConsole.Blocks[0]);
            var loc = p.Inlines.Count - 3;
            p.Inlines.Insert(loc, r);
            ScrollToBottom();

        }
 public virtual void Add(Inline inline)
 {
     _paragraph.Inlines.Add(inline);
 }
예제 #9
0
 /// <summary>
 /// Checks whether an Inline has a typographical effect within a given TextBlock
 /// </summary>
 /// <param name="inline">The Inline for which we want to check the typographical effectiveness</param>
 /// <param name="textBlock">The TextBlock within which we want to check the Inline's typographical effectiveness</param>
 /// <returns>Whether the Inline has a typographical effect within the given TextBlock</returns>
 internal static bool HasTypographicalEffectWithin(this Inline inline, TextBlock textBlock)
 {
     return(inline is Run run &&
            run.Text != string.Empty &&
            !inline.IsTypographicallyEquivalentTo(textBlock));
 }
예제 #10
0
        internal static string ToPlainText(Inline inline)
        {
            string result = string.Empty;
            ImageInline imageInline;
            if (TryCreate(inline, out imageInline))
            {
                result = string.Format(PlainTextFormat, imageInline.FilePath, imageInline.Caption);
            }

            return result;
        }
 /// <summary>
 /// Update the properties on the inline instance.
 /// </summary>
 /// <param name="inline">The instance.</param>
 public override void UpdateInline(Inline inline)
 {
     inline.CharacterSpacing = _letterSpacing;
     inline.FontSize = _fontSize ?? 15;
     inline.FontStyle = _fontStyle ?? FontStyle.Normal;
     inline.FontWeight = _fontWeight ?? FontWeights.Normal;
     inline.FontFamily = _fontFamily != null ? new FontFamily(_fontFamily) : FontFamily.XamlAutoFontFamily;
 }
예제 #12
0
 /// <inheritdoc />
 public bool Remove(Inline item) => _collection.Remove(item);
 /// <summary>
 /// Update the properties on the inline instance.
 /// </summary>
 /// <param name="inline">The instance.</param>
 public override void UpdateInline(Inline inline)
 {
     ((Run)inline).Text = _text;
 }
예제 #14
0
 /// <inheritdoc />
 public void Add(Inline item) => _collection.Add(item);
예제 #15
0
 /// <inheritdoc />
 public bool Contains(Inline item) => _collection.Contains(item);
 public static void SetFormattedText(DependencyObject obj, Inline value)
 {
     obj.SetValue(FormattedTextProperty, value);
 }
 public Paragraph AddToParentParagraph(Inline text) => _parent.AddToParentParagraph(text);
 public void Add(Inline text)
 {
     _span.Inlines.Add(text);
 }
예제 #19
0
 private static bool IsImageInlineUIElement(Inline inline)
 {
     InlineUIContainer container = inline as InlineUIContainer;
     return null != container
         && container.Child.GetType() == typeof(Image);
 }
 public void Add(Inline text)
 {
     _block.Inlines.Add(text);
 }
예제 #21
0
 private static bool IsImageSpan(Inline inline)
 {
     Span span = inline as Span;
     bool isImageSpan = null != span
         && inline.GetType() == typeof(Span)
         && span.Inlines.Count == 2
         && InvisibleRun.IsInvisible(span.Inlines[0] as Run)
         && !InvisibleRun.IsInvisible(span.Inlines[1] as Run);
     return isImageSpan;
 }
 public void Add(Inline text)
 {
     var paragraph = new Paragraph();
     paragraph.Inlines.Add(text);
     Add(paragraph);
 }
예제 #23
0
 /// <inheritdoc />
 public int IndexOf(Inline item) => _collection.IndexOf(item);
            public void Add(Inline text)
            {
                //throw new NotSupportedException();
                var paragraph = new Paragraph();
                paragraph.Inlines.Add(text);

                _richTextBlock.Blocks.Add(paragraph);
            }
 public void Add(Inline inline)
 {
     _span.Inlines.Add(inline);
 }
예제 #26
0
 /// <inheritdoc />
 public void Insert(int index, Inline item) => _collection.Insert(index, item);
 public Paragraph AddToParentParagraph(Inline text) {
     Add(text);
     return _block;
 }
 /// <summary>
 /// Update the properties on the inline instance.
 /// </summary>
 /// <param name="inline">The instance.</param>
 public abstract void UpdateInline(Inline inline);
 public void Add(Inline inline)
 {
     _innerContainer.Add(inline);
 }
 public virtual void Add(Inline inline)
 {
     var paragraph = new Paragraph();
     paragraph.Inlines.Add(inline);
     Add(paragraph);
 }