private void BtnDel(object sender, RoutedEventArgs e) { LsCatalog.ItemsSource = null; TbContent.Text = ""; TbBookName.Text = ""; TbChapter.Text = ""; _file = ""; _chapters.Clear(); _currentChapter = null; if (_bookInfo != null && !string.IsNullOrEmpty(_bookInfo.BookId)) { ConfigSevice.DelBook(_bookInfo.BookId); } _bookInfo = null; }
private void BookOnDel(object sender, MouseButtonEventArgs e) { var book = (sender as Border).DataContext as BookInfo; if (book == null || string.IsNullOrEmpty(book.BookId)) { return; } ConfigSevice.DelBook(book.BookId); if (_bookInfo != null && book.BookId == _bookInfo.BookId) { _bookInfo = null; LsCatalog.ItemsSource = null; TbContent.Text = ""; TbBookName.Text = ""; TbChapter.Text = ""; _file = ""; _chapters.Clear(); _currentChapter = null; } LoadBookShelft(); e.Handled = true; }