Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

ChangeCanExecute is not working, why?

$
0
0

Hello there!

I have some commands on my ViewModels, and I realized that I can them multiple times at the same time, and is getting me some troubles with updating data from a WebApi.

The basic structure I have is something like:

        private Command _LoadCommand;
        public Command LoadCommand
        {
            get { return _LoadCommand ?? (_LoadCommand = new Command(async() => await ExecuteLoad())); }
        }

        private async Task ExecuteLoad ()
        {
                IsBusy = true;
                SendSignatureToSAP.ChangeCanExecute();

                await DoSomething();

                SendSignatureToSAP.ChangeCanExecute();
                IsBusy = false;
        }

I read about ChangeCanExecute and some documentation about Commands. It doesn't reccoment to call CanExecute(false) because it doesn't trigger an event or something like that. Also, I read that since a not-so-recent version of XF, it can have the value "null" and ChangeCanExecute only puts it into null again, but I don't know if this is true or if it makes sense.

So, what should I do to know if it's doing it right or not?
It's also allowing pages to trigger OnSizeAllocated when I'm in a child page, atop of it.

Thank you!


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>