-
Notifications
You must be signed in to change notification settings - Fork 777
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Please use OnActiveAsync carefully #789
Comments
@a44281071 are you asking for OnViewLoaded to be an async event? |
@vb2ae |
I always stayed away from de the activate stuff because it was not async in
previous versions and created a StartAsync Method in my BaseViewModel.
Only drawback is that i have to implicit call the StartAsync
Reagrds
John Kattestaart
***@***.***
Op ma 27 dec. 2021 om 04:58 schreef SamTi(三台) ***@***.***>:
… @vb2ae <https://github.com/vb2ae>
Maybe something like "Before init/activ" and "After init/active" is
comfortable.
Any better idea?
—
Reply to this email directly, view it on GitHub
<#789 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACULQHSWRDHHFBXZTCH3KQLUS7P6TANCNFSM5KV3ZUOQ>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Perhaps we need a series of tutorials to demonstrate the best way to use the new asynchronous methods (active, deactive, handle event) |
One problem I've found with OnActivateAsync is, it is called just before IsActive is set to true (see Screen.ActivateAsync()). Edit: |
Please add some override methods for Active/Deactive. Like BeforActiveAsync/AfterActiveAsync.. Conductor method protected override async Task OnInitializeAsync(CancellationToken cancellationToken)
{
var box1 = new BoxViewModel(new MaterialViewModel { DisplayName = "child 111." });
await ActivateItemAsync(box1);
// box1 didn't active before this parent actived.
await base.OnInitializeAsync(cancellationToken);
}
public async Task ClickButtonAddChildAsync()
{
var box2 = new BoxViewModel(new MaterialViewModel { DisplayName = "child 222." });
await ActivateItemAsync(box2);
// box2 actived because this parent actived.
} |
+1 to that. How can I activate a sub item from within |
I'm having a similar issue migrating from 3.x to 4.x and we used to use |
What are you doing in the OnInitialize? trying to get an idea on what the use case is |
For example, running various async tasks like loading things from file etc. Things we want to show progress for. |
Or load data from webapi/db/remote-io. |
with my PR #898 the second method for Initialize is added as well. |
Like asp.net Blazor, It have InitAsync() and AfterAsync(bool firstRender). Used for 'Load remote data/webapi, init(bind) JS module'. |
We need to implement the following functions:
We can't use OnActiveAsync to load data. This will Put off the view display before async method finish. The solution is OnViewLoaded, BUT it can't await.
The text was updated successfully, but these errors were encountered: