Exemplo n.º 1
0
        private void btnSearchPublisher_Click(object sender, RoutedEventArgs e)
        {
            var publisher = txtSearchPublisher.Text;
            var comicMgr  = new ComicManager();

            if (_comics == null)
            {
                try
                {
                    comicsSearched = comicMgr.ComicsByPublisher(publisher);
                    //try
                    //{
                    //    mainWindow.dgComics.ItemsSource = comicsSearched;
                    //}
                    //catch (Exception ex)
                    //{

                    //    MessageBox.Show(ex.Message + ex.StackTrace, "Error adding to datagrid here:");
                    //}

                    MessageBox.Show("Comic found!");
                    Close();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message, "ERROR:");
                    txtSearchAuthor.IsEnabled = true;
                    txtSearchAuthor.Clear();
                }
            }
            else
            {
                txtSearchTitle.IsEnabled = true;
                txtSearchTitle.Clear();
                MessageBox.Show("Please enter a comic title.");
            }
        }