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 <bool> Running() { if (App.ListCamera2Api != null) { foreach (var photo in App.ListCamera2Api) { VisualApartmentLocationPhoto newObj = new VisualApartmentLocationPhoto() { ImageUrl = photo.Image, Id = Guid.NewGuid().ToString(), VisualApartmentId = 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 <VisualApartmentLocationPhoto>(); if (VisualForm != null) { if (string.IsNullOrEmpty(VisualForm.Id)) { VisualApartmentLocationPhotoItems = new ObservableCollection <VisualApartmentLocationPhoto>(await VisualApartmentLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(VisualForm.Id, false)); } else { VisualApartmentLocationPhotoItems = new ObservableCollection <VisualApartmentLocationPhoto>(await VisualApartmentLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(VisualForm.Id, false)); if (App.IsInvasive == true) { InvasiveVisualApartmentLocationPhotoItems = new ObservableCollection <VisualApartmentLocationPhoto>((await InvasiveVisualApartmentLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(VisualForm.Id, false))); InvasiveUnitPhotoCount = InvasiveVisualApartmentLocationPhotoItems.Count.ToString(); } } UnitPhotoCount = VisualApartmentLocationPhotoItems.Count.ToString(); } return(await Task.FromResult(true)); }
public async Task AddNewPhoto(VisualApartmentLocationPhoto obj) { if (App.IsInvasive == true) { // InvasiveVisualProjectLocationPhotoItems.Add(obj); await InvasiveVisualApartmentLocationPhotoDataStore.AddItemAsync(obj); InvasiveVisualApartmentLocationPhotoItems = new ObservableCollection <VisualApartmentLocationPhoto>(await InvasiveVisualApartmentLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(VisualForm.Id, false)); InvasiveUnitPhotoCount = InvasiveVisualApartmentLocationPhotoItems.Count.ToString(); return; } await VisualApartmentLocationPhotoDataStore.AddItemAsync(obj); VisualApartmentLocationPhotoItems = new ObservableCollection <VisualApartmentLocationPhoto>(await VisualApartmentLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(VisualForm.Id, false)); UnitPhotoCount = VisualApartmentLocationPhotoItems.Count.ToString(); }
private async Task GoToVisualForm(Apartment_Visual parm) { VisualApartmentFormViewModel vm = new VisualApartmentFormViewModel(); 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; // 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(); App.VisualEditTracking = new List <MultiImage>(); App.VisualEditTrackingForInvasive = new List <MultiImage>(); VisualApartmentLocationPhotoDataStore.Clear(); InvasiveVisualApartmentLocationPhotoDataStore.Clear(); // InvasiveVisualApartmentLocationPhotoDataStore.Clear(); //vm.WaterProofingElements.selectedList = parm.ExteriorElements.Split(',').ToList(); vm.VisualForm = parm; vm.BuildingApartment = BuildingApartment; vm.VisualApartmentLocationPhotoItems = new ObservableCollection <VisualApartmentLocationPhoto>(await VisualApartmentLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(parm.Id, true)); if (App.IsInvasive == false) { if (Shell.Current.Navigation.NavigationStack[Shell.Current.Navigation.NavigationStack.Count - 1].GetType() != typeof(VisualApartmentLocationForm)) { await Shell.Current.Navigation.PushAsync(new VisualApartmentLocationForm() { BindingContext = vm }); } } else { vm.InvasiveVisualApartmentLocationPhotoItems = new ObservableCollection <VisualApartmentLocationPhoto>(await InvasiveVisualApartmentLocationPhotoDataStore.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)); } //await Shell.Current.Navigation.PushAsync(new VisualProjectLocationForm() { BindingContext = vm }); } //await Shell.Current.Navigation.PushAsync(new EditProjectLocationImage() //{ BindingContext = new EditProjectLocationImageViewModel() { Title = "New Common Location Image", ProjectCommonLocationImages = new ProjectCommonLocationImages() { ImageUrl = "blank.png" }, ProjectLocation = ProjectLocation } }); }