protected async override void OnAppearing() { base.OnAppearing(); if (this.fileModelList.Count == 0) { using (var scope = new ActivityIndicatorScope(activityIndicator, activityIndicatorPanel, true)) { var graphClient = AuthenticationHelper.GetGraphServiceClient(); var user = await graphClient.Users.Request().Filter($"mail eq '{contactEmail}'").Select("Id").GetAsync(); var userId = user.SingleOrDefault().Id; var driveItems = await graphClient.Users[userId].Drive.Root.Children.Request().GetAsync(); foreach (var item in driveItems) { string lastDateTime = item.LastModifiedDateTime != null ? ((DateTimeOffset)item.LastModifiedDateTime).LocalDateTime.ToString("MM/dd/yy H:mm:ss") : ""; FileViewModel model = new FileViewModel() { Name = item.Name, LastModifiedDateTime = $"Last Modified: {lastDateTime}" }; this.fileModelList.Add(model); } } } }
private async Task RefreshItems(bool showActivityIndicator, bool syncItems) { using (var scope = new ActivityIndicatorScope(syncIndicator, showActivityIndicator)) { workoutList.ItemsSource = await ReturnRefreshedItem(syncItems); } }
private async Task RefreshItems(bool showActivityIndicator) { Analytics.TrackEvent("Refreshing Event Item"); using (var scope = new ActivityIndicatorScope(syncIndicator, showActivityIndicator)) { todoList.ItemsSource = await manager.GetTodoItemsAsync(); } }
private async Task RefreshItems(bool showActivityIndicator) { using (var scope = new ActivityIndicatorScope(syncIndicator, showActivityIndicator)) { leadsList.ItemsSource = await manager.GetLeadsAsync(); } }
private async Task RefreshItems(bool showActivityIndicator, bool syncItems) { using (var scope = new ActivityIndicatorScope(syncIndicator, showActivityIndicator)) { todoList.ItemsSource = await UserAccountManager.GetUserBasedOnRoleAsync(syncItems, null); } }
private async Task RefreshItems(bool showActivityIndicator, bool syncItems) { using (var scope = new ActivityIndicatorScope(syncIndicator, showActivityIndicator)) { if (currentView == 0) { var temp = await dietManager.GetHistoryAsync(syncItems); listView.ItemsSource = temp.Where(dietItem => dietItem.Date.Year == DateTime.Now.Year && dietItem.Date.Month == DateTime.Now.Month && dietItem.Date.Day == DateTime.Now.Day); } if (currentView == 1) { var temp = await dietManager.GetHistoryAsync(syncItems); listView.ItemsSource = temp.Where(dietItem => (DateTime.Now - dietItem.Date).Days <= 7) .OrderByDescending(DietItem => DietItem.Date);; } if (currentView == 2) { var temp = await dietManager.GetHistoryAsync(syncItems); listView.ItemsSource = temp.OrderByDescending(DietItem => DietItem.Date); } } }
private void RefreshItems(bool showActivityIndicator) { using (var scope = new ActivityIndicatorScope(syncIndicator, showActivityIndicator)) { viewModel.LoadItemsCommand.Execute(null); } }
// refresh listview table items private async Task RefreshItems(bool showActivityIndicator) { using (var scope = new ActivityIndicatorScope(syncIndicator, showActivityIndicator)) { equipmentList.ItemsSource = await manager.GetTableAsync(this); } }
public async void CameraBtn_Tapped(object sender, EventArgs e) { try { using (var scope = new ActivityIndicatorScope(activityIndicator, activityIndicatorPanel, true)) { IPlatform platform = DependencyService.Get <IPlatform>(); string sourceImagePath = await platform.TakePhotoAsync(App.UIContext); if (sourceImagePath != null) { bool bCreateImage = this.fileName.Contains("{Correlation Id}"); this.fileName = this.fileName.Replace("{Correlation Id}", this.claimViewModel.Claim.Id); string copiedFilePath = await FileHelper.CopyFileAsync(this.claimViewModel.Claim.Id, fileName, sourceImagePath, MobileServiceHelper.msInstance.DataFilesPath); if (bCreateImage || claimViewModel.getKindImagesFileCount(type) == 0) { await claimViewModel.AddNewClaimFileAsync(fileName, copiedFilePath); } //replace only refresh claimViewModel.PropertyChangeImages(); } } } catch (Exception ex) { Utils.TraceException("Image upload failed. ", ex); await DisplayAlert("Image upload failed", "Image upload failed. Please try again later", "Ok"); } }
public async void OnAdd(object sender, EventArgs e) { using (var scope = new ActivityIndicatorScope(syncIndicator, t)) { devicedataList.ItemsSource = await crud.ExecuteTemperatureQuery("TemperatureLogger", "DeviceToCloudCollection"); } }
private async Task RefreshItems(bool showActivityIndicator) { using (var scope = new ActivityIndicatorScope(syncIndicator, showActivityIndicator)) { characterList.ItemsSource = await service.GetCharactersAsync(); } }
private async Task RefreshItems(bool showActivityIndicator, bool syncItems) { if (!Plugin.Connectivity.CrossConnectivity.Current.IsConnected) { await DisplayAlert("Error on Refresh", "Could not refresh data - check your network connection.", "OK"); return; } using (var scope = new ActivityIndicatorScope(syncIndicator, showActivityIndicator)) { var result = await manager.GetTodoItemsAsync(syncItems); if (result == null) { await DisplayAlert("Error on Refresh", "Could not refresh data - check your network connection.", "OK"); } else { todoList.ItemsSource = result.Items; if (result.Errors != null) { foreach (var error in result.Errors) { if (error.OperationKind == MobileServiceTableOperationKind.Update && error.Result != null) { await DisplayAlert("Sync Error", $"{error.Item["text"]}: this item has already been completed by someone else.", "OK"); } } } } } }
public async Task RefreshItems(bool showActivityIndicator, bool syncItems) { using (var scope = new ActivityIndicatorScope(syncIndicator, showActivityIndicator)) { Ideas.ItemsSource = await _manager.GetTodoItemsAsync(syncItems); } }
private async void NextButton_Clicked(object sender, EventArgs e) { try { using (var scope = new ActivityIndicatorScope(activityIndicator, activityIndicatorPanel, true)) { await claimViewModel.UpdateClaimIncidentDescriptionAsync(this.incidentDescription.Text); await claimViewModel.PushClaimFileChangesAsync(claimViewModel.Claim); await DisplayAlert("Thank you.", "Your claim has been submitted.", "Close"); ((VehiclesListView)claimViewModel.ParentPage).EmptyClaimViewModel(); //pop up to vehicles list view if (Navigation.NavigationStack.Count > 2) { for (int i = Navigation.NavigationStack.Count - 2; i > 1; i--) { Page removedPage = Navigation.NavigationStack[i]; Navigation.RemovePage(removedPage); } Navigation.PopAsync(); } } } catch (Exception ex) { Utils.TraceException("Failed to submit claim. ", ex); await DisplayAlert("Error", ex.Message, "Close"); } }
private async Task RefreshItems(bool showActivityIndicator, bool syncItems) { using (var scope = new ActivityIndicatorScope(syncIndicator, showActivityIndicator)) { students_list.ItemsSource = await azureService.GetStudentsAsync(syncItems); } }
private async void App_ImageTaken(object sender, EventArgs e) { //DEBUG //imgPreview.Source = App.Instance.image; if (null != App.Instance.ImageStream) { //Upload image using (var scope = new ActivityIndicatorScope(syncIndicator, true)) { if (await viewModel.UploadImageAsync(App.Instance.ImageStream)) { await DisplayAlert("Upload succeeded", "Image uploaded and will appear in the list shortly", "Ok"); OnRefresh(sender, e); } else { await DisplayAlert("Upload failed", "Image upload failed. Please try again later", "Ok"); } } } else { await DisplayAlert("Upload cancelled", "Image upload cancelled.", "Ok"); } }
protected override async void OnAppearing() { base.OnAppearing(); if (albumsList.ItemsSource == null) { using (var scope = new ActivityIndicatorScope(syncIndicator, true)) { string userId = "11111111-1111-1111-1111-111111111111"; if (Utils.IsOnline()) { //Call user custom controller: //controller to check user and add if new. Will return user ID anyway. //must be called prior to sync!!! userId = await App.MobileService.InvokeApiAsync<string>("ManageUser", System.Net.Http.HttpMethod.Get, null); #if !__WP__ || (__WP__ && DEBUG) viewModel.CheckUpdateNotificationRegistrationAsync(userId); #endif await (App.Current as App).SyncAsync(); } else await DisplayAlert("Working Offline", "Couldn't sync data - device is offline. Using local data. Please try again when data connection is back", "OK"); if (null == viewModel.User) await viewModel.GetUserAsync(Guid.Parse(userId)); await LoadItems(); } } }
protected override async void OnAppearing() { base.OnAppearing(); if (albumsList.ItemsSource == null) { using (var scope = new ActivityIndicatorScope(syncIndicator, true)) { string userId = "11111111-1111-1111-1111-111111111111"; if (Utils.IsOnline() && await Utils.SiteIsOnline()) { //Call user custom controller: //controller to check user and add if new. Will return user ID anyway. //must be called prior to sync!!! userId = await App.MobileService.InvokeApiAsync <string>("ManageUser", System.Net.Http.HttpMethod.Get, null); #if !__WP__ || (__WP__ && DEBUG) viewModel.CheckUpdateNotificationRegistrationAsync(userId); #endif await(App.Current as App).SyncAsync(); } else { await DisplayAlert("Working Offline", "Couldn't sync data - device is offline or Web API is not available. Using local data. Please try again when data connection is back", "OK"); } if (null == viewModel.User) { await viewModel.GetUserAsync(Guid.Parse(userId)); } await LoadItems(); } } }
private async Task RefreshItems(bool showActivityIndicator) { using (var scope = new ActivityIndicatorScope(syncIndicator, showActivityIndicator)) { groceryList.ItemsSource = await _manager.GetGrocerysAsync(); } }
private void RefreshItems(bool showActivityIndicator, bool syncItems) { using (var scope = new ActivityIndicatorScope(syncIndicator, showActivityIndicator)) { viewModel.GetShopPromotionCommand.Execute(null); } }
private async Task GetDetails() { try { using (var scope = new ActivityIndicatorScope(syncIndicator, true)) { HttpClient client = new HttpClient(); var response = await client.GetStringAsync("https://api.themoviedb.org/3/person/" + PersonID + "?api_key=b2eec0d3fe03eb1e8938782876209b54"); var actorDetails = JsonConvert.DeserializeObject <Person>(response); if (actorDetails != null) { Title = actorDetails.name; lblName.Text = actorDetails.name; lblBday.Text = actorDetails.birthday; lblBirthplace.Text = actorDetails.place_of_birth; lblBio.Text = actorDetails.biography; imgAvatar.Source = (!string.IsNullOrEmpty(actorDetails.profile_path) ? ImageSource.FromUri(new Uri("https://image.tmdb.org/t/p/w185/" + actorDetails.profile_path)) : ImageSource.FromFile("profile_generic_big")); } } } catch { } }
private async Task RefreshItems(bool v) { using (var scope = new ActivityIndicatorScope(syncIndicator, v)) { devicedataList.ItemsSource = await crud.ExecuteTemperatureQuery("TemperatureLogger", "DeviceToCloudCollection"); } }
public async void showRestaurant() { using (var scope = new ActivityIndicatorScope(syncIndicator, true)) //跑loading圈圈 { try { Restaurant_img.Source = ImageSource.FromFile("hourglass.png"); //顯示出loading圖片(沙漏) Object choose = await restaurant.GetRandomRestaurant(); //從資料庫隨機抓取一筆資料 if (choose == null) //防呆 { await DisplayAlert("找不到學校", "找不到學校QAQQQQQ", "確定"); Navigation.RemovePage(Navigation.NavigationStack[1]); } ResultData.BindingContext = (Restaurant)choose; //傳入資料 Restaurant_img.Source = ImageSource.FromUri(new Uri(((Restaurant)choose).Image)); //從網路載入圖片 Restaurant_img.Aspect = Aspect.AspectFit; //使圖片符合介面大小 } //例外處理 catch { await DisplayAlert("網路連線", "請連線網路後繼續", "確定"); Navigation.RemovePage(Navigation.NavigationStack[1]); } } }
private async Task RefreshItems2(bool showActivityIndicator, bool syncItems) { using (var scope = new ActivityIndicatorScope(syncIndicator, showActivityIndicator)) { modepicker.ItemsSource = await namagor.GetTodoItemsAsync(syncItems); } }
public async void CameraBtn_Tapped(object sender, EventArgs e) { try { using (var scope = new ActivityIndicatorScope(activityIndicator, activityIndicatorPanel, true)) { int selectIndex = claimViewModel.getIncidentSelectIconIndex(); IPlatform platform = DependencyService.Get <IPlatform>(); string sourceImagePath = await platform.TakePhotoAsync(App.UIContext); if (sourceImagePath != null) { string fileName = "claim-{Correlation Id}-0" + selectIndex.ToString(); fileName = fileName.Replace("{Correlation Id}", this.claimViewModel.Claim.Id); string copiedFilePath = await FileHelper.CopyFileAsync(this.claimViewModel.Claim.Id, fileName, sourceImagePath, MobileServiceHelper.msInstance.DataFilesPath); var fileModel = claimViewModel.getIncidentIconFile(selectIndex); if (fileModel == null) { await claimViewModel.AddNewClaimFileAsync(fileName, copiedFilePath); } //refresh claimViewModel.PropertyChangeImages();; } } } catch (Exception ex) { Utils.TraceException("Image upload failed. ", ex); await DisplayAlert("Image upload failed", "Image upload failed. Please try again later", "Ok"); } }
private async Task RefreshItems(bool showActivityIndicator, bool syncItems) { using (var scope = new ActivityIndicatorScope(syncIndicator, showActivityIndicator)) { todoList.ItemsSource = await manager.GetTodoItemsAsync(syncItems); } }
private async Task SyncItemsAsync(bool showActivityIndicator) { using (var scope = new ActivityIndicatorScope(syncIndicator, showActivityIndicator)) { await manager.SyncAsync(); await LoadItems(); } }
private async Task RefreshItems(bool showActivityIndicator, bool syncItems) { using (var scope = new ActivityIndicatorScope(syncIndicator, showActivityIndicator)) { var sid = App.authenticated != null ? App.authenticated.UserId : ""; todoList.ItemsSource = (await manager.GetTodoItemsAsync(syncItems && App.authenticated != null)).Where(i => i.Account == sid); } }
private async Task RefreshReminder(bool showActivityIndicator, bool syncItems) { using (var scope = new ActivityIndicatorScope(syncIndicator, showActivityIndicator)) { var temp = await reminderManager.GetReminderAsync(syncItems); reminderListView.ItemsSource = temp.OrderBy(reminder => reminder.Time); } }
private async Task RefreshHistory(bool showActivityIndicator, bool syncItems) { using (var scope = new ActivityIndicatorScope(syncIndicator, showActivityIndicator)) { var temp2 = await medicineHistoryManager.GetMedicinesAsync(); historyListView.ItemsSource = temp2.OrderByDescending(history => history.StartTime); } }
private async Task RefreshItems(bool showActivityIndicator, bool syncItems) { using (var scope = new ActivityIndicatorScope(syncIndicator, showActivityIndicator)) { var table = await manager.GetTodoItemsAsync(syncItems); todoList.ItemsSource = table.Where(student => student.Area == "Global"); } }
protected override async void OnAppearing() { base.OnAppearing(); if (imagesList.ItemsSource == null) { using (var scope = new ActivityIndicatorScope(syncIndicator, true)) { viewModel.Album = album; await LoadItemsAsync(); } } }
protected override async void OnAppearing() { base.OnAppearing(); //if (imagesWrap.ItemsSource == null) if (imagesList.ItemsSource == null) { using (var scope = new ActivityIndicatorScope(syncIndicator, true)) { viewModel.User = User; viewModel.Album = Album; await LoadItems(); } } App.Instance.ImageTaken += App_ImageTaken; }
private async void OnAddImage(object sender, EventArgs e) { DependencyService.Get<IPlatform>().LogEvent("AddImage"); using (var scope = new ActivityIndicatorScope(syncIndicator, true)) { try { IPlatform platform = DependencyService.Get<IPlatform>(); string sourceImagePath = await platform.TakePhotoAsync(App.UIContext); if (sourceImagePath != null) { var image = await App.Instance.AddImageAsync(viewModel.Album, sourceImagePath); viewModel.Images.Add(image); // add image, item will appear and image will upload asynchronously await SyncItemsAsync(true, refreshView: false); } } catch (Exception) { await DisplayAlert("Upload failed", "Image upload failed. Please try again later", "Ok"); } } }
private async void App_ImageTaken(object sender, EventArgs e) { //DEBUG //imgPreview.Source = App.Instance.image; if (null != App.Instance.ImageStream) { //Upload image using (var scope = new ActivityIndicatorScope(syncIndicator, true)) { if (await viewModel.UploadImageAsync(App.Instance.ImageStream)) { await DisplayAlert("Upload succeeded", "Image uploaded and will appear in the list shortly", "Ok"); OnRefresh(sender, e); } else { await DisplayAlert("Upload failed", "Image upload failed. Please try again later", "Ok"); } } } else await DisplayAlert("Upload cancelled", "Image upload cancelled.", "Ok"); }
private async Task SyncItemsAsync(bool showActivityIndicator) { using (var scope = new ActivityIndicatorScope(syncIndicator, showActivityIndicator)) { viewModel.ShowInputControl = false; if (Utils.IsOnline() && await Utils.SiteIsOnline()) { await App.Instance.SyncAlbumsAsync(); // should not await call to app.SyncAsync() because it should happen in the background var ignore = App.Instance.SyncAsync(); } else { await DisplayAlert("Working Offline", "Couldn't sync data - device is offline or Web API is not available. Please try again when data connection is back", "OK"); } await LoadItemsAsync(); } }
private async Task RefreshItems(bool showActivityIndicator, bool syncItems) { using (var scope = new ActivityIndicatorScope(syncIndicator, showActivityIndicator)) { todoList.ItemsSource = await manager.GetCarDetailsAsync("CurrentOrders", null, syncItems); } }
public async void OnSyncItems(object sender, EventArgs e) { using (var scope = new ActivityIndicatorScope(syncIndicator, true)) { await ViewModel.SyncItemsAsync(); } }
private async Task SyncItemsAsync(bool showActivityIndicator) { using (var scope = new ActivityIndicatorScope(syncIndicator, showActivityIndicator)) { HideAndCleanupInput(); if (Utils.IsOnline()) { await (App.Current as App).SyncAsync(); } else { await DisplayAlert("Working Offline", "Couldn't sync data - device is offline. Please try again when data connection is back", "OK"); } await LoadItems(); } }
private async Task RefreshItems(bool showActivityIndicator, bool syncItems) { using (var scope = new ActivityIndicatorScope(syncIndicator, showActivityIndicator)) { todoList.ItemsSource = await manager.GetCarDetailsAsync(queryCriteria, searchEntryContent, syncItems); } }
private async Task SyncItemsAsync(bool showActivityIndicator, bool refreshView) { using (var scope = new ActivityIndicatorScope(syncIndicator, showActivityIndicator)) { if (Utils.IsOnline() && await Utils.SiteIsOnline()) { await App.Instance.SyncAsync(); } else { await DisplayAlert("Working Offline", "Couldn't sync data - device may be offline", "OK"); } if (refreshView) { await LoadItemsAsync(); } } }