Esempio n. 1
0
        private object ConvertValue(object value, object parameter)
        {
            IMvxLanguageBinder textProvider = value as IMvxLanguageBinder;
            TouchAssetPlugin   assetPlugin  = MvvmCross.Mvx.Resolve <IAssetPlugin>() as TouchAssetPlugin;

            if (value != null && parameter != null)
            {
                try{
                    //split the text and font definition
                    var values = parameter.ToString().Split(';');

                    return(assetPlugin.ParseToAttributedText(textProvider.GetText(values[0]), assetPlugin.GetFontByName(values[1])));
                }catch (Exception e) {
                    MvxBindingLog.Error("Problem parsing binding {0}", e.ToLongString());
                }
            }

            return(null);
        }
Esempio n. 2
0
        private object ConvertValue(object value, object parameter)
        {
            TouchAssetPlugin assetPlugin = MvvmCross.Mvx.IoCProvider.Resolve <IAssetPlugin>() as TouchAssetPlugin;

            if (value != null && parameter != null)
            {
                try
                {
                    var stringValue = value.ToString();
                    if (string.IsNullOrWhiteSpace(stringValue))
                    {
                        return(string.Empty);
                    }
                    var text = assetPlugin.ParseToAttributedText(value.ToString(), assetPlugin.GetFontByName(parameter.ToString()));
                    return(text);
                }
                catch (Exception e)
                {
                    MvxBindingLog.Error("Problem parsing binding {0}", e.ToLongString());
                }
            }

            return(null);
        }