Example #1
0
 private async void DownloadDataButton_Clicked(object sender, EventArgs e)
 {
     UserDialogs.Instance.ShowLoading("Downloading Data...");
     await Task.Run(async() =>
     {
         bool success = await Kucha.RefreshLocalData();
         Device.BeginInvokeOnMainThread(() =>
         {
             UserDialogs.Instance.HideLoading();
             if (success)
             {
                 UserDialogs.Instance.Toast("Data successfully downloaded!");
                 downloadDataButton.IsEnabled = false;
                 downloadStatusLabel.Text     = "Data from " + Kucha.GetDataTimeStamp().ToShortDateString();
                 if (!loginButton.IsEnabled)
                 {
                     continueButton.IsEnabled = true;
                 }
             }
             else
             {
                 UserDialogs.Instance.Toast("Data download failed. Please check your connectivity.");
             }
         });
     });
 }
Example #2
0
 private async void UpdateLocalDatabaseButton_Clicked(object sender, EventArgs e)
 {
     UserDialogs.Instance.ShowLoading("Downloading Data...");
     await Task.Run(async() =>
     {
         bool success = await Kucha.RefreshLocalData();
         Device.BeginInvokeOnMainThread(() =>
         {
             UserDialogs.Instance.HideLoading();
             if (success)
             {
                 UserDialogs.Instance.Toast("Download successful!");
                 downloadStatusLabel.Text = "Data from " + Kucha.GetDataTimeStamp().ToShortDateString();
             }
             else
             {
                 UserDialogs.Instance.Toast("Download failed. Please check connectivity.");
             }
         });
     });
 }