c# - Network Activity Spinner Spins Forever -


i'm building xamarin forms app , have problem network activity spinner in status bar (ios) continuing spin forever. below code i'm using display loading screen.

private async task executeconfigurecampaigncommand()     {         if (isbusy)         {             return;         }          isbusy = true;         //configurecampaigncommand.changecanexecute();         bool showalert = false;         string campaign = null;          try         {             campaign = crosssecurestorage.current.getvalue(settingnames.campaign);              if (!string.isnullorempty(campaign))             {                 statusmessage = "blah";                 onpropertychanged("statusmessage");                  await task.delay(1000);                  statusmessage = "blah";                 onpropertychanged("statusmessage");                  await task.delay(700);                  statusmessage = "blah";                 onpropertychanged("statusmessage");                  await task.delay(500);                  messagingservice.current.sendmessage<string>(settingnames.navigationsales, campaign);             }         }         catch (exception e)         {             var abc = e;             showalert = true;         }                 {             isbusy = false;             //configurecampaigncommand.changecanexecute();         }          if (showalert)         {             await page.displayalert("uh oh :(", "unable load campaign.", "ok");         }     } 

this called command:

public command configurecampaigncommand     {                 {             return configurecampaigncommand ?? (configurecampaigncommand = new command(async () => await executeconfigurecampaigncommand(), () => { return !isbusy; }));         }     } 

which called onappearing:

protected override void onappearing()     {         base.onappearing();          viewmodel.configurecampaigncommand.execute(null);     } 

the logic fine - view expect loaded, network activity spinner continues spinning. if add 1 second delay:

                device.starttimer(timespan.frommilliseconds(1), () =>                 {                     messagingservice.current.sendmessage<string>(settingnames.navigationsales, campaign);                      return false;                 }); 

the spinner stops once new view loaded. if remove await task.delay's, spinner stops once view loaded, loading messages not visible user.

my question is, why network spinner continue?

whenever change isbusy

 onpropertychanged("isbusy"); 

as calling other properties not isbusy guess reason change doesn't picked up.


Comments

Popular posts from this blog

php - Permission denied. Laravel linux server -

google bigquery - Delta between query execution time and Java query call to finish -

python - Pandas two dataframes multiplication? -