MvvmCross: How to pass Android context down to MvxCommand?

前端 未结 1 1412
时光说笑
时光说笑 2021-02-10 09:27

I have created a service interface:

public interface IMessageDialogService
{
    void ShowDialog(object context,string title,string message,string buttonTitle);
         


        
相关标签:
1条回答
  • 2021-02-10 10:20

    After inspecting the source for the WebBrowserTask, it looks like I can always grab the current Activity by:

    var activity = Mvx.Resolve<IMvxAndroidCurrentTopActivity> ().Activity;
    

    so I don't have to pass it down, but have my implementation of IMessageDialogService on Android grab it and use it to display the message dialog.

    0 讨论(0)
提交回复
热议问题