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



            if (result)
            {
                //if (parm.GetType() == typeof(VisualProjectLocationPhoto))
                //{
                VisualProjectLocationPhoto obj = parm as VisualProjectLocationPhoto;
                await InvasiveVisualProjectLocationPhotoDataStore.DeleteItemAsync(obj, true);

                InvasiveVisualProjectLocationPhotoItems = new ObservableCollection <VisualProjectLocationPhoto>(await InvasiveVisualProjectLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(VisualForm.Id, false));
                InvasiveUnitPhotoCount = InvasiveVisualProjectLocationPhotoItems.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();
            }
        }
        private async Task GoToVisualForm(ProjectLocation_Visual parm)
        {
            VisualProjectLocationFormViewModel vm = new VisualProjectLocationFormViewModel();

            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>();
            //  vm.VisualProjectLocationPhotoItems.Clear();
            VisualProjectLocationPhotoDataStore.Clear();
            InvasiveVisualProjectLocationPhotoDataStore.Clear();


            //vm.WaterProofingElements.selectedList = parm.ExteriorElements.Split(',').ToList();
            vm.VisualForm = parm;
            vm.VisualProjectLocationPhotoItems = new ObservableCollection <VisualProjectLocationPhoto>(await VisualProjectLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(parm.Id, true));

            vm.ProjectLocation = ProjectLocation;
            if (App.IsInvasive == false)
            {
                if (Shell.Current.Navigation.NavigationStack[Shell.Current.Navigation.NavigationStack.Count - 1].GetType() != typeof(VisualProjectLocationForm))
                {
                    await Shell.Current.Navigation.PushAsync(new VisualProjectLocationForm()
                    {
                        BindingContext = vm
                    });
                }
            }
            else
            {
                vm.InvasiveVisualProjectLocationPhotoItems = new ObservableCollection <VisualProjectLocationPhoto>(await InvasiveVisualProjectLocationPhotoDataStore.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 } });
        }
Ejemplo n.º 3
0
        public async Task AddNewPhoto(VisualProjectLocationPhoto obj)
        {
            if (App.IsInvasive == true)
            {
                // InvasiveVisualProjectLocationPhotoItems.Add(obj);
                await InvasiveVisualProjectLocationPhotoDataStore.AddItemAsync(obj);

                InvasiveVisualProjectLocationPhotoItems = new ObservableCollection <VisualProjectLocationPhoto>(await InvasiveVisualProjectLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(VisualForm.Id, false));
                InvasiveUnitPhotoCount = InvasiveVisualProjectLocationPhotoItems.Count.ToString();
            }
            else
            {
                await VisualProjectLocationPhotoDataStore.AddItemAsync(obj);

                VisualProjectLocationPhotoItems = new ObservableCollection <VisualProjectLocationPhoto>(await VisualProjectLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(VisualForm.Id, false));
                UnitPhotoCount = VisualProjectLocationPhotoItems.Count.ToString();
            }
        }
        //public ObservableCollection<VisualFormProjectLocation> VisualFormProjectLocationItems { get; set; }
        private async Task NewViusalReportCommandExecue()
        {
            ProjectLocation_Visual visualForm = new ProjectLocation_Visual();

            visualForm = new ProjectLocation_Visual();
            //visualForm.Id = Guid.NewGuid().ToString();
            visualForm.ProjectLocationId = ProjectLocation.Id;
            // vm.VisualProjectLocationPhotoItems.Clear();

            VisualProjectLocationPhotoDataStore.Clear();

            App.VisualEditTracking            = new List <MultiImage>();
            App.VisualEditTrackingForInvasive = new List <MultiImage>();
            VisualProjectLocationPhotoDataStore.Clear();
            InvasiveVisualProjectLocationPhotoDataStore.Clear();
            //await VisualFormProjectLocationDataStore.AddItemAsync(vloc);
            //  VisualFormProjectLocationItems = new ObservableCollection<ProjectLocation_Visual>(await VisualFormProjectLocationDataStore.GetItemsAsyncByProjectLocationId(ProjectLocation.Id));

            if (App.IsInvasive == false)
            {
                await Shell.Current.Navigation.PushAsync(new VisualProjectLocationForm()
                {
                    BindingContext = new VisualProjectLocationFormViewModel()
                    {
                        ProjectLocation = ProjectLocation, VisualForm = visualForm
                    }
                });
            }
            else

            {
                //await Shell.Current.Navigation.PushAsync(new VisualProjectLocationForm() { BindingContext = new VisualProjectLocationFormViewModel() { ProjectLocation = ProjectLocation, VisualForm = visualForm } });
                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(new VisualProjectLocationFormViewModel()
                    {
                        ProjectLocation = ProjectLocation, VisualForm = visualForm
                    }));
                }
                //await Shell.Current.Navigation.PushAsync(new VisualProjectLocationForm() { BindingContext = vm });
            }

            //{ BindingContext = new EditProjectLocationImageViewModel() { Title = "New Common Location Image", ProjectCommonLocationImages = new ProjectCommonLocationImages() { ImageUrl = "blank.png" }, ProjectLocation = ProjectLocation } });
        }
Ejemplo 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);
        }
Ejemplo 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);
                    }
                }
            }
        }
Ejemplo 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;
            }
        }
Ejemplo n.º 8
0
        private async Task <bool> Running()
        {
            if (App.ListCamera2Api != null)
            {
                foreach (var photo in App.ListCamera2Api)
                {
                    VisualProjectLocationPhoto newObj = new VisualProjectLocationPhoto()
                    {
                        ImageUrl = photo.Image, Id = Guid.NewGuid().ToString(), VisualLocationId = VisualForm.Id
                    };
                    if (App.IsInvasive == true)
                    {
                        _ = AddNewPhoto(newObj).ConfigureAwait(false);
                    }
                    else
                    {
                        _ = AddNewPhoto(newObj).ConfigureAwait(false);
                        //  await VisualProjectLocationPhotoDataStore.AddItemAsync(newObj);
                    }
                }
                App.ListCamera2Api.Clear();
            }

            UnitPhotos = new ObservableCollection <VisualProjectLocationPhoto>();
            if (VisualForm != null)
            {
                if (string.IsNullOrEmpty(visualForm.Id))
                {
                    VisualProjectLocationPhotoItems = new ObservableCollection <VisualProjectLocationPhoto>(await VisualProjectLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(VisualForm.Id, false).ConfigureAwait(false));
                }
                else
                {
                    App.IsVisualEdidingMode         = true;
                    VisualProjectLocationPhotoItems = new ObservableCollection <VisualProjectLocationPhoto>(await VisualProjectLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(VisualForm.Id, false).ConfigureAwait(false));
                    if (App.IsInvasive == true)
                    {
                        InvasiveVisualProjectLocationPhotoItems = new ObservableCollection <VisualProjectLocationPhoto>(await InvasiveVisualProjectLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(VisualForm.Id, false).ConfigureAwait(false));
                        InvasiveUnitPhotoCount = InvasiveVisualProjectLocationPhotoItems.Count.ToString();
                    }
                    // VisualProjectLocationPhotoItems = VisualProjectLocationPhotoItems.Where(c => c.IsDelete = false).ToList();
                    //if (App.IsVisualEdidingMode == true)
                    //{
                    // VisualProjectLocationPhotoItems = new ObservableCollection<VisualProjectLocationPhoto>(await VisualProjectLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(VisualForm.Id, true));
                    //    App.IsVisualEdidingMode = false;
                    //}
                    //else
                    //{
                    //    VisualProjectLocationPhotoItems = new ObservableCollection<VisualProjectLocationPhoto>(await VisualProjectLocationPhotoDataStore.GetItemsAsyncByProjectVisualID(VisualForm.Id, false));

                    //}
                }
                UnitPhotoCount = VisualProjectLocationPhotoItems.Count.ToString();
            }
            return(await Task.FromResult(true));
        }