如何接收显示<Image x:Name="imageToUpload" WidthRequest="40" HeightRequest="40"/>
在 Xamarin Forms 下的“照片”并将其传递给变量?我在这一行获取文件/图像 var file = await CrossMedia.Current.TakePhotoAsync(....
需要传递给RegisterSave_OnClicked()
方法并进一步保存到 SQLite 数据库中
var file = await CrossMedia.Current.TakePhotoAsync(new StoreCameraMediaOptions
{
Directory = "Pictures",
Name = "test.jpg",
PhotoSize = PhotoSize.Small,
CompressionQuality = 75,
CustomPhotoSize = 5,
DefaultCamera = CameraDevice.Front,
});
//注册按钮保存代码如下:
public async void RegisterSave_OnClicked(object sender, EventArgs e)
{
int count = (from y in conn.Table<PlayerDetails>().Where(y => y.Email == playerEmail) select y).Count();
if(count!=0)
{
var updatePlayer = (from y in conn.Table<PlayerDetails>().Where(y => y.Email == playerEmail) select y);
foreach (var update_Player in updatePlayer)
{
update_Player.FullName = fullNameEntry.Text;
update_Player.Mobile = mobileEntry.Text;
// code continues here .......
// assuming conn is an SQLiteConnection
conn.Update(update_Player);
}
await Navigation.PushAsync(new MainPage());
}
else
{
PlayerDetails playerDetails = new PlayerDetails();
playerDetails.FullName = fullNameEntry.Text;
playerDetails.Mobile = mobileEntry.Text;
// code continues here .......