Skip to content
Permalink
8f1ae83daa
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
44 lines (42 sloc) 1.29 KB
using System;
using System.Collections.Generic;
using System.Linq;
using InfoBlog.Models;
using InfoBlog.ViewModel;
using SQLite;
using Xamarin.Forms;
namespace InfoBlog.Views
{
public partial class BlogPage : ContentPage
{
public BlogPage()
{
InitializeComponent();
BindingContext = new BlogPostViewModel();
}
private async void OnPostSelected(object sender, ItemTappedEventArgs e)
{
var Blogdetails = e.Item as PostForm;
await Navigation.PushAsync(new BlogPageDetail(Blogdetails.Topic, Blogdetails.Image, Blogdetails.Contents, Blogdetails.User));
}
void AddBlog(object sender, System.EventArgs e)
{
Navigation.PushAsync(new AddBlog());
}
void Logout(object sender, System.EventArgs e)
{
Navigation.PushAsync(new WelcomePage());
}
//Get data from the database
protected override void OnAppearing()
{
base.OnAppearing();
using (SQLiteConnection conn = new SQLiteConnection(App.Filepath))
{
conn.CreateTable<PostForm>();
var posts = conn.Table<PostForm>().ToList();
blogList.ItemsSource = posts;
}
}
}
}