コード例 #1
0
        /// <summary>
        /// To the font family.
        /// </summary>
        /// <param name="module">The module.</param>
        /// <returns></returns>
        public static FontFamily ToFontFamily(this IIconModule module)
        {
            var moduleType = module.GetType();

            if (_fontCache.ContainsKey(moduleType) == false)
            {
                _fontCache.Add(moduleType, new FontFamily($"ms-appx:///{module.GetType().GetTypeInfo().Assembly.GetName().Name}/{module.FontPath}#{module.FontFamily}"));
            }
            return(_fontCache[moduleType]);
        }
コード例 #2
0
        /// <summary>
        /// To the typeface.
        /// </summary>
        /// <param name="module">The module.</param>
        /// <param name="context">The context.</param>
        /// <returns></returns>
        public static Typeface ToTypeface(this IIconModule module, Context context)
        {
            var moduleType = module.GetType();

            if (_fontCache.ContainsKey(moduleType) == false)
            {
                _fontCache.Add(moduleType, Typeface.CreateFromAsset(context.Assets, module.FontPath));
            }
            return(_fontCache[moduleType]);
        }
コード例 #3
0
        /// <summary>
        /// To the font family.
        /// </summary>
        /// <param name="module">The module.</param>
        /// <returns></returns>
        public static FontFamily ToFontFamily(this IIconModule module)
        {
            var moduleType = module.GetType();

            if (!FontCache.ContainsKey(moduleType))
            {
                FontCache.Add(moduleType, new FontFamily($"ms-appx:///{moduleType.GetTypeInfo().Assembly.GetName().Name}/{module.FontPath}#{module.FontFamily.Replace(" Regular","")}"));
            }
            return(FontCache[moduleType]);
        }
コード例 #4
0
        /// <summary>
        /// To the typeface.
        /// </summary>
        /// <param name="module">The module.</param>
        /// <param name="context">The context.</param>
        /// <returns></returns>
        public static Typeface ToTypeface(this IIconModule module, Context context)
        {
            var moduleType = module.GetType();

            if (!FontCache.ContainsKey(moduleType))
            {
                FontCache.Add(moduleType, Typeface.CreateFromAsset(Application.Context.Assets, module.FontPath));
            }
            return(FontCache[moduleType]);
        }
コード例 #5
0
        /// <summary>
        /// To the font family.
        /// </summary>
        /// <param name="module">The module.</param>
        /// <returns></returns>
        public static FontFamily ToFontFamily(this IIconModule module)
        {
            var moduleType = module.GetType();

            if (!FontCache.ContainsKey(moduleType))
            {
                FontCache.Add(moduleType, new FontFamily(new Uri("pack://application:,,,/"), $"/#{module.FontFamily}"));
            }
            return(FontCache[moduleType]);
        }