private async Task Save() { if (string.IsNullOrEmpty(ProjectCommonLocationImages.Name)) { await Shell.Current.DisplayAlert("Alert", "Project name is required", "OK"); return; } if (string.IsNullOrEmpty(ProjectCommonLocationImages.Id)) { ProjectCommonLocationImages.Id = Guid.NewGuid().ToString(); ProjectCommonLocationImages.ProjectLocationId = ProjectLocation.Id.ToString(); ////Project. //// Project.ProjectImage = ImgPata; await ProjectCommonLocationImagesDataStore.AddItemAsync(ProjectCommonLocationImages); await Shell.Current.Navigation.PopAsync(); // await Shell.Current.Navigation.PushAsync(new ProjectLocationDetail() { BindingContext = new ProjectLocationDetailViewModel() { ProjectLocation = ProjectLocation } }); } else { await ProjectCommonLocationImagesDataStore.UpdateItemAsync(ProjectCommonLocationImages); await Shell.Current.Navigation.PopAsync(); } //await Shell.Current.Navigation.PushAsync(new ProjectLocationDetail() { BindingContext = new ProjectDetailViewModel() { Project = Project } }); }
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); }
private async void GetImageProjectCommonLocationImages(ImageData ImgData) { ProjectCommonLocationImages.ImageUrl = ImgData.Path; await ProjectCommonLocationImagesDataStore.UpdateItemAsync(ProjectCommonLocationImages); }