Hello,
Welcome to our Microsoft Q&A platform!
You could change the OKButton_Clicked
method by the following code, it means that when the PhotoPath
is not equle to null
,save it. After the database update is complete, set LastAvatar
to empty.
private async void OKButton_Clicked(object sender, EventArgs e)
{
var todoItem = (OperatorModel)BindingContext;
PhotoPath = Preferences.Get("LastAvatar", null);
if (PhotoPath != null)
{
todoItem.OperatorAvatar = PhotoPath;
HFNDatabase database = await HFNDatabase.Instance;
await database.SaveItemAsync(todoItem);
Preferences.Set("LastAvatar", null);
}
EventHandler<OperatorModel> handler = ReturnValue;
if (handler != null)
{
handler(this, todoItem);
}
await Navigation.PopModalAsync();
}
Best Regards,
Wenyan Zhang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.