public IAsyncOperation <LoadMoreItemsResult> LoadMoreItemsAsync(uint count) { var coreDispatcher = Window.Current.Dispatcher; return(System.Threading.Tasks.Task.Run <LoadMoreItemsResult>(async() => { await coreDispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { }); ObservableCollection <Hadith> list = new ObservableCollection <Hadith>(); using (var connection = new SQLiteConnection("hadeeth.sqlite")) { using (var statement = connection.Prepare(@"SELECT hadeeth.hadeeth " + "FROM Books INNER JOIN hadeeth ON Books.ID = hadeeth.BID" + " where hadeeth.hadeeth like '%<%' and " + "books.title like '%سنن الترمذي%'")) { while (statement.Step() == SQLiteResult.ROW) { for (int i = 0; i < count; i++) { list.Add(new Hadith() { Hadeeth = (string)statement[0] }); lastItem++; if (lastItem == 100) { break; } } await coreDispatcher.RunAsync(CoreDispatcherPriority.Normal, () => { foreach (var item in list) { var unBold = new unBold(); var x = new SonanElTormozy(); x.listHadith.Items.Add(unBold.unBoldHadith(statement[0].ToString())); } }); } } } return new LoadMoreItemsResult() { Count = count }; }).AsAsyncOperation <LoadMoreItemsResult>()); }
private async void listTitle_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (listTitle.SelectedItem == null) { return; } var selectedHadithTitle = listTitle.SelectedItem.ToString(); txtHeader.Text = "الحديث الخاص بالعنوان " + selectedHadithTitle; listTitle.Visibility = Visibility.Collapsed; listHadith.Visibility = Visibility.Visible; ObservableCollection <Hadith> listSelected = new ObservableCollection <Hadith>(); try { using (var connection = new SQLiteConnection("hadeeth.sqlite")) { using (var statement = connection.Prepare(@"Select hadeeth.hadeeth from hadeeth where hadeeth.Title like '%" + selectedHadithTitle + "%'")) { while (statement.Step() == SQLiteResult.ROW) { listSelected.Add(new Hadith() { Hadeeth = (string)statement[0] }); var unBold = new unBold(); listHadith.Items.Add(unBold.unBoldHadith(statement[0].ToString())); } } } } catch (Exception ex) { var cd = new ContentDialog(); cd.Title = ex.ToString(); cd.PrimaryButtonText = "تم"; await cd.ShowAsync(); } }
public async System.Threading.Tasks.Task<ObservableCollection<Hadith>> SearchByAuthorContents() { var Keyword = txtAuthorKeyword.Text; var Author = txtAuthorName.Text; ObservableCollection<Hadith> list = new ObservableCollection<Hadith>(); try { using (var connection = new SQLiteConnection("hadeeth.sqlite")) { using (var statement = connection.Prepare(@"SELECT hadeeth.hadeeth " + "FROM (authors INNER JOIN books ON authors.ID = Books.Author) " + "INNER JOIN hadeeth ON Books.ID = hadeeth.BID " + "WHERE (((authors.name) Like '%" + Author + "%') " + "and ((hadeeth.hadeeth_norm) Like '%" + Keyword + "%'))")) { while (statement.Step() == SQLiteResult.ROW) { list.Add(new Hadith() { Hadeeth = (string)statement[0] }); var unBold = new unBold(); listHadith.Items.Add(unBold.unBoldHadith(statement[0].ToString())); } } } } catch (Exception ex) { var cd = new ContentDialog(); cd.Title = ex.ToString(); cd.PrimaryButtonText = "تم"; await cd.ShowAsync(); } return list; }
public async System.Threading.Tasks.Task <ObservableCollection <Hadith> > SearchByAuthorContents() { var Keyword = txtAuthorKeyword.Text; var Author = txtAuthorName.Text; ObservableCollection <Hadith> list = new ObservableCollection <Hadith>(); try { using (var connection = new SQLiteConnection("hadeeth.sqlite")) { using (var statement = connection.Prepare(@"SELECT hadeeth.hadeeth " + "FROM (authors INNER JOIN books ON authors.ID = Books.Author) " + "INNER JOIN hadeeth ON Books.ID = hadeeth.BID " + "WHERE (((authors.name) Like '%" + Author + "%') " + "and ((hadeeth.hadeeth_norm) Like '%" + Keyword + "%'))")) { while (statement.Step() == SQLiteResult.ROW) { list.Add(new Hadith() { Hadeeth = (string)statement[0] }); var unBold = new unBold(); listHadith.Items.Add(unBold.unBoldHadith(statement[0].ToString())); } } } } catch (Exception ex) { var cd = new ContentDialog(); cd.Title = ex.ToString(); cd.PrimaryButtonText = "تم"; await cd.ShowAsync(); } return(list); }
public async System.Threading.Tasks.Task<ObservableCollection<Hadith>> SearchByBookContents() { var Keyword = txtBookKeyword.Text; var Book = txtBookName.Text; ObservableCollection<Hadith> list = new ObservableCollection<Hadith>(); try { using (var connection = new SQLiteConnection("hadeeth.sqlite")) { using (var statement = connection.Prepare(@"SELECT hadeeth.hadeeth FROM Books INNER JOIN hadeeth " + "ON Books.ID = hadeeth.BID where hadeeth.hadeeth_norm like '%" + Keyword + "%' and books.title like '%" + Book + "%'")) { while (statement.Step() == SQLiteResult.ROW) { list.Add(new Hadith() { Hadeeth = (string)statement[0] }); var unBold = new unBold(); listHadith.Items.Add(unBold.unBoldHadith(statement[0].ToString())); } } } } catch (Exception ex) { var cd = new ContentDialog(); cd.Title = ex.ToString(); cd.PrimaryButtonText = "تم"; await cd.ShowAsync(); } return list; }
public async System.Threading.Tasks.Task<ObservableCollection<Hadith>> HadithTitleContents() { listTitle.Visibility = Visibility.Visible; listHadith.Visibility = Visibility.Collapsed; ObservableCollection<Hadith> list = new ObservableCollection<Hadith>(); try { using (var connection = new SQLiteConnection("hadeeth.sqlite")) { using (var statement = connection.Prepare(@"Select distinct hadeeth.Title from hadeeth")) { while (statement.Step() == SQLiteResult.ROW) { list.Add(new Hadith() { Hadeeth = (string)statement[0] }); var unBold = new unBold(); listTitle.Items.Add(unBold.unBoldHadith(statement[0].ToString())); } } } } catch (Exception ex) { var cd = new ContentDialog(); cd.Title = ex.ToString(); cd.PrimaryButtonText = "تم"; await cd.ShowAsync(); } return list; }
public async System.Threading.Tasks.Task <ObservableCollection <Hadith> > SearchByBookContents() { var Keyword = txtBookKeyword.Text; var Book = txtBookName.Text; ObservableCollection <Hadith> list = new ObservableCollection <Hadith>(); try { using (var connection = new SQLiteConnection("hadeeth.sqlite")) { using (var statement = connection.Prepare(@"SELECT hadeeth.hadeeth FROM Books INNER JOIN hadeeth " + "ON Books.ID = hadeeth.BID where hadeeth.hadeeth_norm like '%" + Keyword + "%' and books.title like '%" + Book + "%'")) { while (statement.Step() == SQLiteResult.ROW) { list.Add(new Hadith() { Hadeeth = (string)statement[0] }); var unBold = new unBold(); listHadith.Items.Add(unBold.unBoldHadith(statement[0].ToString())); } } } } catch (Exception ex) { var cd = new ContentDialog(); cd.Title = ex.ToString(); cd.PrimaryButtonText = "تم"; await cd.ShowAsync(); } return(list); }
public async System.Threading.Tasks.Task <ObservableCollection <Hadith> > HadithSubjectContents() { listSubject.Visibility = Visibility.Visible; listHadith.Visibility = Visibility.Collapsed; ObservableCollection <Hadith> list = new ObservableCollection <Hadith>(); try { using (var connection = new SQLiteConnection("hadeeth.sqlite")) { using (var statement = connection.Prepare(@"Select distinct hadeeth.subject from hadeeth")) { while (statement.Step() == SQLiteResult.ROW) { list.Add(new Hadith() { Hadeeth = (string)statement[0] }); var unBold = new unBold(); listSubject.Items.Add(unBold.unBoldHadith(statement[0].ToString())); } } } } catch (Exception ex) { var cd = new ContentDialog(); cd.Title = "خطأ"; cd.Content = ex.ToString(); cd.PrimaryButtonText = "تم"; await cd.ShowAsync(); } return(list); }
public async System.Threading.Tasks.Task <ObservableCollection <Hadith> > HadithContents() { ObservableCollection <Hadith> list = new ObservableCollection <Hadith>(); try { using (var connection = new SQLiteConnection("hadeeth.sqlite")) { using (var statement = connection.Prepare(@"SELECT hadeeth.hadeeth " + "FROM Books INNER JOIN hadeeth ON Books.ID = hadeeth.BID" + " where hadeeth.hadeeth like '%<%' and " + "books.title like '%مسند أحمد%'")) { while (statement.Step() == SQLiteResult.ROW) { list.Add(new Hadith() { Hadeeth = (string)statement[0] }); var unBold = new unBold(); listHadith.Items.Add(unBold.unBoldHadith(statement[0].ToString())); } } } } catch (Exception ex) { var cd = new ContentDialog(); cd.Title = "خطأ"; cd.Content = ex.ToString(); cd.PrimaryButtonText = "تم"; await cd.ShowAsync(); } return(list); }
public async System.Threading.Tasks.Task<ObservableCollection<Hadith>> HadithContents() { ObservableCollection<Hadith> list = new ObservableCollection<Hadith>(); try { using (var connection = new SQLiteConnection("hadeeth.sqlite")) { using (var statement = connection.Prepare(@"SELECT hadeeth.hadeeth " + "FROM Books INNER JOIN hadeeth ON Books.ID = hadeeth.BID" + " where hadeeth.hadeeth like '%<%' and " + "books.title like '%مسند أحمد%'")) { while (statement.Step() == SQLiteResult.ROW) { list.Add(new Hadith() { Hadeeth = (string)statement[0] }); var unBold = new unBold(); listHadith.Items.Add(unBold.unBoldHadith(statement[0].ToString())); } } } } catch (Exception ex) { var cd = new ContentDialog(); cd.Title = "خطأ"; cd.Content = ex.ToString(); cd.PrimaryButtonText = "تم"; await cd.ShowAsync(); } return list; }
private async void listSubject_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (listSubject.SelectedItem == null) return; var selectedHadithSubject = listSubject.SelectedItem.ToString(); txtHeader.Text = "الأحاديث الخاصة بموضوع " + selectedHadithSubject; listSubject.Visibility = Visibility.Collapsed; listHadith.Visibility = Visibility.Visible; ObservableCollection<Hadith> listSelected = new ObservableCollection<Hadith>(); try { using (var connection = new SQLiteConnection("hadeeth.sqlite")) { using (var statement = connection.Prepare(@"Select hadeeth.hadeeth from hadeeth where hadeeth.subject like '%" + selectedHadithSubject + "%'")) { while (statement.Step() == SQLiteResult.ROW) { listSelected.Add(new Hadith() { Hadeeth = (string)statement[0] }); var unBold = new unBold(); listHadith.Items.Add(unBold.unBoldHadith(statement[0].ToString())); } } } } catch (Exception ex) { var cd = new ContentDialog(); cd.Title = ex.ToString(); cd.PrimaryButtonText = "تم"; await cd.ShowAsync(); } }