OnResume()中如何控制事件的发生与否?
How to control to do events or not in OnResume()?
protected override void OnResume()
{
base.OnResume();
//if the page comes from another Activity, don't need to do ShowCurrentPage() to refresh page
//if I press the home button, then the page comes from home page , need to do ShowCurrentPage() to refresh page
ShowCurrentPage();
}
我的问题是,当我执行 OnResume() 以显示 Activity 时,如何区分主页或 Activity 的来源?
并且如果我需要根据 Activity 的不同来源在 OnResume() 中执行不同的事件,如果我必须在 ShowCurrentPage() 之前写 if{}
期待好的答案,谢谢!
Xamarin Forms:使用 Plugin.Settings 将值存储为设备中的本地数据,根据此值执行 ShowCurrentPage() 方法或不执行。当页面来自主页时,在 OnStop()
中设置值
本机应用程序:使用共享首选项...
protected override void OnResume()
{
base.OnResume();
//if the page comes from another Activity, don't need to do ShowCurrentPage() to refresh page
//if I press the home button, then the page comes from home page , need to do ShowCurrentPage() to refresh page
ShowCurrentPage();
}
我的问题是,当我执行 OnResume() 以显示 Activity 时,如何区分主页或 Activity 的来源?
并且如果我需要根据 Activity 的不同来源在 OnResume() 中执行不同的事件,如果我必须在 ShowCurrentPage() 之前写 if{}
期待好的答案,谢谢!
Xamarin Forms:使用 Plugin.Settings 将值存储为设备中的本地数据,根据此值执行 ShowCurrentPage() 方法或不执行。当页面来自主页时,在 OnStop()
中设置值本机应用程序:使用共享首选项...