コード例 #1
0
ファイル: EditableNoteText.cs プロジェクト: J3057/MobileApp
                public object GetStyleValue(EditStyling.Style style)
                {
                    switch (style)
                    {
                    case EditStyling.Style.FontName:
                    {
                        return(PlatformLabel.Editable_GetFontName( ));
                    }

                    case EditStyling.Style.FontSize:
                    {
                        return(PlatformLabel.Editable_GetFontSize( ));
                    }

                    case EditStyling.Style.Underline:
                    {
                        return(PlatformLabel.Editable_HasUnderline( ));
                    }

                    case EditStyling.Style.RevealBox:
                    {
                        // here, we're basically saying "no, we're not a reveal box" so the system
                        // knows to upgrade us.
                        return(false);
                    }

                    case EditStyling.Style.BoldParagraph:
                    {
                        // for bolding the paragraph, forward this to the parent to see if it supports it
                        return(ParentControl.GetStyleValue(style));
                    }

                    case EditStyling.Style.UnderlineParagraph:
                    {
                        return(ParentControl.GetStyleValue(style));
                    }

                    case EditStyling.Style.BulletParagraph:
                    {
                        return(ParentControl.GetStyleValue(style));
                    }

                    case EditStyling.Style.BoldItalicizeParagraph:
                    {
                        return(ParentControl.GetStyleValue(style));
                    }

                    case EditStyling.Style.ItalicizeParagraph:
                    {
                        return(ParentControl.GetStyleValue(style));
                    }
                    }

                    return(null);
                }
コード例 #2
0
ファイル: EditableNoteText.cs プロジェクト: J3057/MobileApp
                public string Export(RectangleF parentPadding, float currYPos)
                {
                    // only export if there's valid text. If we're simply a blank space, or a URL glyph, we don't need to be saved.
                    if (string.IsNullOrWhiteSpace(PlatformLabel.Text) == false && PlatformLabel.Text != PrivateNoteConfig.CitationUrl_Icon)
                    {
                        // first get the text itself
                        string encodedText = HttpUtility.HtmlEncode(PlatformLabel.Text).Trim(new char[] { ' ' });

                        // setup note attributes
                        string attributeStrings = string.Format("FontName=\"{0}\" FontSize=\"{1}\"", PlatformLabel.Editable_GetFontName( ), PlatformLabel.Editable_GetFontSize( ));
                        if (PlatformLabel.Editable_HasUnderline( ))
                        {
                            attributeStrings += " Underlined=\"True\"";
                        }

                        // build the final string
                        return("<NT " + attributeStrings + ">" + encodedText + "</NT>");
                    }
                    else
                    {
                        return(string.Empty);
                    }
                }