Ejemplo n.º 1
0
        private static void SetTextViewTextInner(int textViewId, TextView textView, IMvxLanguageBinder languageBinder, string key)
        {
            if (textView == null)
            {
                MvxBindingTrace.Trace(MvxTraceLevel.Error, "textView not found for binding " + textViewId);
                return;
            }

            textView.Text = languageBinder.GetText(key).Replace("\r", "\n");
        }
        /// <summary>
        ///     Constructor
        /// </summary>
        public DesignTimeAccountListViewModel(IMvxLanguageBinder textSource)
        {
            TextSource       = textSource;
            IncludedAccounts = new ObservableCollection <AccountViewModel>
            {
                new AccountViewModel(new Account())
                {
                    Name           = "Sparkonto",
                    CurrentBalance = 1256.25,
                    Iban           = "CH12 12356 FX12 5123"
                }
            };

            ViewActionViewModel = new AccountListViewActionViewModel(null, null);
            BalanceViewModel    = new DesignTimeBalanceViewModel();
        }
Ejemplo n.º 3
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);
        }
 private static string GetTextCommon(IMvxLanguageBinder source, string which)
 {
     return((string)_converter.Convert(source, typeof(string), which, CultureInfo.CurrentUICulture));
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Sets the TextView text to a localized version of <paramref name="key"/>.
 /// </summary>
 public static void SetText(this TextView view, IMvxLanguageBinder languageBinder, string key) {
     view.Text = languageBinder.GetText(key).Replace("\r", "\n");
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Constructor that should be called when registering an instance of this class with the DI service.
 /// </summary>
 /// <param name="namespaceName">Namespace containing the shared text resource(s).</param>
 /// <param name="sharedFilename">Name of the file containing the shared text resource(s) used to override the default filename ('Shared').</param>
 public SharedTextProvider(string namespaceName, string sharedFilename)
 {
     _namespaceName  = namespaceName;
     _languageBinder = new MvxLanguageBinder(_namespaceName, sharedFilename);
 }
Ejemplo n.º 7
0
 public SharedTextProvider()
 {
     _namespaceName  = ExTextProvider.GeneralNamespace;
     _languageBinder = new MvxLanguageBinder(_namespaceName, ExTextProvider.SharedNamespace);
 }
Ejemplo n.º 8
0
        public static void SetTextViewText(this View view, int textViewId, IMvxLanguageBinder languageBinder, string key)
        {
            var textView = view.FindViewById <TextView>(textViewId);

            SetTextViewTextInner(textViewId, textView, languageBinder, key);
        }