예제 #1
0
        private void addBookOf(object sender, RoutedEventArgs e)
        {
            var b = NameBook.SelectedItem as Book;

            if (b != null)
            {
                var item = lv_DSTheLoai.SelectedItem as Genre;
                if (item != null)
                {
                    if (!BooksOfSelectedGenre.Any(x => x.Name == b.Name))
                    {
                        b.Tag = "New Link";
                        BooksOfSelectedGenre.Add(b);
                        item.IsEditedItem = true;
                    }
                }
            }
        }
예제 #2
0
        private void removeLink(object sender, RoutedEventArgs e)
        {
            var control = sender as Button;
            var tag     = control.Tag as Book;

            if (tag != null)
            {
                if (tag.Tag != null)
                {
                    BooksOfSelectedGenre.Remove(tag);
                }
                else
                {
                    tag.Switch = true;
                }
                var item = lv_DSTheLoai.SelectedItem as Genre;
                if (item != null)
                {
                    item.IsEditedItem = true;
                }
            }
        }