private async Task DeleteImageCommandCommandExecute(VisualApartmentLocationPhoto parm)
        {
            var result = await Shell.Current.DisplayAlert(
                "Alert",
                "Are you sure you want to remove?",
                "Yes", "No");



            if (result)
            {
                //if (parm.GetType() == typeof(VisualProjectLocationPhoto))
                //{
                VisualApartmentLocationPhoto obj = parm as VisualApartmentLocationPhoto;
                await InvasiveVisualApartmentLocationPhotoDataStore.DeleteItemAsync(obj);

                //InvasiveVisualApartmentLocationPhotoItems = new ObservableCollection<VisualApartmentLocationPhoto>(await InvasiveVisualApartmentLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(VisualForm.Id, false));
                //InvasiveUnitPhotoCount = InvasiveVisualApartmentLocationPhotoItems.Count.ToString();
                //}
                //if (parm.GetType() == typeof(VisualBuildingLocationPhoto))
                //{
                //    VisualBuildingLocationPhoto obj = parm as VisualBuildingLocationPhoto;
                //    await VisualBuildingLocationPhotoDataStore.DeleteItemAsync(obj);

                //}
                //if (parm.GetType() == typeof(VisualApartmentLocationPhoto))
                //{
                //    VisualApartmentLocationPhoto obj = parm as VisualApartmentLocationPhoto;
                //    await VisualApartmentLocationPhotoDataStore.DeleteItemAsync(obj);

                //}
                await Load();
            }
        }
Exemplo n.º 2
0
        private async Task NewViusalReportCommandExecue()
        {
            Apartment_Visual visualForm = new Apartment_Visual();

            visualForm = new Apartment_Visual();
            // visualForm.Id = Guid.NewGuid().ToString();
            visualForm.BuildingApartmentId = BuildingApartment.Id;



            App.VisualEditTracking            = new List <MultiImage>();
            App.VisualEditTrackingForInvasive = new List <MultiImage>();
            VisualApartmentLocationPhotoDataStore.Clear();
            InvasiveVisualApartmentLocationPhotoDataStore.Clear();
            //await VisualFormProjectLocationDataStore.AddItemAsync(vloc);
            //  VisualFormProjectLocationItems = new ObservableCollection<ProjectLocation_Visual>(await VisualFormProjectLocationDataStore.GetItemsAsyncByProjectLocationId(ProjectLocation.Id));
            await Shell.Current.Navigation.PushAsync(new VisualApartmentLocationForm()
            {
                BindingContext = new VisualApartmentFormViewModel()
                {
                    BuildingApartment = BuildingApartment, VisualForm = visualForm
                }
            });

            //{ BindingContext = new EditProjectLocationeageViewModel() { Title = "New Common Location Image", ProjectCommonLocationImages = new ProjectCommonLocationImages() { ImageUrl = "blank.png" }, ProjectLocation = ProjectLocation } });
        }
Exemplo n.º 3
0
        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 } });
        }
        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();
        }
Exemplo n.º 5
0
        public async void Save(byte[] arr)
        {
            IsBusyProgress = true;
            //  var editorPage = obj as ImageEditorPageWithoutDetail;

            //var signaturepad = editorPage.Content.FindByName("signaturepad") as SignaturePadView;
            //signaturepad.ClearLabel.IsVisible = false;

            // var gritoolbar = editorPage.Content.FindByName("gridtoolbar") as Grid;
            //  gritoolbar.IsVisible = false;

            //  var savebutton = editorPage.Content.FindByName("GridOperation") as Grid;
            // savebutton.IsVisible = false;
            //var detailGrid = editorPage.Content.FindByName("detailGrid") as Grid;
            //detailGrid.IsVisible = false;

            // var imgcolors = editorPage.Content.FindByName("imgcolors") as Image;
            //  imgcolors.IsVisible = false;

            // var commentslider = editorPage.Content.FindByName("commentcolorslider") as Slider;
            // commentslider.IsVisible = false;

            // var txtName = editorPage.Content.FindByName("txtName") as BorderlessEntry;
            //  commentslider.IsVisible = false;
            //   var txtDescription = editorPage.Content.FindByName("txtDescription") as XEditor;
            //commentslider.IsVisible = false;

            //var scratchslider = editorPage.Content.FindByName("scratchcolorslider") as Slider;
            //scratchslider.IsVisible = false;


            //  string path = await CrossScreenshot.Current.CaptureAndSaveAsync();
            //byte[] resizedImage = DependencyService.Get<IImageService>().ResizeTheImage(await CrossScreenshot.Current.CaptureAsync(), 2000, 1800);
            string path = await DependencyService.Get <ISaveFile>().SaveFiles(Guid.NewGuid().ToString(), arr);

            // imageData.Path = filepath;
            //     await App.Current.MainPage.Navigation.PopAsync();
            //ImageData d = new ImageData();
            // SelectedImage= imageData.Path = path;
            if (imageData.FormType == "VP")
            {
                VisualProjectLocationPhotoItems[i].ImageUrl = path;
                if (App.IsInvasive == false)
                {
                    await VisualProjectLocationPhotoDataStore.UpdateItemAsync(VisualProjectLocationPhotoItems[i], imageData.IsEditVisual);
                }
                else
                {
                    await InvasiveVisualProjectLocationPhotoDataStore.UpdateItemAsync(VisualProjectLocationPhotoItems[i], imageData.IsEditVisual);
                }
            }
            else if (imageData.FormType == "VB")
            {
                VisualBuildingLocationPhotoItems[i].ImageUrl = path;
                // imageData.VisualBuildingLocationPhoto.Image = path;
                if (App.IsInvasive == false)
                {
                    await VisualBuildingLocationPhotoDataStore.UpdateItemAsync(VisualBuildingLocationPhotoItems[i]);
                }
                else
                {
                    await InvasiveVisualBuildingLocationPhotoDataStore.UpdateItemAsync(VisualBuildingLocationPhotoItems[i]);
                }
            }
            else if (imageData.FormType == "VA")
            {
                string oldp = VisualApartmentLocationPhotoItems[i].ImageUrl;
                VisualApartmentLocationPhotoItems[i].ImageUrl = path;
                if (App.IsInvasive == false)
                {
                    await VisualApartmentLocationPhotoDataStore.UpdateItemAsync(VisualApartmentLocationPhotoItems[i]);
                }
                else
                {
                    await InvasiveVisualApartmentLocationPhotoDataStore.UpdateItemAsync(VisualApartmentLocationPhotoItems[i]);
                }
            }
            if (imageData.FormType == "P")
            {
                ProjectCommonLocationImagesItems[i].ImageUrl = path;
                await ProjectCommonLocationImagesDataStore.UpdateItemAsync(ProjectCommonLocationImagesItems[i]);
            }
            else if (imageData.FormType == "B")
            {
                BuildingCommonLocationImagesItems[i].ImageUrl = path;
                await BuildingCommonLocationImagesDataStore.UpdateItemAsync(BuildingCommonLocationImagesItems[i]);
            }
            else if (imageData.FormType == "A")
            {
                BuildingApartmentImagesItems[i].ImageUrl = path;

                await BuildingApartmentImagesDataStore.UpdateItemAsync(BuildingApartmentImagesItems[i]);
            }

            // signaturepad.Clear();
            //  gritoolbar.IsVisible = true;
            //savebutton.IsVisible = true;
            //commentslider.IsVisible = true;
            //scratchslider.IsVisible = true;
            IsBusyProgress = false;
            // var labelcomment = editorPage.Content.FindByName("labelcomment") as Label;
            //  labelcomment.IsVisible = false;
            //  labelcomment.Text = string.Empty;
            //  VisualProjectLocationPhotoItems = new ObservableCollection<VisualProjectLocationPhoto>(await VisualProjectLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(imageData.VisualProjectLocationPhoto.VisualID));
            await Next(null);

            // imageData.Name = txtName.Text;
            // imageData.Description = txtDescription.Text;
            //  Callback?.Invoke(imageData);
        }
Exemplo n.º 6
0
        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);
                    }
                }
            }
        }
Exemplo n.º 7
0
        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));
 }