Esempio n. 1
0
        private void PreviewToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeView tree = null;

            if (tc_Info.SelectedTab == tabPage_Book)
            {
                tree = tw_Book;
            }
            if (tc_Info.SelectedTab == tabPage_Film)
            {
                tree = tw_Film;
            }

            if ((tree.SelectedNode != null) && (TreeViewOPs.GetDeepestChildNodeLevel(tree.SelectedNode) == 1))
            {
                try
                {
                    print_PreviewDialog.Document = print_Doc;
                    //print_PreviewDialog.Height = 700;
                    //print_PreviewDialog.Width = 500;
                    print_PreviewDialog.ShowDialog();
                }
                catch (Exception ex) { MessageBox.Show(ex.ToString()); }
            }
        }
Esempio n. 2
0
        private void tw_Book_AfterSelect(object sender, TreeViewEventArgs e)
        {
            List <Book> parse = FileOPs.ParseBookXmlToList(bookFileName);

            if ((tw_Book.SelectedNode != null) && (TreeViewOPs.GetDeepestChildNodeLevel(e.Node.TreeView.SelectedNode) == 1))
            {
                try
                {
                    imageNumber = 0;
                    grpbox_BookInfo.Show();
                    txtbox_BookID.Text             = parse.Find(b => b.bookAuthor == e.Node.Parent.Parent.Text && b.bookTitle == e.Node.Text).bookID.ToString();
                    txtbox_BookMajorSeries.Text    = parse.Find(b => b.bookAuthor == e.Node.Parent.Parent.Text && b.bookTitle == e.Node.Text).bookMajorSeries;
                    txtbox_BookAuthor.Text         = e.Node.Parent.Parent.Text;
                    txtbox_BookTitle.Text          = e.Node.Text;
                    txtbox_BookSeries.Text         = parse.Find(b => b.bookAuthor == e.Node.Parent.Parent.Text && b.bookTitle == e.Node.Text).bookSeries;
                    txtbox_BookNumberInSeries.Text = parse.Find(b => b.bookAuthor == e.Node.Parent.Parent.Text && b.bookTitle == e.Node.Text).bookNumberInSeries.ToString();
                    txtbox_BookGenre.Text          = parse.Find(b => b.bookAuthor == e.Node.Parent.Parent.Text && b.bookTitle == e.Node.Text).bookGenre;
                    txtbox_BookPagesCount.Text     = parse.Find(b => b.bookAuthor == e.Node.Parent.Parent.Text && b.bookTitle == e.Node.Text).bookPagesCount.ToString();
                    txtbox_BookPublisher.Text      = parse.Find(b => b.bookAuthor == e.Node.Parent.Parent.Text && b.bookTitle == e.Node.Text).bookPublisher;
                    txtbox_BookPrintYear.Text      = parse.Find(b => b.bookAuthor == e.Node.Parent.Parent.Text && b.bookTitle == e.Node.Text).bookPrintYear.ToString();
                    txtbox_BookPrintCity.Text      = parse.Find(b => b.bookAuthor == e.Node.Parent.Parent.Text && b.bookTitle == e.Node.Text).bookPrintCity;
                    if (parse.Find(b => b.bookAuthor == e.Node.Parent.Parent.Text && b.bookTitle == e.Node.Text).bookISBN.ToString().Length == 10)
                    {
                        msktxtbox_BookISBN.Mask = "000000000-0";
                    }
                    else if (parse.Find(b => b.bookAuthor == e.Node.Parent.Parent.Text && b.bookTitle == e.Node.Text).bookISBN.ToString().Length == 13)
                    {
                        msktxtbox_BookISBN.Mask = "000-0-00-000000-0";
                    }
                    msktxtbox_BookISBN.Text          = parse.Find(b => b.bookAuthor == e.Node.Parent.Parent.Text && b.bookTitle == e.Node.Text).bookISBN.ToString();
                    txtbox_BookTranslator.Text       = parse.Find(b => b.bookAuthor == e.Node.Parent.Parent.Text && b.bookTitle == e.Node.Text).bookTranslator;
                    txtbox_BookArtist.Text           = parse.Find(b => b.bookAuthor == e.Node.Parent.Parent.Text && b.bookTitle == e.Node.Text).bookArtist;
                    txtbox_BookNotes.Text            = parse.Find(b => b.bookAuthor == e.Node.Parent.Parent.Text && b.bookTitle == e.Node.Text).bookNotes;
                    picBox_BookPreview.ImageLocation = parse.Find(b => b.bookAuthor == e.Node.Parent.Parent.Text && b.bookTitle == e.Node.Text).picturesPath[0].ToString();
                    label1.Text = parse.Find(b => b.bookAuthor == e.Node.Parent.Parent.Text && b.bookTitle == e.Node.Text).picturesPath[0];
                    label2.Text = parse.Find(b => b.bookAuthor == e.Node.Parent.Parent.Text && b.bookTitle == e.Node.Text).picturesPath[1];
                    label3.Text = parse.Find(b => b.bookAuthor == e.Node.Parent.Parent.Text && b.bookTitle == e.Node.Text).picturesPath[2];
                    timer_Preview.Start();
                }
                catch (Exception) { }
            }
            else
            {
                grpbox_BookInfo.Hide();
                timer_Preview.Stop();
                picBox_BookPreview.Image = null;
                if (e.Node.IsExpanded)
                {
                    e.Node.Collapse();
                }
                else
                {
                    e.Node.Expand();
                }
            }
        }
Esempio n. 3
0
        private void EditToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (tc_Info.SelectedTab == tabPage_Book)
            {
                if ((tw_Book.SelectedNode != null) && (TreeViewOPs.GetDeepestChildNodeLevel(tw_Book.SelectedNode) == 1))
                {
                    try
                    {
                        List <Book> parse = FileOPs.ParseBookXmlToList(bookFileName);

                        Book bookToEdit = parse.Find(b => b.bookTitle == tw_Book.SelectedNode.Text && b.bookSeries == tw_Book.SelectedNode.Parent.Text && b.bookAuthor == tw_Book.SelectedNode.Parent.Parent.Text);

                        timer_Preview.Stop();
                        picBox_BookPreview.Image = null;

                        form_EditBook formEdit = new form_EditBook(bookToEdit);
                        formEdit.Show();

                        TreeViewOPs.CreateBookTree(tw_Book);
                    }
                    catch (Exception ex) { MessageBox.Show(ex.ToString()); }
                }
                else
                {
                    MessageBox.Show("Необходимо выбрать 'Книгу'");
                }
            }

            if (tc_Info.SelectedTab == tabPage_Film)
            {
                if ((tw_Film.SelectedNode != null) && (TreeViewOPs.GetDeepestChildNodeLevel(tw_Film.SelectedNode) == 1))
                {
                    try
                    {
                        List <Film> parse = FileOPs.ParseFilmXmlToList(filmFileName);

                        Film filmToEdit = parse.Find(f => f.filmTitle == tw_Film.SelectedNode.Text && f.filmProducer == tw_Film.SelectedNode.Parent.Text);

                        timer_Preview.Stop();
                        picBox_FilmPreview.Image = null;

                        form_EditFilm formEdit = new form_EditFilm(filmToEdit);
                        formEdit.Show();

                        TreeViewOPs.CreateFilmTree(tw_Film);
                    }
                    catch (Exception ex) { MessageBox.Show(ex.ToString()); }
                }
                else
                {
                    MessageBox.Show("Необходимо выбрать 'Фильм'");
                }
            }
        }
Esempio n. 4
0
        private void tw_Film_AfterSelect(object sender, TreeViewEventArgs e)
        {
            List <Film> parse = FileOPs.ParseFilmXmlToList(filmFileName);

            if ((tw_Film.SelectedNode != null) && (TreeViewOPs.GetDeepestChildNodeLevel(e.Node.TreeView.SelectedNode) == 1))
            {
                try
                {
                    imageNumber = 0;
                    grpbox_FilmInfo.Show();
                    txtbox_FilmID.Text               = parse.Find(f => f.filmProducer == e.Node.Parent.Text && f.filmTitle == e.Node.Text).filmID.ToString();
                    txtbox_FilmProducer.Text         = e.Node.Parent.Text;
                    txtbox_FilmTitle.Text            = e.Node.Text;
                    txtbox_FilmGenre.Text            = parse.Find(f => f.filmProducer == e.Node.Parent.Text && f.filmTitle == e.Node.Text).filmGenre;
                    txtbox_FilmActors.Text           = parse.Find(f => f.filmProducer == e.Node.Parent.Text && f.filmTitle == e.Node.Text).filmActors;
                    txtbox_FilmLength.Text           = parse.Find(f => f.filmProducer == e.Node.Parent.Text && f.filmTitle == e.Node.Text).filmLengthInMinutes.ToString();
                    txtbox_FilmCountry.Text          = parse.Find(f => f.filmProducer == e.Node.Parent.Text && f.filmTitle == e.Node.Text).filmCountry;
                    txtbox_FilmPremiere.Text         = parse.Find(f => f.filmProducer == e.Node.Parent.Text && f.filmTitle == e.Node.Text).filmPremiere.ToString();
                    txtbox_FilmMPAA.Text             = parse.Find(f => f.filmProducer == e.Node.Parent.Text && f.filmTitle == e.Node.Text).filmMPAARating;
                    txtbox_FilmCriticsRating.Text    = parse.Find(f => f.filmProducer == e.Node.Parent.Text && f.filmTitle == e.Node.Text).filmCriticsRating;
                    txtbox_FilmGrosses.Text          = parse.Find(f => f.filmProducer == e.Node.Parent.Text && f.filmTitle == e.Node.Text).filmGrosses.ToString();
                    txtbox_FilmNotes.Text            = parse.Find(f => f.filmProducer == e.Node.Parent.Text && f.filmTitle == e.Node.Text).filmNotes;
                    picBox_FilmPreview.ImageLocation = parse.Find(f => f.filmProducer == e.Node.Parent.Text && f.filmTitle == e.Node.Text).picturesPath[0].ToString();
                    label11.Text = parse.Find(f => f.filmProducer == e.Node.Parent.Text && f.filmTitle == e.Node.Text).picturesPath[0];
                    label12.Text = parse.Find(f => f.filmProducer == e.Node.Parent.Text && f.filmTitle == e.Node.Text).picturesPath[1];
                    label13.Text = parse.Find(f => f.filmProducer == e.Node.Parent.Text && f.filmTitle == e.Node.Text).picturesPath[2];
                    timer_Preview.Start();
                }
                catch (Exception) { }
            }
            else
            {
                grpbox_FilmInfo.Hide();
                timer_Preview.Stop();
                picBox_FilmPreview.Image = null;
                if (e.Node.IsExpanded)
                {
                    e.Node.Collapse();
                }
                else
                {
                    e.Node.Expand();
                }
            }
        }
Esempio n. 5
0
        private void RemoveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (tc_Info.SelectedTab == tabPage_Book)
            {
                List <Book> parse = FileOPs.ParseBookXmlToList(bookFileName);

                if ((tw_Book.SelectedNode != null) && (TreeViewOPs.GetDeepestChildNodeLevel(tw_Book.SelectedNode) == 1))
                {
                    try
                    {
                        timer_Preview.Stop();
                        picBox_BookPreview.Image = null;
                        grpbox_BookInfo.Hide();

                        FileOPs.RemoveFromXmlFile(parse.Find(b => b.bookAuthor == tw_Book.SelectedNode.Parent.Parent.Text && b.bookTitle == tw_Book.SelectedNode.Text), bookFileName);

                        TreeViewOPs.CreateBookTree(tw_Book);
                    }
                    catch (Exception ex) { MessageBox.Show(ex.ToString()); }
                }
            }

            if (tc_Info.SelectedTab == tabPage_Film)
            {
                List <Film> parse = FileOPs.ParseFilmXmlToList(filmFileName);

                if ((tw_Film.SelectedNode != null) && (TreeViewOPs.GetDeepestChildNodeLevel(tw_Film.SelectedNode) == 1))
                {
                    try
                    {
                        timer_Preview.Stop();
                        picBox_FilmPreview.Image = null;
                        grpbox_FilmInfo.Hide();

                        FileOPs.RemoveFromXmlFile(parse.Find(f => f.filmProducer == tw_Film.SelectedNode.Parent.Text && f.filmTitle == tw_Film.SelectedNode.Text), filmFileName);

                        TreeViewOPs.CreateFilmTree(tw_Film);
                    }
                    catch (Exception ex) { MessageBox.Show(ex.ToString()); }
                }
            }
        }
Esempio n. 6
0
        private void PrintToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeView tree = null;

            if (tc_Info.SelectedTab == tabPage_Book)
            {
                tree = tw_Book;
            }
            if (tc_Info.SelectedTab == tabPage_Film)
            {
                tree = tw_Film;
            }

            if ((tree.SelectedNode != null) && (TreeViewOPs.GetDeepestChildNodeLevel(tree.SelectedNode) == 1))
            {
                print_Dialog.Document = print_Doc;

                if (print_Dialog.ShowDialog() == DialogResult.OK)
                {
                    print_Doc.Print();
                }
            }
        }