private async void PullData() { int total = 16; int current = 0; IsBusy = true; CurrentStatus = $"connecting..."; var practice = await _activationService.GetLocal(Address); if (null != practice) { try { var devicePrefix = await _activationService.AttemptEnrollDevice(Address, RegisteredDevice); if (!string.IsNullOrEmpty(devicePrefix)) { _deviceSetupService.UpdateCode(devicePrefix); _settings.AddOrUpdateValue("livehts.devicecode", devicePrefix); } } catch (Exception e) { } current++; CurrentStatus = showPerc("Metas", current, total); var meta = await _metaSyncService.GetMetaData(Address); _syncDataService.UpdateMeta(meta); current++; CurrentStatus = showPerc("Counties", current, total); var counties = await _metaSyncService.GetCounties(Address); _syncDataService.Update(counties); current++; CurrentStatus = showPerc("Categories", current, total); var categories = await _metaSyncService.GetCategories(Address); _syncDataService.Update(categories); current++; CurrentStatus = showPerc("Items", current, total); var items = await _metaSyncService.GetItems(Address); _syncDataService.Update(items); current++; CurrentStatus = showPerc("Category Items", current, total); var catitems = await _metaSyncService.GetCatItems(Address); _syncDataService.Update(catitems); current++; CurrentStatus = showPerc("Modules", current, total); var modules = await _formsSyncService.GetModules(Address); _syncDataService.UpdateModules(modules); current++; CurrentStatus = showPerc("Forms", current, total); var forms = await _formsSyncService.GetForms(Address); _syncDataService.UpdateForms(forms); current++; CurrentStatus = showPerc("Concepts", current, total); var concepts = await _formsSyncService.GetConcepts(Address); _syncDataService.UpdateConcepts(concepts); current++; CurrentStatus = showPerc("Questions", current, total); var questions = await _formsSyncService.GetQuestions(Address); _syncDataService.UpdateQuestions(questions); current++; current++; current++; CurrentStatus = showPerc("Users", current, total); var users = await _emrService.GetUsers(Address); _deviceSetupService.SaveUsers(users); current++; CurrentStatus = showPerc("cohort lists", current, total); var cohorts = await _cohortSyncService.GetCohorts(Address); _syncDataService.Update(cohorts); CurrentStatus = "done!"; _dialogService.ShowToast("completed successfully"); } else { IsBusy = false; CurrentStatus = $"connection failed !!"; _dialogService.Alert("Could not connect to server"); } IsBusy = false; }