Messenger:如何等待消息被处理?
Messenger: How to wait for messages to be processed?
我有一个 Xamarin.Android 使用 MVVMLight 信使的应用程序。
该应用程序也在使用后台服务。
应用程序和服务都注册到 StopApplicationAndServiceMessage 消息:
Messenger.Default.Register<StopApplicationAndServiceMessage>(...)
他们每个人都将自定义方法传递给第二个参数。
应用程序菜单有一个选项可以退出发布 StopApplicationAndServiceMessage 消息的应用程序。
Messenger.Default.Send(new StopApplicationAndServiceMessage(reason));
在应用中处理消息时,有没有办法等待for/ensure后台服务处理完消息?
感谢任何帮助。
Register方法中设置的第二个参数是用来保证消息接收到的。
Messenger.Default.Register<StopApplicationAndServiceMessage>(
this,
message =>
{
// message processed here .
});
我有一个 Xamarin.Android 使用 MVVMLight 信使的应用程序。
该应用程序也在使用后台服务。
应用程序和服务都注册到 StopApplicationAndServiceMessage 消息:
Messenger.Default.Register<StopApplicationAndServiceMessage>(...)
他们每个人都将自定义方法传递给第二个参数。
应用程序菜单有一个选项可以退出发布 StopApplicationAndServiceMessage 消息的应用程序。
Messenger.Default.Send(new StopApplicationAndServiceMessage(reason));
在应用中处理消息时,有没有办法等待for/ensure后台服务处理完消息?
感谢任何帮助。
Register方法中设置的第二个参数是用来保证消息接收到的。
Messenger.Default.Register<StopApplicationAndServiceMessage>(
this,
message =>
{
// message processed here .
});