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 IncidentIcon_Tapped(object sender, EventArgs e) { CustomIncidentIcon icon = (CustomIncidentIcon)((Element)sender).Parent; var fileModel = claimViewModel.getIncidentIconFile(icon.index); var selectFileModel = claimViewModel.getIncidentSelectIconFile(); if (selectFileModel != null) { selectFileModel.Selected = false; } if (fileModel != null) { fileModel.Selected = true; } claimViewModel.PropertyChangeImages();; }