private async Task Delete(object obj) { var editorPage = obj as ImageEditorPageWithoutDetail; var result = await Shell.Current.DisplayAlert( "Alert", "Are you sure you want to remove?", "Yes", "No"); if (result) { if (imageData.FormType == "VP") { if (App.IsInvasive == false) { await VisualProjectLocationPhotoDataStore.DeleteItemAsync(VisualProjectLocationPhotoItems[i], imageData.IsEditVisual); } else { await InvasiveVisualProjectLocationPhotoDataStore.DeleteItemAsync(VisualProjectLocationPhotoItems[i], imageData.IsEditVisual); } if (App.IsInvasive == false) { VisualProjectLocationPhotoItems = new ObservableCollection <VisualProjectLocationPhoto>(await VisualProjectLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualProjectLocationPhoto.VisualLocationId, false)); } else { VisualProjectLocationPhotoItems = new ObservableCollection <VisualProjectLocationPhoto>(await InvasiveVisualProjectLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualProjectLocationPhoto.VisualLocationId, false)); } i--; int Count = VisualProjectLocationPhotoItems.Count; if (Count == 0) { await App.Current.MainPage.Navigation.PopAsync(); } if (Count == 1) { i = 1; await Prv(obj); } if (i == Count - 1) { //i = 0; await Prv(obj); } else { await Next(obj); } //int Count = new ObservableCollection<VisualProjectLocationPhoto>(await VisualProjectLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualProjectLocationPhoto.VisualID)).Count; //if (Count != 0) // await Next(obj); //else // await App.Current.MainPage.Navigation.PopAsync(); } else if (imageData.FormType == "VB") { if (App.IsInvasive == false) { await VisualBuildingLocationPhotoDataStore.DeleteItemAsync(VisualBuildingLocationPhotoItems[i]); } else { await InvasiveVisualBuildingLocationPhotoDataStore.DeleteItemAsync(VisualBuildingLocationPhotoItems[i]); } if (App.IsInvasive == false) { VisualBuildingLocationPhotoItems = new ObservableCollection <VisualBuildingLocationPhoto>(await VisualBuildingLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualBuildingLocationPhoto.VisualBuildingId, false)); } else { VisualBuildingLocationPhotoItems = new ObservableCollection <VisualBuildingLocationPhoto>(await InvasiveVisualBuildingLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualBuildingLocationPhoto.VisualBuildingId, false)); } i--; //int Count = new ObservableCollection<VisualBuildingLocationPhoto>(await VisualBuildingLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualBuildingLocationPhoto.VisualID)).Count; //if (Count != 0) // await Next(obj); //else // await App.Current.MainPage.Navigation.PopAsync(); int Count = VisualBuildingLocationPhotoItems.Count; if (Count == 0) { await App.Current.MainPage.Navigation.PopAsync(); } if (Count == 1) { i = 1; await Prv(obj); } if (i == Count - 1) { await Prv(obj); } else { await Next(obj); } } else if (imageData.FormType == "VA") { if (App.IsInvasive == false) { await VisualApartmentLocationPhotoDataStore.DeleteItemAsync(VisualApartmentLocationPhotoItems[i]); } else { await InvasiveVisualApartmentLocationPhotoDataStore.DeleteItemAsync(VisualApartmentLocationPhotoItems[i]); } if (App.IsInvasive == false) { VisualApartmentLocationPhotoItems = new ObservableCollection <VisualApartmentLocationPhoto>(await VisualApartmentLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualApartmentLocationPhoto.VisualApartmentId, false)); } else { VisualApartmentLocationPhotoItems = new ObservableCollection <VisualApartmentLocationPhoto>(await InvasiveVisualApartmentLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualApartmentLocationPhoto.VisualApartmentId, false)); } i--; int Count = VisualApartmentLocationPhotoItems.Count; if (Count == 0) { await App.Current.MainPage.Navigation.PopAsync(); } if (Count == 1) { i = 1; await Prv(obj); } if (i == Count - 1) { await Prv(obj); } else { await Next(obj); } //int Count = new ObservableCollection<VisualApartmentLocationPhoto>(await VisualApartmentLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualApartmentLocationPhoto.VisualID)).Count; //if (Count != 0) // await Next(obj); //else // await App.Current.MainPage.Navigation.PopAsync(); } if (imageData.FormType == "P") { await ProjectCommonLocationImagesDataStore.DeleteItemAsync(ProjectCommonLocationImagesItems[i]); ProjectCommonLocationImagesItems = new ObservableCollection <ProjectCommonLocationImages>(await ProjectCommonLocationImagesDataStore.GetItemsAsyncByProjectLocationId(imageData.ProjectCommonLocationImages.ProjectLocationId)); i--; int Count = ProjectCommonLocationImagesItems.Count; if (Count == 0) { await App.Current.MainPage.Navigation.PopAsync(); } if (Count == 1) { i = 1; await Prv(obj); } if (i == Count - 1) { await Prv(obj); } else { await Next(obj); } //int Count = new ObservableCollection<ProjectCommonLocationImages>(await ProjectCommonLocationImagesDataStore.GetItemsAsyncByProjectLocationId(imageData.ProjectCommonLocationImages.ProjectLocationId)).Count; //if (Count != 0) // await Next(obj); //else // await App.Current.MainPage.Navigation.PopAsync(); } else if (imageData.FormType == "B") { await BuildingCommonLocationImagesDataStore.DeleteItemAsync(BuildingCommonLocationImagesItems[i]); BuildingCommonLocationImagesItems = new ObservableCollection <BuildingCommonLocationImages>(await BuildingCommonLocationImagesDataStore.GetItemsAsyncByBuildingId(imageData.BuildingCommonLocationImages.BuildingLocationId)); i--; // int Count = new ObservableCollection<BuildingCommonLocationImages>(await BuildingCommonLocationImagesDataStore.GetItemsAsyncByBuildingId(imageData.BuildingCommonLocationImages.BuildingId)).Count; // if (Count != 0) // await Next(obj); // else // await App.Current.MainPage.Navigation.PopAsync(); int Count = BuildingCommonLocationImagesItems.Count; if (Count == 0) { await App.Current.MainPage.Navigation.PopAsync(); } if (Count == 1) { i = 1; await Prv(obj); } if (i == Count - 1) { await Prv(obj); } else { await Next(obj); } } else if (imageData.FormType == "A") { await BuildingApartmentImagesDataStore.DeleteItemAsync(BuildingApartmentImagesItems[i]); BuildingApartmentImagesItems = new ObservableCollection <BuildingApartmentImages>(await BuildingApartmentImagesDataStore.GetItemsAsyncByApartmentID(imageData.BuildingApartmentImages.BuildingApartmentId)); i--; //int Count = new ObservableCollection<BuildingApartmentImages>(await BuildingApartmentImagesDataStore.GetItemsAsyncByApartmentID(imageData.BuildingApartmentImages.ApartmentID)).Count; //if (Count != 0) // await Next(obj); //else // await App.Current.MainPage.Navigation.PopAsync(); int Count = BuildingApartmentImagesItems.Count; if (Count == 0) { await App.Current.MainPage.Navigation.PopAsync(); } if (Count == 1) { i = 1; await Prv(obj); } if (i == Count - 1) { await Prv(obj); } else { await Next(obj); } } } }
public async Task Load() { if (imageData.FormType == "VP") { if (App.IsInvasive == false) { VisualProjectLocationPhotoItems = new ObservableCollection <VisualProjectLocationPhoto>(await VisualProjectLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualProjectLocationPhoto.VisualLocationId, false)); } else { VisualProjectLocationPhotoItems = new ObservableCollection <VisualProjectLocationPhoto>(await InvasiveVisualProjectLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualProjectLocationPhoto.VisualLocationId, false)); } i = VisualProjectLocationPhotoItems.IndexOf(VisualProjectLocationPhotoItems.Where(c => c.Id == imageData.VisualProjectLocationPhoto.Id).Single()); //imageData.VisualProjectLocationPhoto = VisualProjectLocationPhotoItems[i]; SelectedImage = VisualProjectLocationPhotoItems[i].ImageUrl; } else if (imageData.FormType == "VB") { if (App.IsInvasive == false) { VisualBuildingLocationPhotoItems = new ObservableCollection <VisualBuildingLocationPhoto>(await VisualBuildingLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualBuildingLocationPhoto.VisualBuildingId, false)); } else { VisualBuildingLocationPhotoItems = new ObservableCollection <VisualBuildingLocationPhoto>(await InvasiveVisualBuildingLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualBuildingLocationPhoto.VisualBuildingId, false)); } i = VisualBuildingLocationPhotoItems.IndexOf(VisualBuildingLocationPhotoItems.Where(c => c.Id == imageData.VisualBuildingLocationPhoto.Id).Single()); //imageData.VisualProjectLocationPhoto = VisualProjectLocationPhotoItems[i]; SelectedImage = VisualBuildingLocationPhotoItems[i].ImageUrl; } else if (imageData.FormType == "VA") { if (App.IsInvasive == false) { VisualApartmentLocationPhotoItems = new ObservableCollection <VisualApartmentLocationPhoto>(await VisualApartmentLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualApartmentLocationPhoto.VisualApartmentId, false)); } else { VisualApartmentLocationPhotoItems = new ObservableCollection <VisualApartmentLocationPhoto>(await InvasiveVisualApartmentLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualApartmentLocationPhoto.VisualApartmentId, false)); } i = VisualApartmentLocationPhotoItems.IndexOf(VisualApartmentLocationPhotoItems.Where(c => c.Id == imageData.VisualApartmentLocationPhoto.Id).Single()); //imageData.VisualProjectLocationPhoto = VisualProjectLocationPhotoItems[i]; SelectedImage = VisualApartmentLocationPhotoItems[i].ImageUrl; } else if (imageData.FormType == "P") { ProjectCommonLocationImagesItems = new ObservableCollection <ProjectCommonLocationImages>(await ProjectCommonLocationImagesDataStore.GetItemsAsyncByProjectLocationId(imageData.ProjectCommonLocationImages.ProjectLocationId)); i = ProjectCommonLocationImagesItems.IndexOf(ProjectCommonLocationImagesItems.Where(c => c.Id == imageData.ProjectCommonLocationImages.Id).Single()); //imageData.VisualProjectLocationPhoto = VisualProjectLocationPhotoItems[i]; SelectedImage = ProjectCommonLocationImagesItems[i].ImageUrl; } else if (imageData.FormType == "B") { BuildingCommonLocationImagesItems = new ObservableCollection <BuildingCommonLocationImages>(await BuildingCommonLocationImagesDataStore.GetItemsAsyncByBuildingId(imageData.BuildingCommonLocationImages.BuildingLocationId)); i = BuildingCommonLocationImagesItems.IndexOf(BuildingCommonLocationImagesItems.Where(c => c.Id == imageData.BuildingCommonLocationImages.Id).Single()); //imageData.VisualProjectLocationPhoto = VisualProjectLocationPhotoItems[i]; SelectedImage = BuildingCommonLocationImagesItems[i].ImageUrl; } else if (imageData.FormType == "A") { BuildingApartmentImagesItems = new ObservableCollection <BuildingApartmentImages>(await BuildingApartmentImagesDataStore.GetItemsAsyncByApartmentID(imageData.BuildingApartmentImages.BuildingApartmentId)); i = BuildingApartmentImagesItems.IndexOf(BuildingApartmentImagesItems.Where(c => c.Id == imageData.BuildingApartmentImages.Id).Single()); //imageData.VisualProjectLocationPhoto = VisualProjectLocationPhotoItems[i]; SelectedImage = BuildingApartmentImagesItems[i].ImageUrl; } }
private async Task DeleteImageCommandCommandExecute(VisualBuildingLocationPhoto parm) { var result = await Shell.Current.DisplayAlert( "Alert", "Are you sure you want to remove?", "Yes", "No"); if (result) { VisualBuildingLocationPhoto obj = parm as VisualBuildingLocationPhoto; await InvasiveVisualBuildingLocationPhotoDataStore.DeleteItemAsync(obj); InvasiveVisualBuildingLocationPhotoItems = new ObservableCollection <VisualBuildingLocationPhoto>(await InvasiveVisualBuildingLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(VisualForm.Id, false)); InvasiveUnitPhotoCount = InvasiveVisualBuildingLocationPhotoItems.Count.ToString(); } }
public async Task AddNewPhoto(VisualBuildingLocationPhoto obj) { if (App.IsInvasive == true) { // InvasiveVisualProjectLocationPhotoItems.Add(obj); await InvasiveVisualBuildingLocationPhotoDataStore.AddItemAsync(obj); InvasiveVisualBuildingLocationPhotoItems = new ObservableCollection <VisualBuildingLocationPhoto>(await InvasiveVisualBuildingLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(VisualForm.Id, false)); InvasiveUnitPhotoCount = InvasiveVisualBuildingLocationPhotoItems.Count.ToString(); } else { await VisualBuildingLocationPhotoDataStore.AddItemAsync(obj); VisualBuildingLocationPhotoItems = new ObservableCollection <VisualBuildingLocationPhoto>(await VisualBuildingLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(VisualForm.Id, false)); UnitPhotoCount = VisualBuildingLocationPhotoItems.Count.ToString(); } }
private async Task <bool> Running() { if (App.ListCamera2Api != null) { foreach (var photo in App.ListCamera2Api) { VisualBuildingLocationPhoto newObj = new VisualBuildingLocationPhoto() { ImageUrl = photo.Image, Id = Guid.NewGuid().ToString(), VisualBuildingId = VisualForm.Id, DateCreated = DateTime.Now }; if (App.IsInvasive == true) { _ = AddNewPhoto(newObj).ConfigureAwait(false); } else { _ = AddNewPhoto(newObj).ConfigureAwait(false); // await VisualProjectLocationPhotoDataStore.AddItemAsync(newObj); } } App.ListCamera2Api.Clear(); } UnitPhotos = new ObservableCollection <VisualBuildingLocationPhoto>(); if (VisualForm != null) { if (string.IsNullOrEmpty(visualForm.Id)) { VisualBuildingLocationPhotoItems = new ObservableCollection <VisualBuildingLocationPhoto>(await VisualBuildingLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(VisualForm.Id, false)); } else { VisualBuildingLocationPhotoItems = new ObservableCollection <VisualBuildingLocationPhoto>(await VisualBuildingLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(VisualForm.Id, false)); if (App.IsInvasive == true) { InvasiveVisualBuildingLocationPhotoItems = new ObservableCollection <VisualBuildingLocationPhoto>((await InvasiveVisualBuildingLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(VisualForm.Id, false))); InvasiveUnitPhotoCount = InvasiveVisualBuildingLocationPhotoItems.Count.ToString(); } } UnitPhotoCount = VisualBuildingLocationPhotoItems.Count.ToString(); } return(await Task.FromResult(true)); }
private async Task GoToVisualForm(BuildingLocation_Visual parm) { VisualBuildingLocationFormViewModel vm = new VisualBuildingLocationFormViewModel(); vm.ExteriorElements = new ObservableCollection <string>(parm.ExteriorElements.Split(',').ToList()); vm.WaterProofingElements = new ObservableCollection <string>(parm.WaterProofingElements.Split(',').ToList()); vm.CountExteriorElements = vm.ExteriorElements.Count.ToString(); vm.CountWaterProofingElements = vm.WaterProofingElements.Count.ToString(); vm.RadioList_VisualReviewItems.Where(c => c.Name == parm.VisualReview).Single().IsChecked = true; vm.RadioList_AnyVisualSignItems.Where(c => c.Name == parm.AnyVisualSign).Single().IsChecked = true; vm.RadioList_FurtherInasiveItems.Where(c => c.Name == parm.FurtherInasive).Single().IsChecked = true; vm.RadioList_ConditionAssessment.Where(c => c.Name == parm.ConditionAssessment).Single().IsChecked = true; vm.RadioList_LifeExpectancyEEE.Where(c => c.Name == parm.LifeExpectancyEEE).Single().IsChecked = true; vm.RadioList_LifeExpectancyLBC.Where(c => c.Name == parm.LifeExpectancyLBC).Single().IsChecked = true; vm.RadioList_LifeExpectancyAWE.Where(c => c.Name == parm.LifeExpectancyAWE).Single().IsChecked = true; App.VisualEditTracking = new List <MultiImage>(); App.VisualEditTrackingForInvasive = new List <MultiImage>(); VisualBuildingLocationPhotoDataStore.Clear(); InvasiveVisualBuildingLocationPhotoDataStore.Clear(); // vm.ExteriorElements = new CheakBoxListReturntModel() {selectedList= parm.ExteriorElements.Split(',').ToList(),Count= parm.ExteriorElements.Split(',').ToList().Count }; // vm.CountExteriorElements = vm.ExteriorElements.selectedList.Count.ToString(); //foreach (var item in parm.ExteriorElements.Split(',').ToList()) //{ // vm.ExteriorElements=new CheakBoxListReturntModel() {selectedList } //} //vm.CountExteriorElements = vm.ExteriorElements.selectedList.Count.ToString(); vm.VisualForm = parm; vm.BuildingLocation = BuildingLocation; vm.VisualBuildingLocationPhotoItems = new ObservableCollection <VisualBuildingLocationPhoto>(await VisualBuildingLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(parm.Id, true)); if (App.IsInvasive == false) { if (Shell.Current.Navigation.NavigationStack[Shell.Current.Navigation.NavigationStack.Count - 1].GetType() != typeof(VisualBuildingLocationForm)) { await Shell.Current.Navigation.PushAsync(new VisualBuildingLocationForm() { BindingContext = vm }); } } else { vm.InvasiveVisualBuildingLocationPhotoItems = new ObservableCollection <VisualBuildingLocationPhoto>(await InvasiveVisualBuildingLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(parm.Id, true)); if (Shell.Current.Navigation.NavigationStack[Shell.Current.Navigation.NavigationStack.Count - 1].GetType() != typeof(Views._8_VisualReportForm.TabbedPageInvasive)) { await Shell.Current.Navigation.PushAsync(new Views._8_VisualReportForm.TabbedPageInvasive(vm)); } } //vm.WaterProofingElements.selectedList = parm.ExteriorElements.Split(',').ToList(); //await Shell.Current.Navigation.PushAsync(new EditProjectLocationImage() //{ BindingContext = new EditProjectLocationImageViewModel() { Title = "New Common Location Image", ProjectCommonLocationImages = new ProjectCommonLocationImages() { ImageUrl = "blank.png" }, ProjectLocation = ProjectLocation } }); }