Inheritance: Inline, IRun
        private void DisplayMessage()
        {
            ChatMessage msg = null;
            while ((msg = DequeueChatMessage()) != null)
            {
                // create the paragraph
                Paragraph p = new Paragraph();
                Run rnMyText = new Run();
                p.FontWeight = FontWeights.Bold;

                // if the message is from the currently logged in user, then set the color to gray
                if (msg.From == _username)
                {
                    p.Foreground = new SolidColorBrush(Colors.Gray);
                    rnMyText.Text = string.Format("{0} (me): {1}", msg.From, msg.MessageText);
                }
                else
                {
                    p.Foreground = new SolidColorBrush(Colors.Green);
                    rnMyText.Text = string.Format("{0}: {1}", msg.From, msg.MessageText);
                }

                // add the text to the paragraph tag
                p.Inlines.Add(rnMyText);

                // add the paragraph to the rich text box
                rtbChatLog.Blocks.Add(p);
            }
        }
        public Scenario4()
        {
            this.InitializeComponent();
            //read language related resource file .strings/en or zh-cn/resources.resw
            Run run1 = new Run();
            run1.Text = ResourceManagerHelper.ReadValue("Description4_p1");
            Run run2 = new Run();
            run2.Text = ResourceManagerHelper.ReadValue("Description4_p2");
            this.textDes.Inlines.Add(run1);
            this.textDes.Inlines.Add(new LineBreak());
            this.textDes.Inlines.Add(run2);
            this.txtBoxAddress.PlaceholderText = ResourceManagerHelper.ReadValue("IP");

            penSize = minPenSize + penSizeIncrement * selectThickness;
            // Initialize drawing attributes. These are used in inking mode.
            InkDrawingAttributes drawingAttributes = new InkDrawingAttributes();
            drawingAttributes.Color = Windows.UI.Colors.Red;
            drawingAttributes.Size = new Size(penSize, penSize);
            drawingAttributes.IgnorePressure = false;
            drawingAttributes.FitToCurve = true;

            inkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes);
            inkCanvas.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse | Windows.UI.Core.CoreInputDeviceTypes.Pen | Windows.UI.Core.CoreInputDeviceTypes.Touch;
            inkCanvas.InkPresenter.StrokesCollected += InkPresenter_StrokesCollected;
            inkCanvas.InkPresenter.StrokesErased += InkPresenter_StrokesErased;
            this.SizeChanged += Scenario4_SizeChanged;
            this.radioBtnClient.Checked += radioBtnClient_Checked;
            this.radioBtnServer.Checked += radioBtnServer_Checked;
        }
Beispiel #3
0
        private static List <Xaml.Run> GetInlines(string line, bool isThumbnail = false)
        {
            var tokens = ParserFactory.CreateParser().Parse(line);
            var dict   = new Dictionary <TokenType, string>
            {
                { TokenType.Keyword, "#FF569CD6" },
                { TokenType.Comment, "#FF82C65B" },
                { TokenType.String, "#FFD69D85" },
                { TokenType.Number, "#FF00C68B" },
                { TokenType.Operator, "#FF000000" },
                { TokenType.Symbol, "#FF1E1E1E" },
                { TokenType.Regular, "#FF1E1E1E" }
            };
            var list = new List <Xaml.Run>();

            foreach (var token in tokens)
            {
                var run = new Xaml.Run
                {
                    Text = token.Value,
                    //Foreground = new Windows.UI.Xaml.Media.SolidColorBrush(Helpers.GetColor(dict[token.Type]))
                };
                if (isThumbnail)
                {
                    run.FontSize = ThumbnailFontSize;
                }

                list.Add(run);
            }
            return(list);
        }
Beispiel #4
0
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            // TODO: Prepare page for display here.

            // TODO: If your application contains multiple pages, ensure that you are
            // handling the hardware Back button by registering for the
            // Windows.Phone.UI.Input.HardwareButtons.BackPressed event.
            // If you are using the NavigationHelper provided by some templates,
            // this event is handled for you.

            string article = "If a device fails to provide a certain format, you " +
            "can supplement the functionality by making it available. Your app can" +
            " use the file-conversion APIs (see the BitmapEncoder and BitmapDecoder" +
            " classes in the Windows.Grapics.Imaging namespace) to convert the scanner’s " +
            "native file type to the desired file type. You can even add text " +
            "recognition features so that your users can scan papers into reconstructed " +
            "documents with formatted, selectable text. You can provide filters or other " +
            "enhancements so that scanned images can be adjusted by a user. Ultimately, you " +
            "should not feel limited by what your users’ devices can or cannot do.";

            string[] words = article.Split(' ');

            foreach (string word in words)
            {
                Run run = new Run();
                run.Text = word + " ";
                myTextBlock.Inlines.Add(run);
            }
        }
        public Scenario3()
        {
            this.InitializeComponent();
            //read language related resource file .strings/en or zh-cn/resources.resw
            Run run1 = new Run();
            run1.Text = ResourceManagerHelper.ReadValue("Description3_p1");
            Run run2 = new Run();
            run2.Text = ResourceManagerHelper.ReadValue("Description3_p2");
            this.textDes.Inlines.Add(run1);
            this.textDes.Inlines.Add(new LineBreak());
            this.textDes.Inlines.Add(run2);

            // Initialize the InkCanvas
            inkCanvas.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse | Windows.UI.Core.CoreInputDeviceTypes.Pen | Windows.UI.Core.CoreInputDeviceTypes.Touch;

            // By default, pen barrel button or right mouse button is processed for inking
            // Set the configuration to instead allow processing these input on the UI thread
            inkCanvas.InkPresenter.InputProcessingConfiguration.RightDragAction = InkInputRightDragAction.LeaveUnprocessed;

            inkCanvas.InkPresenter.InputProcessingConfiguration.Mode = InkInputProcessingMode.Inking;

            inkCanvas.InkPresenter.UnprocessedInput.PointerPressed += UnprocessedInput_PointerPressed;
            inkCanvas.InkPresenter.UnprocessedInput.PointerMoved += UnprocessedInput_PointerMoved;
            inkCanvas.InkPresenter.UnprocessedInput.PointerReleased += UnprocessedInput_PointerReleased;

            // Handlers to clear the selection when inking or erasing is detected
            inkCanvas.InkPresenter.StrokeInput.StrokeStarted += StrokeInput_StrokeStarted;
            inkCanvas.InkPresenter.StrokesErased += InkPresenter_StrokesErased;

            SizeChanged += Scenario3_SizeChanged;
        }
 /// <summary>
 /// Helper to create log entries
 /// </summary>
 /// <param name="logEntry"></param>
 void appendLog(string logEntry, Color c)
 {
     Run r = new Run();
     r.Text = logEntry;
     Paragraph p = new Paragraph();
     p.Foreground = new SolidColorBrush(c);
     p.Inlines.Add(r);
     logResults.Blocks.Add(p);
 }
 public static Run ToRun(this Span span)
 {
     if (string.IsNullOrEmpty(span.Text))
         return new Run();
     Run run = new Run { Text = span.Text };
     if (span.ForegroundColor != Color.Default)
         run.Foreground = span.ForegroundColor.ToBrush();
     return run;
 }
        private void RefreshView()
        {
            // anything?
            if (string.IsNullOrEmpty(Markup))
            {
                this.Content = null;
                return;
            }

            // get the lines...
            var lines = new List<string>();
            using (var reader = new StringReader(this.Markup))
            {
                while(true)
                {
                    string buf = reader.ReadLine();
                    if (buf == null)
                        break;
                    lines.Add(buf);
                }
            }

            // walk...
            var block = new RichTextBlock();
            for (int index = 0; index < lines.Count; index++)
            {
                string nextLine = null;
                if (index < lines.Count - 1)
                    nextLine = lines[index + 1];

                // create a paragraph... and add it to the block...
                var para = new Paragraph();
                block.Blocks.Add(para);

                // create a "run" and add it to the paragraph...
                var run = new Run();
                run.Text = lines[index];
                para.Inlines.Add(run);

                // heading?
                if (nextLine != null && nextLine.StartsWith("="))
                {
                    // make it bigger, and then skip the next line...
                    para.FontSize = 20;
                    index++;
                }
                else if (nextLine != null && nextLine.StartsWith("-"))
                {
                    para.FontSize = 18;
                    index++;
                }
            }

            // set...
            this.Content = block;
        }
        private Block CreateTextBlock(string content)
        {
            var para = new Paragraph();

            var run = new Run() { Text = content };

            para.Inlines.Add(run);

            return para;
        }
        /// <summary>
        /// Create the <see cref="Inline"/> instance for the measurement calculation.
        /// </summary>
        /// <param name="children">The children.</param>
        /// <returns>The instance.</returns>
        public override Inline MakeInline(IList<Inline> children)
        {
            if (children.Count > 0)
            {
                throw new InvalidOperationException("Raw text nodes must be leaf nodes.");
            }

            var run = new Run();
            UpdateInline(run);
            return run;
        }
        void EscribirEnRichTextBox(string texto, RichTextBlock rtb)
        {
            rtb.Blocks.Clear();

            Run run = new Run();
            run.Text = texto;

            Paragraph parrafo = new Paragraph();
            parrafo.Inlines.Add(run);

            rtb.Blocks.Add(parrafo);
        }
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     rootPage = MainPage.Current;
     this.activeAccount = (Account)e.Parameter;
     //read language related resource file .strings/en or zh-cn/resources.resw
     Run run1 = new Run();
     run1.Text = string.Format(ResourceManagerHelper.ReadValue("SelecteHelloDs1"),activeAccount.Name);
     Run run2 = new Run();
     run2.Text = ResourceManagerHelper.ReadValue("SelecteHelloDs2");
     this.textHelloDes.Inlines.Add(run1);
     this.textHelloDes.Inlines.Add(new LineBreak());
     this.textHelloDes.Inlines.Add(run2);
 }
Beispiel #13
0
        public async void getEvent()
        {
            _Event = await Client.GetEventFromIdAsync(CurrentEvent);
            organizer = _Event.username;

            EventDetail.CardTitle = _Event.title;
            BeginTime.CardTitle = "Begin: " + _Event.beginTime.ToString(@"MMM. dd, yyyy a\t hh:mm tt");
            EndTime.CardTitle = "End: " + _Event.endTime.ToString(@"MMM. dd, yyyy a\t hh:mm tt");

            // Add organizer's name
            Run r = new Run();
            r.Text = _Event.username; // get the name instead of the username
            OrganizerName.Inlines.Add(r);

            // Display thumbnail
            if (!string.IsNullOrEmpty(_Event.thumbnail))
            {
                StorageFile file = await StorageFile.GetFileFromPathAsync(_Event.thumbnail);
                BitmapImage bmp = new BitmapImage();
                await bmp.SetSourceAsync(await file.OpenReadAsync());
                EventThumbnail.Source = bmp;
            }

            // Set descripiton
            EventDescription.Document.SetText(TextSetOptions.FormatRtf, _Event.description);

            // Set number of tickets left
            ticketLeft.Text = _Event.ticket + " left";
            if (_Event.ticket == 0)
            {
                ticketType.Foreground = new SolidColorBrush(Colors.LightGray);
                ticketLeft.Foreground = new SolidColorBrush(Colors.LightGray);
                ticketRegister.IsEnabled = false;
            }

            // Set location
            var location = await Client.GetLocationFromIdAsync(_Event.location);
            EventLocation.CardTitle = location.address;
            EventMap.Center = new Geopoint(new BasicGeoposition()
            {
                Latitude = location.latitude,
                Longitude = location.longitude
            });
            EventMap.ZoomLevel = 15;

            MapIcon icon = new MapIcon();
            icon.Location = EventMap.Center;
            icon.NormalizedAnchorPoint = new Point(0.5, 1.0);
            EventMap.MapElements.Add(icon);
        }
 /// <summary>
 /// Outputs text with formating.
 /// </summary>
 /// <param name="target">The target <see cref="TextBlock"/>.</param>
 /// <param name="toOutput">String to output.</param>
 /// <param name="fontStyle">The font style.</param>
 /// <param name="fontWeight">The font weight.</param>
 /// <param name="fontColor">Color of the font.</param>
 public static void OutputWithFormat(this TextBlock target, string toOutput,
     FontStyle fontStyle = FontStyle.Normal,
     FontWeight fontWeight = default(FontWeight),
     Color fontColor = default(Color))
 {
     var formatted = new Run
     {
         Text = toOutput,
         FontStyle = fontStyle,
         FontWeight = fontWeight.Equals(default(FontWeight)) ? FontWeights.Normal : fontWeight,
         Foreground = fontColor.Equals(default(Color)) ? new SolidColorBrush(Colors.Black) : new SolidColorBrush(fontColor)
     };
     target.Inlines.Add(formatted);
 }
        public MainPage()
        {
            this.InitializeComponent();

            var underline = new Underline();
            var run = new Run();
            run.Text = "コードビハインドから下線を追加";

            underline.Inlines.Add(run);

            this.textBlock.Inlines.Add(underline);

            //this.DataContext = new MainPageViewModel() { underlineText = "アンダーラインを引きたい場合" };
            this.DataContext = new MainPageViewModel() { normalText = "アンダーラインを引きたくない場合" };
        }
        private static void OnWikiTextChanged(DependencyObject depObj, DependencyPropertyChangedEventArgs e)
        {
            var txtBox = depObj as TextBlock;
            if (txtBox == null)
                return;
            if (!(e.NewValue is string))
                return;


            var html = e.NewValue as string;

            while (html.Contains("\r\n\r\n"))
            {
                html = html.Replace("\r\n\r\n", "\r\n");
            }

            var lines = html.Split(new char[] { '\n' });

            int i = 0;
            foreach (var line in lines)
            {
                i++;
                var run = new Run() { Text = line };
                if (line.StartsWith("#"))
                {
                    int strength = 1;
                    while (line.Length > strength)
                    {
                        if (line[strength] != '#') break;
                        strength++;
                    }

                    run.Text = run.Text.Replace("#", "").Trim();

                    run.FontWeight = new Windows.UI.Text.FontWeight() { Weight = 600 };

                    switch (strength)
                    {
                        case 3:  run.FontSize = 20; break;
                        case 4:  run.FontSize = 26; break;
                    }
                }

                if (i < lines.Length) run.Text += "\n\n";

                txtBox.Inlines.Add(run);
            }
        }
Beispiel #17
0
        public static Inline StandartConverter(InlineWrapper wrapper) {
            Inline inline;
            if (wrapper.Children?.Count > 0) {
                inline = wrapper.CreateSpanWithChildren();
            } else {
                string text;
                try {
                    text = HtmlEntity.DeEntitize(wrapper.Text);
                } catch (Exception) {
                    text = wrapper.Text;
                }

                inline = new Run {Text = text ?? string.Empty};
            }

            return inline;
        }
Beispiel #18
0
        public static Xaml.Bold Control(this Domain.Bold item, bool isThumbnail = false)
        {
            var control = new Xaml.Bold();

            if (isThumbnail)
            {
                control.FontSize = ThumbnailFontSize;
            }

            if (item.CharacterSpacing > 0)
            {
                control.CharacterSpacing = item.CharacterSpacing;
            }
            if (item.FontSize > 0 && !isThumbnail)
            {
                control.FontSize = item.FontSize;
            }
            if (!string.IsNullOrEmpty(item.FontStretch))
            {
                control.FontStretch = Helpers.ParseEnum <FontStretch>(item.FontStretch);
            }
            if (!string.IsNullOrEmpty(item.FontStyle))
            {
                control.FontStyle = Helpers.ParseEnum <FontStyle>(item.FontStyle);
            }
            if (!string.IsNullOrEmpty(item.FontWeight))
            {
                control.FontWeight = Helpers.ParseEnum <FontWeight>(item.FontWeight);
            }
            if (!string.IsNullOrEmpty(item.Foreground))
            {
                control.Foreground = new SolidColorBrush(item.Foreground.GetColor());
            }
            var run = new Xaml.Run {
                Text = item.Value
            };

            if (isThumbnail)
            {
                run.FontSize = ThumbnailFontSize;
            }

            control.Inlines.Add(run);

            return(control);
        }
        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            System.Collections.Generic.List<SearchHit> searchResults = (List<SearchHit>)e.Parameter;

            foreach (SearchHit result in searchResults)
            {
                Run r = new Run();
                Run s = new Run();
                DateTime date = DateTime.Today.Date.AddDays(result.getDay());
                r.Text = result.getDiningHall() +  "\n";
                s.Text = date.DayOfWeek + " " + date.ToString("MM/dd") + "\n";
                r.FontSize = 28;
                s.FontSize = 18;
                resultsBox.Inlines.Add(r);
                resultsBox.Inlines.Add(s);
            }
        }
        public Scenario2()
        {
            this.InitializeComponent();
            //read language related resource file .strings/en or zh-cn/resources.resw
            Run run1 = new Run();
            run1.Text = ResourceManagerHelper.ReadValue("Description2_p1");
            this.textDes.Inlines.Add(run1);
            this.textDes.Inlines.Add(new LineBreak());

            // Initialize drawing attributes. These are used in inking mode.
            InkDrawingAttributes drawingAttributes = new InkDrawingAttributes();
            drawingAttributes.Color = Windows.UI.Colors.Red;
            double penSize = 4;
            drawingAttributes.Size = new Windows.Foundation.Size(penSize, penSize);
            drawingAttributes.IgnorePressure = false;
            drawingAttributes.FitToCurve = true;

            // Show the available recognizers
            inkRecognizerContainer = new InkRecognizerContainer();
            recoView = inkRecognizerContainer.GetRecognizers();
            if (recoView.Count > 0)
            {
                foreach (InkRecognizer recognizer in recoView)
                {
                    RecoName.Items.Add(recognizer.Name);
                }
            }
            else
            {
                RecoName.IsEnabled = false;
                RecoName.Items.Add("No Recognizer Available");
            }
            RecoName.SelectedIndex = 0;

            // Set the text services so we can query when language changes
            textServiceManager = CoreTextServicesManager.GetForCurrentView();
            textServiceManager.InputLanguageChanged += TextServiceManager_InputLanguageChanged;

            SetDefaultRecognizerByCurrentInputMethodLanguageTag();

            // Initialize the InkCanvas
            inkCanvas.InkPresenter.UpdateDefaultDrawingAttributes(drawingAttributes);
            inkCanvas.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse | Windows.UI.Core.CoreInputDeviceTypes.Pen | Windows.UI.Core.CoreInputDeviceTypes.Touch;

            this.SizeChanged += Scenario2_SizeChanged;
        }
Beispiel #21
0
 private NormalCommentView GetNormalEarchView(commentContent cc)
 {
     View.NormalCommentView ncv = new View.NormalCommentView();
     if (cc.userImg != null)
     {
         ncv.usrImg.Source = new BitmapImage(cc.userImg);
     }
     else
     {
         ncv.commentStackPanel.Margin = new Thickness(0);
         ncv.usrImg.Width             = 1;
     }
     ncv.usrTextBox.Text = "#" + cc.count + " " + cc.userName;
     Windows.UI.Xaml.Documents.Run run = new Windows.UI.Xaml.Documents.Run();
     run.Text = cc.content;
     ncv.commentParagraph.Inlines.Add(run);
     return(ncv);
 }
 public object Convert(object value, Type targetType, object parameter, string language)
 {
     if (value == null)
     {
         return null;
     }
     var span = new Span();
     string s = (string)value;
     int index = 0;
     while ((index = s.IndexOf("#")) >= 0)
     {
         if (s.Substring(index + 1).IndexOf("#") >= 0)
         {
             if (index != 0)
             {
                 Run r = new Run();
                 r.Text = s.Substring(0, index);
                 span.Inlines.Add(r);
                 s = s.Substring(index);
                 index = 0;
             }
             int index2 = s.Substring(index + 1).IndexOf("#");
             if (index2 > 0)
             {
                 string highlight = s.Substring(index, index2 + index + 2);
                 Run high = new Run();
                 high.Text = highlight;
                 high.Foreground = TagColor;
                 span.Inlines.Add(high);
                 s = s.Substring(index2 + index + 2);
                 index = 0;
             }
         }
         else
         {
             break;
         }
     }
     Run left = new Run();
     left.Text = s;
     span.Inlines.Add(left);
     return span;
 }
        private void TextBlock_DataContextChanged(FrameworkElement sender, DataContextChangedEventArgs args)
        {
            if (!(sender is TextBlock) || !(args.NewValue is Person))
                return;
            var name = (args.NewValue as Person).Name;
            if (string.IsNullOrWhiteSpace(name))
                return;

            var split = name.Split(' ');
            if (split.Length != 2)
                return;

            var boldText = split[1];
            var textBlock = sender as TextBlock;
            var boldRun = new Run { Text = boldText, FontWeight = FontWeights.Bold };
            textBlock.Inlines.Clear();
            textBlock.Inlines.Add(new Run { Text = (split[0] + " ") });
            textBlock.Inlines.Add(boldRun);
        }
Beispiel #24
0
        public static Xaml.Hyperlink Control(this Trainer.Domain.HyperLink item, bool isThumbnail = false)
        {
            var control = new Xaml.Hyperlink
            {
                NavigateUri = new Uri(item.NavigateUri)
            };
            var run = new Xaml.Run
            {
                Text = item.Value
            };

            if (isThumbnail)
            {
                run.FontSize = ThumbnailFontSize;
            }

            control.Inlines.Add(run);

            return(control);
        }
        public static FrameworkElement GetTextElementFromHTML(string html, string direction = "ltr")
        {
            var doc = new HtmlDocument();
            doc.LoadHtml(html);

            var fd = FlowDirection.LeftToRight;
            if (string.Compare(direction, "rtl", StringComparison.CurrentCultureIgnoreCase) == 0)
            {
                fd = FlowDirection.RightToLeft;
            }

            TextBlock textBlock = new TextBlock();
            textBlock.FlowDirection = fd;
            if (fd == FlowDirection.RightToLeft)
            {
                textBlock.Padding = new Thickness(20, 10, 5, 10);
            }
            else
            {
                textBlock.Padding = new Thickness(5, 10, 20, 10);
            }

            foreach (var node in doc.DocumentNode.Descendants("p"))
            {
                var pureText = CleanupHTML(node.InnerText);
                var r = new Run();
                r.Text = pureText;

                textBlock.Inlines.Add(r);
                textBlock.Inlines.Add(new LineBreak());
                textBlock.Inlines.Add(new LineBreak());
            }

            if (textBlock.Inlines.Count > 2)
            {
                textBlock.Inlines.RemoveAt(textBlock.Inlines.Count - 1);
                textBlock.Inlines.RemoveAt(textBlock.Inlines.Count - 1);
            }
            return textBlock;
        }
        private static object CreateInlineCollection(string value)
        {
            var inlineCollection = new List<Inline>();
            var lines = Regex.Split(value, HtmlLineBreakRegex, RegexOptions.IgnoreCase);
            var skip = true;
            foreach (var line in lines)
            {
                if (!skip)
                    inlineCollection.Add(new LineBreak());
                else
                    skip = false;

                // Remove the rest of HTML tags.
                var strRun = Regex.Replace(line, HtmlStripperRegex, string.Empty, RegexOptions.IgnoreCase);
                if (!string.IsNullOrEmpty(strRun))
                {
                    var run = new Run { Text = strRun };
                    inlineCollection.Add(run);
                }
            }
            return inlineCollection;
        }
        /// <summary>
        /// Wird aufgerufen, wenn sich das EmailText Property geändert hat.
        /// </summary>
        /// <param name="obj">Das zugehörige DependencyObject, hier normal ein TextBlock.</param>
        /// <param name="e">Die Eventparameter.</param>
        private static void OnEmailTextPropertyChanged(DependencyObject obj, DependencyPropertyChangedEventArgs e)
        {
            TextBlock attachedTextBlock = obj as TextBlock;
            if (attachedTextBlock == null)
                return;

            string emailText = e.NewValue as string;
            attachedTextBlock.Inlines.Clear();

            if (emailText.Contains("@"))
            {
                string[] splittedString = emailText.Split(new string[] { " " }, StringSplitOptions.None);
                AddInlineControls(attachedTextBlock, splittedString);
            }
            else
            {
                // Schreibe Text in Run-Element.
                Run run = new Run();
                run.Text = emailText;
                attachedTextBlock.Inlines.Add(run);
            }
        }
Beispiel #28
0
        public MainPage()
        {
            this.InitializeComponent();
            this.NavigationCacheMode = NavigationCacheMode.Required;

            Run StatusHeader = new Run();
            StatusHeader.Text = "网络状态:";
            
            StatusBlock.Text = "未知";
            StatusBlock.Foreground = (Brush)App.Current.Resources["PhoneAccentBrush"];
            NetStatusBlock.Inlines.Add(StatusHeader);
            NetStatusBlock.Inlines.Add(StatusBlock);

            httpClient = new HttpClient();
            cts = new CancellationTokenSource();

            PortalBtn.IsEnabled = false;
            VerifyBtn.IsEnabled = false;
            DownBtn.IsEnabled = false;
            HeartBtn.IsEnabled = false;

            AddLog(" 请先更新一下自己的网络环境。");
        }
        public Scenario3_phone()
        {
            this.InitializeComponent();
            this.NavigationCacheMode = NavigationCacheMode.Enabled;
            //read language related resource file .strings/en or zh-cn/resources.resw
            Run run1 = new Run();
            run1.Text = ResourceManagerHelper.ReadValue("Description3_p1");
            Run run2 = new Run();
            run2.Text = ResourceManagerHelper.ReadValue("Description3_pp2");
            this.textDes.Inlines.Add(run1);
            this.textDes.Inlines.Add(new LineBreak());
            this.textDes.Inlines.Add(run2);

            // Initialize the InkCanvas
            inkCanvas.InkPresenter.InputDeviceTypes = Windows.UI.Core.CoreInputDeviceTypes.Mouse | Windows.UI.Core.CoreInputDeviceTypes.Pen | Windows.UI.Core.CoreInputDeviceTypes.Touch;
            inkCanvas.InkPresenter.InputProcessingConfiguration.Mode = InkInputProcessingMode.Inking;

            // Handlers to clear the selection when inking or erasing is detected
            inkCanvas.InkPresenter.StrokeInput.StrokeStarted += StrokeInput_StrokeStarted;
            inkCanvas.InkPresenter.StrokesErased += InkPresenter_StrokesErased;

            SizeChanged += Scenario3_SizeChanged;
        }
Beispiel #30
0
        public static Xaml.Run Control(this Trainer.Domain.Run item, bool isThumbnail = false)
        {
            var control = new Xaml.Run
            {
                Text = item.Value
            };

            if (isThumbnail)
            {
                control.FontSize = ThumbnailFontSize;
            }

            if (item.CharacterSpacing > 0)
            {
                control.CharacterSpacing = item.CharacterSpacing;
            }
            if (item.FontSize > 0 && !isThumbnail)
            {
                control.FontSize = item.FontSize;
            }
            if (!string.IsNullOrEmpty(item.FontStretch))
            {
                control.FontStretch = Helpers.ParseEnum <Windows.UI.Text.FontStretch>(item.FontStretch);
            }
            if (!string.IsNullOrEmpty(item.FontStyle))
            {
                control.FontStyle = Helpers.ParseEnum <Windows.UI.Text.FontStyle>(item.FontStyle);
            }
            if (!string.IsNullOrEmpty(item.FontWeight))
            {
                control.FontWeight = Helpers.ParseEnum <Windows.UI.Text.FontWeight>(item.FontWeight);
            }
            //if (!string.IsNullOrEmpty(item.Foreground)) control.Foreground = new SolidColorBrush(item.Foreground.GetColor());

            return(control);
        }
        private void UpdateContentsView(IEnumerable<LineViewModel> lines)
        {
            Uri severBaseUri = LightKindomHtmlClient.SeverBaseUri;
            ContentTextBlock.Blocks.Clear();
            bool prevLineBreakFlag = false;
            foreach (var line in lines)
            {
                var para = new Paragraph();
                para.SetValue(ParagrahViewModelProperty, line);
                if (!line.IsImage || line.Content == null)
                {
                    //if (line.HasComments)
                    //	para.Inlines.Add(new InlineUIContainer
                    //	{
                    //		Child = new SymbolIcon { Symbol = Symbol.Message },
                    //		Foreground = (SolidColorBrush)App.Current.Resources["AppAcentBrush"]
                    //	});
                    var run = new Run { Text = line.Content };
                    para.Inlines.Add(new Run { Text = CommentIndicator, FontFamily = SegoeUISymbolFontFamily, Foreground = TransparentBrush });
                    para.Inlines.Add(run);
                    //para.TextIndent = ContentTextBlock.FontSize * 1;
                    prevLineBreakFlag = true;
                    para.Margin = new Thickness(0, 0, 0, 10);
                }
                else
                {
                    //para.LineHeight = 2;
                    Size padding = new Size(ContentTextBlock.Padding.Left + ContentTextBlock.Padding.Right, ContentTextBlock.Padding.Top + ContentTextBlock.Padding.Bottom);
                    //bitmap.DownloadProgress +=
                    //var img = new Image
                    //{
                    //	Source = bitmap,
                    //	//MaxWidth = ContentColumns.ColumnWidth - padding.Width - 1,
                    //	//Height = ContentColumns.ColumnHeight - padding.Height - PictureMargin,
                    //	HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Stretch,
                    //	VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Stretch,
                    //	Stretch = Stretch.Uniform,
                    //};
                    //img.DataContext = img;
                    //Flyout.SetAttachedFlyout(img, this.Resources["ImagePreviewFlyout"] as Flyout);
                    //img.Tapped += Illustration_Tapped;
                    //GetLocalImageAsync(new Uri(severBaseUri, line.Content)).ContinueWith(async (task) =>
                    //{
                    //	await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal,()=>{
                    //		if (task.IsFaulted || task.Result == null)
                    //		{
                    //			img.Source = new BitmapImage(new Uri(severBaseUri, line.Content));
                    //		}
                    //		else
                    //		{
                    //			var localUri = task.Result;
                    //			img.Source = new BitmapImage(localUri);
                    //		}
                    //	});
                    //});


                    //var illustration = new Border
                    //{
                    //	HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Stretch,
                    //	VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Stretch,
                    //	Width = ContentColumns.ColumnWidth - padding.Width - 1,
                    //	Height = ContentColumns.ColumnHeight - padding.Height - PictureMargin,
                    //	Background = null,
                    //	BorderBrush = null,
                    //	Child = img,
                    //};

                    var illustration = LineViewCCGTemplate.LoadContent() as IllustrationView;
                    illustration.DataContext = line;
                    illustration.Width = ContentColumns.ColumnWidth - padding.Width - 1;
                    illustration.Height = ContentColumns.ColumnHeight - padding.Height - PictureMargin;
                    illustration.LoadIllustrationLine(line);
                    //LoadItemIllustation(illustration, line);
                    (illustration.FindName("ImageContent") as Image).SizeChanged += Image_SizeChanged;
                    //var bitmap = (illustration.GetFirstDescendantOfType<Image>().Source as BitmapImage);
                    //var pb = illustration.GetFirstDescendantOfType<ProgressBar>();
                    //bitmap.SetValue(BitmapLoadingIndicatorProperty, pb);

                    var inlineImg = new InlineUIContainer
                    {
                        Child = illustration // img
                    };

                    //inlineImg.FontSize = 620;
                    para.TextAlignment = TextAlignment.Center;
                    if (prevLineBreakFlag)
                    {
                        para.Inlines.Add(new Run { Text = "\n" });
                        illustration.Margin = new Thickness(0, 5, 0, 0);
                        //img.Margin = new Thickness(0, 5, 0, 0);
                    }
                    else
                    {
                        para.Inlines.Add(new Run { Text = " \n", FontSize = 5 });
                    }
                    para.Inlines.Add(inlineImg);

                    prevLineBreakFlag = false;
                }
                ContentTextBlock.Blocks.Add(para);
            }
            var ptr = ContentTextBlock.ContentStart;
            //ContentColumns.Measure(new Size(ContentScrollViewer.Height, double.PositiveInfinity));
            //ContentColumns.Children.Count;
            RichTextColumns.ResetOverflowLayout(ContentColumns, null);
        }
        /// <summary>
        /// Begins the cascading transition asynchronously (waits for it to complete).
        /// </summary>
        /// <returns></returns>
        public async Task BeginCascadingTransitionAsync()
        {
            var transparentBrush =
                new SolidColorBrush(Colors.Transparent);
            LayoutRoot.Children.Clear();

            var totalDelay = TimeSpan.FromSeconds(0);

            var cascadeStoryboard = new Storyboard();

            var previousCharacterRect = new Rect(-100000,0,0,0);

            for (int i = 0; i < Text.Length; )
            {
                int j = 1;

                while (
                    i + j < Text.Length &&
                    Text[i + j] == ' ')
                {
                    j++;
                }

                var tt = new TranslateTransform();

                if (CascadeIn)
                {
                    tt.Y = FromVerticalOffset;
                }

                TextBlock tb = CreateTextBlock(tt);

                if (i > 0)
                {
                    tb.Inlines.Add(
                        new Run
                        {
                            Text = Text.Substring(0, i),
                            Foreground = transparentBrush
                        });
                }
                
                var singleLetterRun = new Run { Text = Text.Substring(i, j) };
                tb.Inlines.Add(singleLetterRun);
                //.GetPositionAtOffset(1, LogicalDirection.Backward)

                if (i + j < Text.Length)
                {
                    tb.Inlines.Add(
                        new Run
                        {
                            Text = Text.Substring(i + j),
                            Foreground = transparentBrush
                        });
                }

                LayoutRoot.Children.Add(tb);

                DoubleAnimationUsingKeyFrames opacityAnimation = null;

                if (UseFade)
                {
                    opacityAnimation = new DoubleAnimationUsingKeyFrames();

                    if (CascadeIn)
                        tb.Opacity = 0;

                    Storyboard.SetTarget(opacityAnimation, tb);
                    Storyboard.SetTargetProperty(opacityAnimation, "UIElement.Opacity");
                    cascadeStoryboard.Children.Add(opacityAnimation);
                }

                DoubleAnimationUsingKeyFrames yAnimation = null;

                if (CascadeIn || CascadeOut)
                {
                    yAnimation = new DoubleAnimationUsingKeyFrames();
                    Storyboard.SetTarget(yAnimation, tt);
                    Storyboard.SetTargetProperty(yAnimation, "TranslateTransform.Y");
                    cascadeStoryboard.Children.Add(yAnimation);
                }

                DoubleAnimationUsingKeyFrames rotationAnimation = null;
                PlaneProjection planeProjection = null;

                if (UseRotation)
                {
                    await tb.WaitForNonZeroSizeAsync();
                    //await Task.Delay(100);

                    var aw = tb.ActualWidth;
                    var ah = tb.ActualHeight;

                    var characterRect = tb.GetCharacterRect(i);
                    tb.Projection = planeProjection = new PlaneProjection();
                    planeProjection.CenterOfRotationX = (characterRect.X + (characterRect.Width / 2)) / aw;
                    
                    if (CascadeIn)
                        planeProjection.RotationY = FromRotation;

                    //var pointer = tb.ContentStart.GetPositionAtOffset(offset, LogicalDirection.Forward);
                    //var rect = pointer.GetCharacterRect(LogicalDirection.Forward);

                    //while (
                    //    rect == previousCharacterRect ||
                    //    rect.X - previousCharacterRect.X < 4)
                    //{
                    //    offset++;
                    //    if (offset > tb.ContentEnd.Offset)
                    //        break;
                    //    pointer = tb.ContentStart.GetPositionAtOffset(offset, LogicalDirection.Forward);
                    //    rect = pointer.GetCharacterRect(LogicalDirection.Forward);
                    //}

                    //previousCharacterRect = rect;

                    //var x = rect.X;
                    //var y = rect.Y;
                    //var w = rect.Width;
                    //var h = rect.Height;

                    //tb.Projection = planeProjection = new PlaneProjection();
                    //planeProjection.CenterOfRotationX = (x + (w / 2)) / aw;
                    //planeProjection.RotationY = FromRotation;

                    //if (!headerPrinted)
                    //{
                    //    Debug.WriteLine("ActualWidth: {0}", aw);
                    //    Debug.WriteLine("ActualHeight: {0}\r\n", ah);
                    //    Debug.WriteLine("po\ti\tj\tx\ty\tw\th\tpx");
                    //    headerPrinted = true;
                    //}

                    //Debug.WriteLine(
                    //    "{0:F0}\t{1:F0}\t{2:F0}\t{3:F0}\t{4:F0}\t{5:F0}\t{6:F0}\t{7:F3}",
                    //    pointer.Offset, i, j, x, y, w, h, planeProjection.CenterOfRotationX);

                    rotationAnimation = new DoubleAnimationUsingKeyFrames();
                    Storyboard.SetTarget(rotationAnimation, planeProjection);
                    Storyboard.SetTargetProperty(rotationAnimation, "PlaneProjection.RotationY");
                    cascadeStoryboard.Children.Add(rotationAnimation);

                    if (CascadeIn)
                    {
                        rotationAnimation.KeyFrames.Add(
                            new DiscreteDoubleKeyFrame
                            {
                                KeyTime = totalDelay,
                                Value = FromRotation
                            });
                        rotationAnimation.KeyFrames.Add(
                            new EasingDoubleKeyFrame
                            {
                                KeyTime = totalDelay + CascadeInDuration,
                                EasingFunction = CascadeInEasingFunction,
                                Value = 0
                            });
                    }

                    if (CascadeOut)
                    {
                        rotationAnimation.KeyFrames.Add(
                            new DiscreteDoubleKeyFrame
                            {
                                KeyTime = totalDelay + (CascadeIn ? CascadeInDuration : TimeSpan.Zero) + HoldDuration,
                                Value = 0
                            });
                        rotationAnimation.KeyFrames.Add(
                            new EasingDoubleKeyFrame
                            {
                                KeyTime = totalDelay + (CascadeIn ? CascadeInDuration : TimeSpan.Zero) + HoldDuration + CascadeOutDuration,
                                EasingFunction = CascadeOutEasingFunction,
                                Value = ToRotation
                            });
                    }
                }

                if (CascadeIn)
                {
                    yAnimation.KeyFrames.Add(
                        new DiscreteDoubleKeyFrame
                        {
                            KeyTime = totalDelay,
                            Value = FromVerticalOffset
                        });
                    yAnimation.KeyFrames.Add(
                        new EasingDoubleKeyFrame
                        {
                            KeyTime = totalDelay + CascadeInDuration,
                            EasingFunction = CascadeInEasingFunction,
                            Value = 0
                        });

                    if (UseFade)
                    {
                        opacityAnimation.KeyFrames.Add(
                            new DiscreteDoubleKeyFrame
                            {
                                KeyTime = totalDelay,
                                Value = 0
                            });
                        opacityAnimation.KeyFrames.Add(
                            new EasingDoubleKeyFrame
                            {
                                KeyTime = totalDelay + CascadeInDuration,
                                EasingFunction = FadeInEasingFunction,
                                Value = 1.0
                            });
                    }
                }

                if (CascadeOut)
                {
                    yAnimation.KeyFrames.Add(
                        new DiscreteDoubleKeyFrame
                        {
                            KeyTime = totalDelay + (CascadeIn ? CascadeInDuration : TimeSpan.Zero) + HoldDuration,
                            Value = 0
                        });
                    yAnimation.KeyFrames.Add(
                        new EasingDoubleKeyFrame
                        {
                            KeyTime = totalDelay + (CascadeIn ? CascadeInDuration : TimeSpan.Zero) + HoldDuration + CascadeOutDuration,
                            EasingFunction = CascadeOutEasingFunction,
                            Value = ToVerticalOffset
                        });

                    if (UseFade)
                    {
                        opacityAnimation.KeyFrames.Add(
                            new DiscreteDoubleKeyFrame
                            {
                                KeyTime = totalDelay + (CascadeIn ? CascadeInDuration : TimeSpan.Zero) + HoldDuration,
                                Value = 1.00
                            });
                        opacityAnimation.KeyFrames.Add(
                            new EasingDoubleKeyFrame
                            {
                                KeyTime = totalDelay + (CascadeIn ? CascadeInDuration : TimeSpan.Zero) + HoldDuration + CascadeOutDuration,
                                EasingFunction = FadeOutEasingFunction,
                                Value = 0.0
                            });
                    }
                }

                totalDelay += CascadeInterval;
                i += j;
            }

            EventHandler<object> eh = null;
            eh = (s, e) =>
            {
                cascadeStoryboard.Completed -= eh;
                //LayoutRoot.Children.Clear();
                //var tb2 = CreateTextBlock(null);
                //tb2.Text = Text;
                //LayoutRoot.Children.Add(tb2);

#if CascadingTextBlock_REPEATFOREVER
                BeginCascadingTransition();
#else
                if (CascadeCompleted != null)
                    CascadeCompleted(this, EventArgs.Empty);
#endif
            };

            cascadeStoryboard.Completed += eh;
            await Task.Delay(StartDelay);
            await cascadeStoryboard.BeginAsync();
        }
 private static Span GenerateH3(HtmlNode node)
 {
     Span s = new Span();
     s.Inlines.Add(new LineBreak());
     Bold bold = new Bold();
     Run r = new Run() { Text = CleanText(node.InnerText) };
     bold.Inlines.Add(r);
     s.Inlines.Add(bold);
     s.Inlines.Add(new LineBreak());
     return s;
 }
        private void AddContentValue(string title, string description = null)
        {
            Run contentType = new Run();
            contentType.FontWeight = FontWeights.Bold;
            contentType.Text = title;
            ContentValue.Inlines.Add(contentType);

            if (description != null)
            {
                Run contentValue = new Run();
                contentValue.Text = description + Environment.NewLine;
                ContentValue.Inlines.Add(contentValue);
            }
        }
Beispiel #35
0
        public static Xaml.Paragraph Control(this Trainer.Domain.Paragraph item, bool isThumbnail = false)
        {
            var control = new Xaml.Paragraph();

            if (isThumbnail)
            {
                control.FontSize = ThumbnailFontSize;
            }

            if (item.CharacterSpacing > 0)
            {
                control.CharacterSpacing = item.CharacterSpacing;
            }
            if (item.FontSize > 0 && !isThumbnail)
            {
                control.FontSize = item.FontSize;
            }
            if (!string.IsNullOrEmpty(item.FontStretch))
            {
                control.FontStretch = Helpers.ParseEnum <Windows.UI.Text.FontStretch>(item.FontStretch);
            }
            if (!string.IsNullOrEmpty(item.FontStyle))
            {
                control.FontStyle = Helpers.ParseEnum <Windows.UI.Text.FontStyle>(item.FontStyle);
            }
            if (!string.IsNullOrEmpty(item.FontWeight))
            {
                control.FontWeight = Helpers.ParseEnum <Windows.UI.Text.FontWeight>(item.FontWeight);
            }
            //if (!string.IsNullOrEmpty(item.Foreground)) control.Foreground = new SolidColorBrush(item.Foreground.GetColor());

            if (item.LineHeight > 0)
            {
                control.LineHeight = item.LineHeight;
            }
            if (!string.IsNullOrEmpty(item.LineStackingStrategy))
            {
                control.LineStackingStrategy = Helpers.ParseEnum <Windows.UI.Xaml.LineStackingStrategy>(item.LineStackingStrategy);
            }
            //if (!string.IsNullOrEmpty(item.Margin)) control.Margin = Helpers.GetThickness(item.Margin);
            if (!string.IsNullOrEmpty(item.TextAlignment))
            {
                control.TextAlignment = Helpers.ParseEnum <Windows.UI.Xaml.TextAlignment>(item.TextAlignment);
            }
            if (item.TextIndent > 0)
            {
                control.TextIndent = item.TextIndent;
            }
            if (item.Text != null && item.Text.Any())
            {
                var run = new Xaml.Run {
                    Text = string.Join(Environment.NewLine, item.Text)
                };
                if (isThumbnail)
                {
                    run.FontSize = ThumbnailFontSize;
                }

                control.Inlines.Add(run);
            }

            if (item.Bold != null && item.Bold.Any())
            {
                foreach (var bold in item.Bold)
                {
                    control.Inlines.Add(bold.Control(isThumbnail));
                }
            }

            if (item.Hyperlink != null)
            {
                control.Inlines.Add(item.Hyperlink.Control(isThumbnail));
            }

            if (item.Run != null && item.Run.Any())
            {
                foreach (var run in item.Run)
                {
                    control.Inlines.Add(run.Control(isThumbnail));
                }
            }

            if (item.InlineUIContainer != null)
            {
                control.Inlines.Add(item.InlineUIContainer.Control());
            }

            return(control);
        }
Beispiel #36
0
 /// <summary>
 /// Helper for logging
 /// </summary>
 /// <param name="logEntry"></param>
 void appendLog(string logEntry)
 {
     Run r = new Run();
     r.Text = logEntry;
     Paragraph p = new Paragraph();
     p.Inlines.Add(r);
     logResults.Blocks.Add(p);
 }
Beispiel #37
0
        public static Paragraph HTMLtoRTF(string sHTML, StorageFolder storageFolder)
        {
            string[] ColorTable = new string[0];
            string[] FontTable = new string[0];
            int      lStart = 0, lEnd = 0, imgStart = 0, imgEnd = 0;
            string   sRTF = "", sText = "", imgText = "";
            int      lLen = 0, lCurrentToken = 0;
            string   sToken = "", sTemp = "";
            bool     bUseDefaultFace = false;
            Uri      _baseUri        = new Uri(storageFolder.Path.ToString() + "\\");

            Paragraph paragraph = new Paragraph();

            //var inlines = paragraph.Inlines;

            sHTML = cleanupSTYLE(sHTML);
            //Fix the HTML
            sHTML.Trim();
            sHTML = sHTML.Replace("<STRONG>", "<B>");
            sHTML = sHTML.Replace("</STRONG>", "</B>");
            sHTML = sHTML.Replace("<EM>", "<I>");
            sHTML = sHTML.Replace("</EM>", "</I>");
            sHTML = sHTML.Replace("\n", "");
            sHTML = sHTML.Replace("&nbsp;", "\\~");
            //sHTML = sHTML.Replace("<img", "<IMG>");
            //Initialize
            lLen   = sHTML.Length;
            lStart = 1;
            lEnd   = 1;
            //Parse the HTML
            for (lCurrentToken = 1; lCurrentToken < lLen; lCurrentToken++)
            {
                lStart = sHTML.IndexOf("<", lEnd);
                if (lStart < 0)
                {
                    goto Completed;
                }
                lEnd   = sHTML.IndexOf(">", lStart);
                sToken = sHTML.Substring(lStart, lEnd - lStart + 1).ToUpper();
                //Take action
                switch (sToken)
                {
                case "<B>":
                    sRTF = sRTF + "\\b1";
                    break;

                case "</B>":
                    sRTF = sRTF + "\\b0";
                    break;

                case "<I>":
                    sRTF = sRTF + "\\i1";
                    break;

                case "</I>":
                    sRTF = sRTF + "\\i0";
                    break;

                case "<U>":
                    sRTF = sRTF + "\\ul1";
                    break;

                case "</U>":
                    sRTF = sRTF + "\\ul0";
                    break;

                case "<TR>":
                    sRTF = sRTF + "\\intbl";
                    break;

                case "</TR>":
                    sRTF = sRTF + "\\row";
                    break;

                case "<TD>":
                case "</TD>":
                    sRTF = sRTF + "\\cell ";
                    break;

                case "<BR/>":
                case "</P>":
                    break;

                case "</SPAN>":
                    bUseDefaultFace = true;
                    break;

                case "<IMG>":
                    //Get the text
                    lEnd = sHTML.IndexOf(">", lEnd + 1);

                    sText    = sHTML.Substring(lStart, (lEnd - lStart) + 1);
                    imgStart = sText.IndexOf("\"", 0);
                    imgEnd   = sText.IndexOf("\"", imgStart + 1);
                    imgText  = (sText.Substring(imgStart, (imgEnd - imgStart) + 1)).Replace("\"", "");
                    Windows.UI.Xaml.Documents.Run run = new Windows.UI.Xaml.Documents.Run();
                    run.Text = "\n";
                    paragraph.Inlines.Add(run);
                    Image im = new Image();
                    im.Source = new Windows.UI.Xaml.Media.Imaging.BitmapImage(new Uri(_baseUri, imgText));
                    //im.Width = 240;
                    //im.Height = 200;
                    InlineUIContainer a = new InlineUIContainer();
                    a.Child = im;
                    paragraph.Inlines.Add(a);
                    run      = new Windows.UI.Xaml.Documents.Run();
                    run.Text = "\n";
                    paragraph.Inlines.Add(run);

                    break;

                default:
                    break;
                }
                //Get the text
                lStart = sHTML.IndexOf(">", lEnd);
                //Debug.WriteLine("lStart: " + lStart);
                if (lStart < 0)
                {
                    goto Completed;
                }
                lEnd = sHTML.IndexOf("<", lStart);
                //Debug.WriteLine("lEnd: " + lEnd);
                if (lEnd < 0)
                {
                    goto Completed;
                }
                sText = sHTML.Substring(lStart, (lEnd - lStart) + 1);
                sText = sText.Trim();
                sText = sText.Replace("<", "");
                sText = sText.Replace(">", "");
                if ((sText).Length >= 1)
                {
                    sText = sText.Substring(0, (sText).Length);
                    //check out for special characters
                    sText = sText.Replace("\\", "\\\\");
                    sText = sText.Replace("{", "\\{");
                    sText = sText.Replace("}", "\\}");
                    Windows.UI.Xaml.Documents.Run run = new Windows.UI.Xaml.Documents.Run();
                    run.Text = sText + "\n";
                    paragraph.Inlines.Add(run);
                    sRTF = sRTF + sText + "\n";
                }
            }
Completed:

            return(paragraph);
        }