Пример #1
0
        private void FillChapter(Hashtable htChapter)
        {
            Point windowsLocation;
            int   y = 1;

            //ordenar por capitulo
            for (int i = 1; i < htChapter.Count + 1; i++)
            {
                CChapter oChapter = (CChapter)htChapter[i];

                windowsLocation = new Point(richTextBox1.Location.X + 20, y * 60);
                Button dynamicButton = CreateDynamicButton(oChapter.ChapterNameId, oChapter.ChapterName, oChapter.ChapterNumberId, windowsLocation);
                if (y == 1)
                {
                    circularButton1.Location = new Point(dynamicButton.Location.X + dynamicButton.Width + 30, dynamicButton.Location.Y);
                    dynamicButton.Select();
                }

                y++;
            }

            /*foreach (CChapter oChapter in htChapter.Values)
             * {
             *  windowsLocation = new Point(richTextBox1.Location.X + 20, y * 60);
             *  Button dynamicButton = CreateDynamicButton(oChapter.ChapterNameId, oChapter.ChapterName, oChapter.ChapterNumberId, windowsLocation);
             *  if (y == 1)
             *  {
             *      circularButton1.Location = new Point(dynamicButton.Location.X + dynamicButton.Width + 30, dynamicButton.Location.Y);
             *      dynamicButton.Select();
             *  }
             *
             *  y++;
             * }*/
        }
Пример #2
0
        private bool LoadChapterData(XmlNode oBookNode)
        {
            if (oBookNode == null)
            {
                return(false);
            }

            try
            {
                int iChapterId = 1;

                foreach (XmlNode oNode in oBookNode)
                {
                    if (oNode.Name == "chapter")
                    {
                        CChapter oChapter = new CChapter(iChapterId, oNode);
                        m_htChapter.Add(iChapterId, oChapter);
                        iChapterId++;
                    }
                }
            }
            catch
            {
                MessageBox.Show("Erro ao carregar capítulos.", "Erro",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                return(false);
            }

            return(true);
        }