xamarin-forms-4

How can we received a image file from imageToUpload.Source and passed into another method

不打扰是莪最后的温柔 提交于 2019-12-13 03:44:03
问题 How to receive a 'photo' displayed under <Image x:Name="imageToUpload" WidthRequest="40" HeightRequest="40"/> and pass to a variable in Xamarin Forms ? I am getting the file/image at this line var file = await CrossMedia.Current.TakePhotoAsync(.... would need to passed into RegisterSave_OnClicked() method and further save into SQLite database var file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions { Directory = "Pictures", Name = "test.jpg", PhotoSize = PhotoSize.Small,

UIKit.UIKitThreadAccessException: UIKit Consistency error: you are calling a UIKit method that can only be invoked from the UI thread

▼魔方 西西 提交于 2019-12-11 23:23:43
问题 I'm trying to run this code: GetRepsButton.Command = new Command(async () => { var url = @"https://url"; HttpClient client = new HttpClient(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); //crashes here var test = await client.GetStringAsync(url); }); And when I do, the entire app crashes and the output window shows this error: ROR: +[MSWrapperLogger MSWrapperLog:tag:level:]/7 Unhandled Exception: UIKit.UIKitThreadAccessException: UIKit