Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Lifetime of view models - navigation away from viewmodel

$
0
0

I have a page where I can initiate a server synchronization - this can take some time.
In the meantime the user can navigate away from the page. This got me thinking about lifetime of view models.
I have failed to find some good resources on it - can anyone here shed some light on this subject?

I am using the mvvm helpers from Xamarin.Forms.Labs.

Can doing something like this in a Command on a viewmodel cause problems? :

        SynchronizeClientsCommand = new Command(() => {
            this.synchronizationTask.DoSynchronization( () => {
                // what happens if we navigate away from the page (and viewmodel) in the meantime - viewmodel still there?
            });
        });

Anyone know how to produce a scenario where viewmodels would be GC'ed or finalized?

Thanks


Viewing all articles
Browse latest Browse all 58056

Trending Articles