Я создаю приложение с кнопкой на contentPage, и когда я нажимаю эту кнопку, оно переходит на новый contentPage.Но у него есть некоторые проблемы.Я использую базу данных sqlite, соединение в порядке.
это класс модели
public class entries
{
public entries()
{
}
public entries(string word)
{
this.word = word;
}
public entries(string word, string wordtype, string definition)
{
this.word = word;
this.type = wordtype;
this.defn = definition;
}
public string word
{ get; set; }
public string type
{ get; set; }
public string sdex { get; set; }
public int wlen { get; set; }
public string defn
{ get; set; }
}
Кнопка в MainPage.xaml.cs
public partial class MainPage : ContentPage
{
public string word;
public MainPage()
{
InitializeComponent();
}
//this is the button
async void AllWordButton_Clicked(object sender, EventArgs e)
{
await Navigation.PushAsync(new AllWordPage());
}
}
это AllWordPage.xaml.cs
public partial class OrtherAppPage : ContentPage
{
private SQLiteConnection conn;
public entries entry;
public OrtherAppPage()
{
InitializeComponent();
conn = DependencyService.Get<ISQLite>().GetConnection();
var data = (from word in conn.Table<entries>() select word);
DataList.ItemsSource = data;
}
}
это AllWordPage.xaml
<ContentPage.Content>
<StackLayout Orientation="Horizontal" HorizontalOptions="Center">
<Label Text="This is Other App Page" />
</StackLayout>
<StackLayout>
<ListView x:Name="DataList">
<ListView.ItemTemplate>
<TextCell Text="{Binding Word}"></TextCell>
</ListView.ItemTemplate>
</ListView>
</StackLayout>
</ContentPage.Content>
Когда я нажимаю кнопку.оно получает это уведомление: Ваше приложение вошло в состояние останова, но нет кода для показа, потому что все потоки выполняли внешний код (обычно код системы или фреймворка).
Как я могу показать эту проблему.Пожалуйста помоги.Большое вам спасибо