Skip to content
Permalink
add6e4d428
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
46 lines (39 sloc) 1.19 KB
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xamarin.Forms;
namespace Local
{
public partial class MainPage : ContentPage
{
public MainPage()
{
InitializeComponent();
}
protected override async void OnAppearing()
{
base.OnAppearing();
listView.ItemsSource = await App.Database.GetPeopleAsync();
}
private async void OnButtonClicked(object sender, EventArgs e)
{
if (!string.IsNullOrWhiteSpace(nameEntry.Text) && !string.IsNullOrWhiteSpace(ageEntry.Text))
{
await App.Database.SavePersonAsync(new Person
{
Name = nameEntry.Text,
Age = int.Parse(ageEntry.Text)
});
nameEntry.Text = ageEntry.Text = string.Empty;
listView.ItemsSource = await App.Database.GetPeopleAsync();
}
}
private async void OnImage_Button(object sender, EventArgs e)
{
await Navigation.PushAsync(new ImageView());
}
}
}