Ejemplo n.º 1
0
        /// <summary>
        /// По клику на иконку в листе собираем информацию получаем список глав
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ListViewCatalog_Click(object sender, EventArgs e)///Загружаем главы в обьект манги по клику
        {
            try
            {
                if (listViewCatalog.SelectedItems.Count == 1)
                {
                    if (internetCheck)
                    {
                        foreach (MangaInCatalog mangaInCatalog in HtmlParsing.mangalist)
                        {
                            if (listViewCatalog.SelectedItems[0].Text == mangaInCatalog.MangaName)
                            {
                                if (!HtmlParsing.autonome)
                                {
                                    if (section != Section.Downloads)
                                    {
                                        HtmlParsing.GetChaptersList(mangaInCatalog);
                                        mangaInCatalog.CurrentChapter = mangaInCatalog.Chapters[0];//Получение главы
                                        mangaInCatalog.CurrentPage    = 0;
                                    }
                                }

                                if (File.Exists(Environment.CurrentDirectory + "/bookmarks.txt"))
                                {
                                    using (StreamReader streamReader = File.OpenText(Environment.CurrentDirectory + "/bookmarks.txt"))
                                    {
                                        while (!streamReader.EndOfStream)
                                        {
                                            var str = streamReader.ReadLine();
                                            var arr = str.Split('~');
                                            if (arr[0] == mangaInCatalog.MangaName)
                                            {
                                                mangaInCatalog.CurrentChapter = arr[1];
                                                mangaInCatalog.CurrentPage    = Convert.ToInt32(arr[2]);
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        btnToRead.Visible = true;

                        HtmlParsing.MangaInfo();//Показать информацию о манге
                        pnlName.Visible        = true;
                        pnlAbout.Visible       = true;
                        pnlGenres.Visible      = true;
                        btnToRead.Visible      = true;
                        pictureBoxPage.Visible = true;
                        if (!mangaselect)
                        {
                            listViewCatalog.Size = new Size(listViewCatalog.Size.Width - 300, listViewCatalog.Size.Height);
                        }
                        mangaselect = true;
                    }
                }
                else if (listViewCatalog.SelectedItems.Count == 0)
                {
                    //btnToRead.Visible = false;
                    //pnlName.Visible = false;
                    //pnlAbout.Visible = false;
                    //pnlGenres.Visible = false;

                    //pictureBoxPage.Visible = true;

                    //if (!mangaselect)
                    //    listViewCatalog.Size = new Size(listViewCatalog.Size.Width + 300, listViewCatalog.Size.Height);

                    //mangaselect = false;
                }
            }
            catch
            {
                MessageBox.Show("Нет интернета");
            }
        }