= Path.Combine(documentsPath,sqliteFilename); // Cria aconexao var stringConn = new SQLiteConnectionString(path, true); var db = new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(newSQLite.Net.Platform.XamarinAndroid.SQLitePlatformAndroid(), stringConn)); // Retorna aconexao return db; }IOS[assembly: Dependency(typeof(SQLite_iOS))] public SQLiteAsyncConnection GetConnAsync() { var sqliteFilename = "Dados.db3"; string documentsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); // Documents folder string libraryPath = Path.Combine(documentsPath, "..", "Library"); // Library folder var path = Path.Combine(libraryPath,sqliteFilename); // Cria aconexao var stringConn = new SQLiteConnectionString(path, true); var db = new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(newSQLite.Net.Platform.XamarinIOS.SQLitePlatformIOS(), stringConn)); // Retorna aconexao return db; }WINDOWS[assembly: Dependency(typeof(SQLite_Win))]public SQLiteAsyncConnection GetConnAsync() { var sqliteFilename = "Dados.db3"; string documentsPath = ApplicationData.Current.LocalFolder.Path; var path = Path.Combine(documentsPath,sqliteFilename); // Cria aconexao var stringConn = new SQLiteConnectionString(path, true); var db = new SQLiteAsyncConnection(() => new SQLiteConnectionWithLock(newSQLite.Net.Platform.WinRT.SQLitePlatformWinRT(), stringConn)); // retorna aconexao return db; }5. CRIAR MODEL PERSONAGENSpublic class Personagem { [PrimaryKey, AutoIncrement] public int id { get; set; } public string nome { get; set; } public int ataque{ get; set; } public int defesa{ get; set; } public string imagem{ get; set; } public bool vilao {get; set; } }6. XAML MAINPAGE<StackLayout x:Name="stackPrinc"> <SearchBar x:Name="sb" Placeholder="Pesquisar..."/> <ListView x:Name="lv" HasUnevenRows="True"> <ListView.ItemTemplate> <DataTemplate> <ViewCell> <StackLayout> <Label Text="{Bindingid, StringFormat='{0}'}" FontAttributes="Bold" HorizontalOptions="Start" Margin="10"/> <Image Source="{Bindingimagem}" Aspect="AspectFit" WidthRequest="150" HorizontalOptions="Center"/> <Label Text="{Bindingnome, StringFormat='{0}'}" FontAttributes="Bold" FontSize="Large" HorizontalOptions="Center"/> <StackLayout Orientation="Horizontal" HorizontalOptions="End" Margin="10"> <Label Text="{Bindingdefesa, StringFormat='{0}'}" TextColor="Purple" FontSize="Large"/> <Label Text="/" FontSize="Large"/> <Label Text="{Bindingataque, StringFormat='{0}'}" TextColor="Purple" FontSize="Large"/> </StackLayout> </StackLayout> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView> </StackLayout>7. C# MAIN//conexao bd SQLiteAsyncConnection conn; public MainPage() { InitializeComponent(); // obtemdependencia bd conn = DependencyService.Get<ISQLite>().GetConnAsync(); // cria tabelasq n existem conn.CreateTableAsync<Personagem>(); // evento debusca sb.SearchCommand = new Command(() => { Pesquisar(); }); // toolbaradd/edit/del MontarToolBar(); } private async void Pesquisar() { // consultalinq var listaResultado = await conn.Table<Personagem>().Where(it => it.nome.Contains(sb.Text)). OrderBy(it =>it.nome).ToListAsync(); lv.ItemsSource = listaResultado; } public voidMontarToolBar() { var tbAdd = new ToolbarItem(); tbAdd.Text = "Incluir"; tbAdd.Icon = "add.png"; this.ToolbarItems.Add(tbAdd); tbAdd.Clicked += TbAdd_Clicked; var tbEdit = new ToolbarItem(); tbEdit.Text = "Modificar"; tbEdit.Icon = "edit.png"; this.ToolbarItems.Add(tbEdit); tbEdit.Clicked += TbEdit_Clicked; var tbDel = new ToolbarItem(); tbDel.Text = "Remover"; tbDel.Icon = "del.png"; this.ToolbarItems.Add(tbDel); tbDel.Clicked += TbDel_Clicked; } private async void TbDel_Clicked(object sender, EventArgs e) { // se n temnada selecionado if (lv.SelectedItem == null) { return; } // pergunta var it = lv.SelectedItem as Personagem; var resp = await this.DisplayAlert("CONFIRMACAO", "Remover Personagem ?", "Sim", "Nao"); if (resp) { //remove await conn.DeleteAsync(it); Pesquisar(); } } private voidTbEdit_Clicked(object sender,EventArgs e) { // se n temnada selecionado if (lv.SelectedItem == null) { return; } // itemselecionado var it = lv.SelectedItem as Personagem; // cria pageformulario var pg = new FormPage(); pg.PropertyChanged +=Pg_PropertyChanged; // seta obj noformulario pg.Current = it; // navega paraformulario this.Navigation.PushAsync(pg, true); } private voidTbAdd_Clicked(object sender,EventArgs e) { // cria pageformulario var pg = new FormPage(); pg.PropertyChanged +=Pg_PropertyChanged; // cria novoobj pg.Current = new Personagem(); // navega paraformulario this.Navigation.PushAsync(pg, true); } private voidPg_PropertyChanged(object sender,System.ComponentModel.PropertyChangedEventArgs e) { // quando salvano formulario, atualiza tela if (e.PropertyName == "ok") { Pesquisar(); } }8. CRIAR FORMPAGE9. XAML FORMS<StackLayout x:Name="stackPrinc" Orientation="Vertical"> <TableView Intent="Form"> <TableRoot> <TableSection Title="Ficha"> <EntryCell Label="Nome" Text="{Binding nome}"/> <EntryCell Label="Foto" Text="{Binding imagem}"/> <SwitchCell Text="Vilao" On="{Binding vilao}"/> </TableSection> <TableSection Title="Ataque/Defesa"> <EntryCell Label="Ataque" Text="{Binding ataque}"/> <EntryCell Label="Defesa" Text="{Binding defesa}"/> </TableSection> </TableRoot> </TableView> </StackLayout>10. C# FORMS//objeto personagem Personagem current; public Personagem