Esempio n. 1
0
        public void Load()
        {
            var instance = new TouchAssetPlugin();

            instance.Setup(configuration);
            MvvmCross.Mvx.IoCProvider.RegisterSingleton <IAssetPlugin>(instance);

            MvvmCross.Mvx.IoCProvider.CallbackWhenRegistered <IMvxValueConverterRegistry>(RegisterValueConverters);
            MvvmCross.Mvx.IoCProvider.CallbackWhenRegistered <IMvxTargetBindingFactoryRegistry>(RegisterCustomBinding);
        }
Esempio n. 2
0
        private UIStringAttributes CreateAttributesByFont(ref NSMutableAttributedString text, IBaseFont font, FontIndexPair pair = null, FontTag tag = null)
        {
            UIStringAttributes stringAttributes = new UIStringAttributes {
            };

            //add the font
            stringAttributes.Font = TouchAssetPlugin.GetCachedFont(font);

            //add the color
            if (font.Color != System.Drawing.Color.Empty)
            {
                stringAttributes.ForegroundColor = font.Color.ToNativeColor();
            }

            if (pair != null && tag != null)
            {
                if (tag.FontAction == FontTagAction.Link)
                {
                    CreateLink(ref text, ref stringAttributes, font, pair);
                }
            }

            if (font is Font)
            {
                var extendedFont = font as Font;

                if (stringAttributes.ParagraphStyle == null)
                {
                    stringAttributes.ParagraphStyle = new NSMutableParagraphStyle();
                }

                if (extendedFont.Alignment != TextAlignment.None)
                {
                    UITextAlignment alignment = extendedFont.ToNativeAlignment();
                    stringAttributes.ParagraphStyle.Alignment = alignment;
                }

                //add the lineheight
                stringAttributes.ParagraphStyle.LineSpacing = GetPlatformLineHeight(font.Size, extendedFont.LineHeight);

                stringAttributes.ParagraphStyle.LineBreakMode = extendedFont.ToNativeLineBreakMode();

                stringAttributes.ParagraphStyle.LineHeightMultiple = extendedFont.LineHeightMultiplier.HasValue ? (float)extendedFont.LineHeightMultiplier.Value : 0f;
            }

            return(stringAttributes);
        }