Rg.plugins.popup: How to return Data from PopupView(rg.plugin.popup) to base view(viewmodel) where it invoked?

Created on 24 Jul 2020  路  6Comments  路  Source: rotorgames/Rg.Plugins.Popup

Most helpful comment

@IaamRich
You could use MessagingCentre to allow for a publish/subscribe loosely coupled functionality to return data from a popup back to a view model.

Alternatively, I have created a plugin that adds this type of functionality to rg.plugins.popup, which you can view here

I would run from MessagingCentre as far as I can. If used too much it will just make your app a mess, to the point where you will not know who is talking to who.
AwaitablePopups seams interesting and simple to use.

You can also use a TaskCompletionSource, pass it to the popup and await the Task property of the TaskCompletionSource. And from within the popup set the result of the TaskCompletionSource.

All 6 comments

@IaamRich
You could use MessagingCentre to allow for a publish/subscribe loosely coupled functionality to return data from a popup back to a view model.

Alternatively, I have created a plugin that adds this type of functionality to rg.plugins.popup, which you can view here

@IaamRich
You could use MessagingCentre to allow for a publish/subscribe loosely coupled functionality to return data from a popup back to a view model.

Alternatively, I have created a plugin that adds this type of functionality to rg.plugins.popup, which you can view here

Thank you very much for your time and your answer to me! Thank you for your experience.

@IaamRich
You could use MessagingCentre to allow for a publish/subscribe loosely coupled functionality to return data from a popup back to a view model.

Alternatively, I have created a plugin that adds this type of functionality to rg.plugins.popup, which you can view here

I would run from MessagingCentre as far as I can. If used too much it will just make your app a mess, to the point where you will not know who is talking to who.
AwaitablePopups seams interesting and simple to use.

You can also use a TaskCompletionSource, pass it to the popup and await the Task property of the TaskCompletionSource. And from within the popup set the result of the TaskCompletionSource.

I would run from MessagingCentre as far as I can

While it does have its place, I would agree its probably a bit much for this scenario. Does get lost quite fast

You can also use a TaskCompletionSource, pass it to the popup and await the Task property of the TaskCompletionSource. And from within the popup set the result of the TaskCompletionSource.

This is kinda what I ended up doing with awaitablepopups, however, never thought to create the taskcompletionsource first and pass it in. Might be an easier solution than trying to convert things to use the plugin.

should we close this one? @IaamRich

@martijn00 can close.

Was this page helpful?
0 / 5 - 0 ratings