private async void btnSubmit_Clicked(object sender, EventArgs e) { try { String imageBase64; Stream image = await padView.GetImageStreamAsync(SignaturePad.Forms.SignatureImageFormat.Jpeg, Color.Black, Color.White, 1f); _objHeaderModel.TokenCode = Settings.TokenCode; string CustomerName = custName.Text; if (image != null && !string.IsNullOrEmpty(CustomerName) && OffsiteTime != null) { imageBase64 = Base64Extensions.ConvertToBase64(image); _objDriver_WorkSheetSignOffRequest = new Driver_WorkSheetSignOffRequest { Id = Settings.WorksheetID.ToString(), CustomerName = custName.Text, CustomerSign = imageBase64, OffSiteFinishTime = OffsiteTime }; await Navigation.PushPopupAsync(new LoadingPopPage()); _objDriver_WorkSheetSignOffResponse = await _apiServices.WorkSheetSignOffSignAsync(new Get_API_Url().WorkSheetSignOffSignApi(_baseUrl), true, _objHeaderModel, _objDriver_WorkSheetSignOffRequest); if (_objDriver_WorkSheetSignOffResponse.Response.StatusCode == 200) { Settings.IsPreStartChecked = false; DependencyService.Get <IToast>().Show(_objDriver_WorkSheetSignOffResponse.Response.Message); await App.NavigationPage.Navigation.PushAsync(new Driver_WorksheetPage()); await Navigation.PopAllPopupAsync(); } else { DependencyService.Get <IToast>().Show("Something Bad Happend please Try again Later!"); await Navigation.PopAllPopupAsync(); } } else { DependencyService.Get <IToast>().Show("Please Sign over the signature pad to submit the Dailychecklist!"); } //await App.NavigationPage.Navigation.PushAsync(new WorkSheetDetailsPage()); //await Navigation.PopAllPopupAsync(); } catch (Exception ex) { DependencyService.Get <IToast>().Show("Something Went Wrong please try Again or check your Internet Connection!!"); await Navigation.PopAllPopupAsync(); var msg = ex.Message; } }
private async void btnSubmitSignature_Clicked(object sender, EventArgs e) { try { String imageBase64; Stream image = await padView.GetImageStreamAsync(SignaturePad.Forms.SignatureImageFormat.Jpeg, Color.Black, Color.White, 1f); // imageSign.Source=image //imageSign.Source = ImageSource.FromStream(() => //{ // // var stream = _mediaFile.GetStream(); // // _mediaFile.Dispose(); // return image; //}); _objHeaderModel = new HeaderModel { TokenCode = Settings.TokenCode }; if (image != null) { imageBase64 = Base64Extensions.ConvertToBase64(image); _objDriver_SignatureRequest = new Driver_SignatureRequest { AddCheckListId = DailyCheckListId.ToString(), DriverSign = imageBase64 }; await Navigation.PushPopupAsync(new LoadingPopPage()); _objDriver_SignatureResponse = await _apiServices.DriverSignatureAsync(new Get_API_Url().Driver_SignatureApi(_baseUrl), true, _objHeaderModel, _objDriver_SignatureRequest); if (_objDriver_SignatureResponse.Response.statusCode == 200) { Settings.IsPreStartChecked = true; DependencyService.Get <IToast>().Show(_objDriver_SignatureResponse.Response.Message); await App.NavigationPage.Navigation.PushAsync(new WorkSheetDetailsPage()); await Navigation.PopAllPopupAsync(); } else { DependencyService.Get <IToast>().Show("Something Bad Happend please Try again Later!"); await Navigation.PopAllPopupAsync(); } } else { DependencyService.Get <IToast>().Show("Please Sign over the signature pad to submit the Dailychecklist!"); } } catch (Exception ex) { var msg = ex.Message; } }
private async void XFBtnTapCamera_Tapped(object sender, EventArgs e) { try { var result = await DisplayAlert("Alert", "Do you want to go without Uploading the document?", "Yes", "No"); if (result) { if (!CrossMedia.Current.IsCameraAvailable || !CrossMedia.Current.IsTakePhotoSupported) { await DisplayAlert("No Camera", ":( No camera available.", "OK"); return; } var file = await CrossMedia.Current.TakePhotoAsync(new Plugin.Media.Abstractions.StoreCameraMediaOptions { Directory = "Test", SaveToAlbum = true, CompressionQuality = 75, CustomPhotoSize = 50, PhotoSize = PhotoSize.MaxWidthHeight, MaxWidthHeight = 2000, DefaultCamera = CameraDevice.Front }); if (file == null) { return; } await DisplayAlert("File Location", file.Path, "OK"); var imageString = Base64Extensions.ConvertToBase64(file.GetStream()); xfGridShowDocket.IsVisible = true; xfWbDocketImage.Source = ImageSource.FromStream(() => { var stream = file.GetStream(); file.Dispose(); return(stream); }); _objDriver_AddLoadRequest.BridgeDocket = imageString; } else { } } catch (Exception ex) { var msg = ex.Message; } }
private async void btnSubmit_Clicked(object sender, EventArgs e) { try { String imageBase64; Stream image = await padView.GetImageStreamAsync(SignaturePad.Forms.SignatureImageFormat.Jpeg); _objHeaderModel.TokenCode = Settings.TokenCode; if (image != null) { imageBase64 = Base64Extensions.ConvertToBase64(image); _objM_SignatureRequest = new M_SignatureRequest { MaintenenceRequestDoneId = M_MR_DoneId.ToString(), CustomerName = custName.Text, MechanicSign = imageBase64 }; await Navigation.PushPopupAsync(new LoadingPopPage()); _objM_SignatureResponse = await _apiServices.M_SendSignatureAsync(new Get_API_Url().CommonBaseApi(_baseUrl), true, _objHeaderModel, _objM_SignatureRequest); if (_objM_SignatureResponse.Response.StatusCode == 200) { DependencyService.Get <IToast>().Show(_objM_SignatureResponse.Response.Message); await App.NavigationPage.Navigation.PushAsync(new Mechanic_RequestHistoryPage()); await Navigation.PopAllPopupAsync(); } else { DependencyService.Get <IToast>().Show("Something Bad Happend please Try again Later!"); await Navigation.PopAllPopupAsync(); } } else { DependencyService.Get <IToast>().Show("Please Sign over the signature pad to submit the Dailychecklist!"); } //await App.NavigationPage.Navigation.PushAsync(new WorkSheetDetailsPage()); //await Navigation.PopAllPopupAsync(); } catch (Exception ex) { DependencyService.Get <IToast>().Show("Something Went Wrong please try Again or check your Internet Connection!!"); await Navigation.PopAllPopupAsync(); var msg = ex.Message; } }
private async void btnSubmitImg_Clicked(object sender, EventArgs e) { try { await CrossMedia.Current.Initialize(); if (!CrossMedia.Current.IsPickPhotoSupported) { await DisplayAlert("Photos Not Supported", ":( Permission not granted to photos.", "OK"); return; } _mediaFile = await Plugin.Media.CrossMedia.Current.PickPhotoAsync(new Plugin.Media.Abstractions.PickMediaOptions { //PhotoSize = Plugin.Media.Abstractions.PhotoSize.Medium, //CompressionQuality = 92 }); if (_mediaFile == null) { return; } Image1.Source = ImageSource.FromStream(() => { // var stream = _mediaFile.GetStream(); // _mediaFile.Dispose(); return(_mediaFile.GetStream()); }); // _objUploadProfileBase64Req = new UploadProfileBase64Req(); // var ImageName = _mediaFile.Path.Split('\\').LastOrDefault().Split('/').LastOrDefault(); //var Byt = ReadFully(_mediaFile.GetStream()); //string base64 = Convert.ToBase64String(Byt); // _objUploadProfileBase64Req.ImageName = ImageName; // _objUploadProfileBase64Req.ProfilePicture = base64; // await Navigation.PushPopupAsync(new UploadConfirmation(_objUploadProfileBase64Req)); // await Navigation.PushPopupAsync(new UploadConfirmation(_mediaFile)); var imageString = Base64Extensions.ConvertToBase64(_mediaFile.GetStream()); _objM_RequestDoneRequest.MultipleImage.Add(imageString); } catch (Exception ex) { var msg = ex.Message; } }
private async void btnSubmitSignature_Clicked(object sender, EventArgs e) { try { String imageBase64; Stream image = await padView.GetImageStreamAsync(SignaturePad.Forms.SignatureImageFormat.Jpeg); _objHeaderModel = new HeaderModel { TokenCode = Settings.TokenCode }; if (image != null) { imageBase64 = Base64Extensions.ConvertToBase64(image); _objND_SignatureRequest = new ND_SignatureRequest { AddCheckListId = DailyCheckListId.ToString(), DriverSign = imageBase64 }; await Navigation.PushPopupAsync(new LoadingPopPage()); _objND_SignatureResponse = await _apiServices.ND_SignatureDataAsync(new Get_API_Url().CommonBaseApi(_baseUrl), true, _objHeaderModel, _objND_SignatureRequest); if (_objND_SignatureResponse.Response.statusCode == 200) { DependencyService.Get <IToast>().Show(_objND_SignatureResponse.Response.Message); await App.NavigationPage.Navigation.PushAsync(new NDriverTimeSheetPage()); await Navigation.PopAllPopupAsync(); } else { DependencyService.Get <IToast>().Show("Something Bad Happend please Try again Later!"); await Navigation.PopAllPopupAsync(); } } else { DependencyService.Get <IToast>().Show("Please Sign over the signature pad to submit the Dailychecklist!"); } } catch (Exception ex) { var msg = ex.Message; } }
private async void btnSubmitSignature_Clicked(object sender, EventArgs e) { try { String imageBase64; Stream image = await padView.GetImageStreamAsync(SignaturePad.Forms.SignatureImageFormat.Jpeg, Color.Black, Color.White, 1f); _objHeaderModel = new HeaderModel { TokenCode = Settings.TokenCode }; if (image != null) { imageBase64 = Base64Extensions.ConvertToBase64(image); if (StatusId == 1) { _objDriver_AddLoadRequest.CustomerSign = imageBase64; await Navigation.PushPopupAsync(new LoadingPopPage()); _objDriver_AddLoadResponse = await _apiServices.AddLoadAsync(new Get_API_Url().AddNewLoadApi(_baseUrl), true, _objHeaderModel, _objDriver_AddLoadRequest); if (_objDriver_AddLoadResponse.Response.StatusCode == 200) { DependencyService.Get <IToast>().Show(_objDriver_AddLoadResponse.Response.Message); await App.NavigationPage.Navigation.PushAsync(new WorkSheetDetailsPage()); await Navigation.PopAllPopupAsync(); } else { DependencyService.Get <IToast>().Show(_objDriver_AddLoadResponse.Response.Message); await Navigation.PopAllPopupAsync(); } } if (StatusId == 2) { _objDriver_EditLoadResponse.Response.LoadDetails.CustomerSign = imageBase64; await Navigation.PushPopupAsync(new LoadingPopPage()); _objDriver_UpdateLoadResponse = await _apiServices.UpdateLoadAsync(new Get_API_Url().UpdateLoadApi(_baseUrlPostLoad), true, _objHeaderModel, _objDriver_EditLoadResponse.Response.LoadDetails); if (_objDriver_UpdateLoadResponse.Response.StatusCode == 200) { DependencyService.Get <IToast>().Show(_objDriver_UpdateLoadResponse.Response.Message); await App.NavigationPage.Navigation.PushAsync(new WorkSheetDetailsPage()); //await Navigation.PushPopupAsync(new LoadSignOffPopUp(_objDriver_EditLoadResponse.Response.LoadDetails.LoadId)); await Navigation.PopAllPopupAsync(); } else { DependencyService.Get <IToast>().Show(_objDriver_AddLoadResponse.Response.Message); await Navigation.PopAllPopupAsync(); } } } else { DependencyService.Get <IToast>().Show("Please Sign over the signature pad to submit the New Load!"); } } catch (Exception ex) { var msg = ex.Message; await Navigation.PopAllPopupAsync(); } }