private async Task TrySyncData() { try { SyncPage syncPage = new SyncPage(); await Navigation.PushModalAsync(syncPage); await syncPage.SyncAllData(); var list = await App.DB.GetForms(false); var msg = "Forms: " + list.Count; var listFields = await App.DB.AsyncDb.Table <DBFormField>().ToListAsync(); msg += " - Fields: " + listFields.Count; await this.DisplaySuccess("Sync Done: " + msg); if (Navigation.ModalStack.Contains(syncPage)) { await Navigation.PopModalAsync(); } App.Current.ShowMainPage(); } catch (Exception ex) { //Insights.Report(ex, Insights.Severity.Error); throw; } }
private async void BtnSync_Clicked(object sender, EventArgs e) { if (CanStart("BtnSync_Clicked")) { Progress(true); Settings.LastBaseDataSync = DateTime.MinValue; SyncPage syncPage = new SyncPage(); await Navigation.PushModalAsync(syncPage); await syncPage.SyncAllData(); if (Navigation.ModalStack.Contains(syncPage)) { await Navigation.PopModalAsync(); } Progress(false); //await App.Current.ShowUpdatePassword(); EndTask("BtnSync_Clicked"); } }
private async void btnImport_Clicked(object sender, EventArgs e) { const string CTaskName = "OnImportApplicantsClicked"; if (CanStart(CTaskName)) { if (await SyncPage.CheckForWifiOnly()) { aiLoading.IsVisible = true; aiLoading.IsRunning = true; btnImport.IsVisible = false; string searchTextSurname = edSurname.Text; string searchTextForenames = edFornames.Text; string searchTextPostcode = edPostcode.Text; string searchTextRecrOff = ""; if (Settings.GetBool(oPICSConfig.cfgKey_FCA_Apps_Filter_RecrOff, false)) { searchTextRecrOff = Settings.OfficerCode; } string searchTextSites = Settings.UserSites; if (string.IsNullOrWhiteSpace(searchTextSurname) || string.IsNullOrWhiteSpace(searchTextForenames)) { await this.DisplayError("Surname and Forename are both required to search for Applicants", PelDialogButton.Retry); } else { FindApplicantsSoapRequest req = new FindApplicantsSoapRequest { Surname = searchTextSurname, Forenames = searchTextForenames, Postcode = searchTextPostcode, RecruitmentOfficer = searchTextRecrOff, Sites = searchTextSites }; GenericResponse <List <DBApplicant> > applicants = Task.Run(() => App.soapService.FindApplicants(req)).Result; if ((applicants == null) || (applicants.Data == null) || (applicants.Data.Count == 0)) { await this.DisplayError("No applicants found matching your search options", PelDialogButton.Retry); } else { foreach (DBApplicant item in applicants.Data) { await App.DB.SaveApplicant(item); } await PruneOldApplicants(); await this.DisplaySuccess(applicants.Data.Count + " applicant(s) found"); await Navigation.PopAsync(); } await App.Current.ShowUpdatePassword(); } aiLoading.IsVisible = false; aiLoading.IsRunning = false; btnImport.IsVisible = true; } EndTask(CTaskName); } }