mvvmcross

MvvmCross localization: switch at runtime

馋奶兔 提交于 2020-01-12 05:50:08
问题 Is there a way to change the current language to another one at runtime ? For example: be able to switch when a button is clicked or when starting the app, get the user language and switch. How to tell the plugin to check the user language at startup ? Thanks in advance for your help. 回答1: Is there a way to change the current language to another one at runtime ? yes, call builder.LoadResources(whichLanguage) on your MvxTextProviderBuilder.cs For example: be able to switch when a button is

How can I use async in an mvvmcross view model?

夙愿已清 提交于 2020-01-11 16:38:06
问题 I have a long running process in an mvvmcross viewmodel and wish to make it async (http://msdn.microsoft.com/en-us/library/vstudio/hh191443.aspx). The async keyword is currently supported in the beta channel for Xamarin. Below is an example of how I'm currently implementing async. The IsBusy flag ccould be bound to a UI element and display a loading message. Is this the correct way? public class MyModel: MvxViewModel { private readonly IMyService _myService; private bool _isBusy; public bool

Upgrading MvvmCross to 5.2 shows error on CustomAndroidPresenter

∥☆過路亽.° 提交于 2020-01-11 11:57:04
问题 After upgrading MvvmCross from 5.1 to 5.2 , my CustomAndroidPresenter.cs is throwing a build error. What is causing this? CustomAndroidPresenter.cs: namespace TestPrjDroid { public class CustomAndroidPresenter : MvxAndroidViewPresenter { public override void Show(MvxViewModelRequest request) { if (request != null && request.PresentationValues != null) { if (request.PresentationValues.ContainsKey("MyCustomFlag")) { // Get intent from request and set flags to clear backstack. var intent = base

Custom bindable control in a MvvmCross Touch project

做~自己de王妃 提交于 2020-01-11 10:27:12
问题 I have a MvxBaseBindableCollectionViewCell which loads a xib that contains a custom button. I would like to be able to pass this custom button a ViewModel to bind to. Is this possible? I'm trying to acheive something like MyButton.ViewModel = ViewModel.ChildViewModel and have ViewModel.ChildViewModel.Name show as the button title. 回答1: If you want to custom bind a cell, then there's a tutorial on this in http://slodge.blogspot.co.uk/2013/01/uitableviewcell-using-xib-editor.html If you want to

how to bind an image src to resource drawable image with Mvvmcross?

狂风中的少年 提交于 2020-01-10 04:52:15
问题 I'm trying to bind an image's src. I have tried using MvxHttpImageView like this <Mvx.MvxHttpImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/iconeView" local:MvxBind="{'ImageUrl':{'Path':'ImgSrc'}}" /> with public string ImgSrc { get {return "@res/drawable/icon.png"; } } I have tried several other ImgSrc and still don't have any result. icon.png is in my Resources/Drawable directory and is an AndroidResource any help will be great ! Thanks

MvvmCross initialization

﹥>﹥吖頭↗ 提交于 2020-01-09 08:01:24
问题 In question Using MvvmCross from content providers and activities I wanted to know of how to initialize the MvvmCross system. The answer given worked then, but with recent updates of MvvmCross the function which I used (MvxAndroidSetupSingleton.GetOrCreateSetup()) has been deprecated. I have now changed my initialization and it seems to work so far, but is it correct and proper? Should I do things differently to improve portability? Setup class, in platform specific DLL for Android: public

MvvmCross - How to get iOS Views to load from a different assembly?

生来就可爱ヽ(ⅴ<●) 提交于 2020-01-06 19:57:22
问题 I am trying to get the Views in my xamarin-forms + mvvmcross project to load correctly with no luck. Project structure breakdown: Project: Shared.Core - 100% cross platform code, view models, models, etc.. Project: Shared.Mobile - Xamarin-forms views Project: iOS - uses shared views Project: Android - uses shared views Project: UWP - uses shared views Project: WPF - uses WPF native views I have a working WPF project using mvvmcross and am trying to get the mobile going starting with iOS. The

MvvmCross HTTP DownloadCache with authentication

天涯浪子 提交于 2020-01-06 14:07:26
问题 In my app, the user need to be authenticated on the server to download data using WebAPIs. The MvvmCross DownloadCache plugin seems to handle only basic HTTP GET queries. I can't add my authentication token in the url as it's a big SAML token. How can I add a HTTP header to queries done through DownloadCache plugin ? With the current version I think I should inject my own IMvxHttpFileDownloader but I'm looking for an easier solution. Injecting my own MvxFileDownloadRequest would be better

MVVMCross Android 10.0 (Q) MainActivity exception crash on SetContentView()

喜夏-厌秋 提交于 2020-01-06 05:16:24
问题 One of the massive projects I am helping with, uses MvvmCross v5.2.1. When we target the framework Android 10.0 (API Level 29) (Q), as soon as the OnCreate() lifecycle function of the MainActivity runs, an exception crash happens on the line SetContentView(Resource.Layout.activity_main) . A part of the exception reads java.lang.NoSuchFieldException: No field mConstructorArgs in class Landroid/view/LayoutInflater; (declaration of 'android.view.LayoutInflater' appears in /system/framework

MvvmCross: MvxImageViewLoader how to set DefaultImagePath property

♀尐吖头ヾ 提交于 2020-01-06 02:38:48
问题 How can I set the DefaultImagePath on MvxImageViewLoader? How can I get the LocalResourcePath for an UImage? var imageViewLoader = new MvxImageViewLoader(() => imageView); imageViewLoader.DefaultImagePath = UIImage.FromBundle("images/Default.png"); imageViewLoader.ErrorImagePath = UIImage.FromBundle("images/Error.png"); 回答1: Using resource image paths with is discussed in Using MvxImageViewLoader to load a resource image, is it possible? using the res: prefix imageViewLoader.DefaultImagePath