implements a ctor
This commit is contained in:
parent
54b0c2af0d
commit
35480aaffc
1 changed files with 21 additions and 7 deletions
|
|
@ -14,16 +14,30 @@ namespace BookAStar.Pages
|
||||||
public BookQueriesPage()
|
public BookQueriesPage()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
var model = new BookQueriesViewModel();
|
BindingContext = new BookQueriesViewModel();
|
||||||
model.RefreshQueries =
|
}
|
||||||
new Command( () => {
|
|
||||||
DataManager.Instance.BookQueries.Execute(null);
|
|
||||||
this.list.EndRefresh();
|
|
||||||
});
|
|
||||||
|
|
||||||
|
public BookQueriesPage(BookQueriesViewModel model)
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
BindingContext = model;
|
BindingContext = model;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void OnBindingContextChanged()
|
||||||
|
{
|
||||||
|
BookQueriesViewModel model = (BookQueriesViewModel) BindingContext;
|
||||||
|
if (model!=null)
|
||||||
|
{
|
||||||
|
model.RefreshQueries =
|
||||||
|
new Command(() =>
|
||||||
|
{
|
||||||
|
DataManager.Instance.BookQueries.Execute(null);
|
||||||
|
this.list.EndRefresh();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
base.OnBindingContextChanged();
|
||||||
|
}
|
||||||
|
|
||||||
private void OnViewDetail(object sender, ItemTappedEventArgs e)
|
private void OnViewDetail(object sender, ItemTappedEventArgs e)
|
||||||
{
|
{
|
||||||
var item = e.Item as BookQueryViewModel;
|
var item = e.Item as BookQueryViewModel;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue