Exemplo n.º 1
0
 /// <summary>
 /// add Page
 /// </summary>
 private void addPage()
 {
     Page pg = new Page();
     pg.ID = Settings.CurrentPbk.Pages.Count + 1;
     Settings.CurrentPbk.Pages.Add(pg);
     fillPageListBox();
 }
Exemplo n.º 2
0
        /// <summary>
        /// fill pbk object from xml file
        /// </summary>
        /// <param name="Pbk"></param>
        internal void filFromXML(pbk Pbk)
        {
            XmlDocument xDoc = new XmlDocument();
            xDoc.Load(Settings.ROOT_PATH_OF_PROJECT + "\\" + Settings.CONTINER_FILE_NAME);

            XmlNode xnTitle = xDoc.SelectSingleNode("//book//title//text()");
            Pbk.Title = xnTitle.InnerText;

            XmlNode xnAuthor = xDoc.SelectSingleNode("//book//author//text()");
            Pbk.Author = xnAuthor.InnerText;

            XmlNode xnCategory = xDoc.SelectSingleNode("//book//category//text()");
            Pbk.Category = xnCategory.InnerText;

            XmlNode xnDescription = xDoc.SelectSingleNode("//book//description//text()");
            Pbk.Description = xnDescription.InnerText;

            XmlNodeList xnPages = xDoc.SelectNodes("//book//pages//page");
            foreach (XmlNode xn in xnPages)
            {
                Page pg = new Page();

                //XmlNode xnID = xn.SelectSingleNode("//id//text()");
                pg.ID = Convert.ToInt16(xn.ChildNodes[0].InnerText);

                //XmlNode xnPic = xn.SelectSingleNode("//picture//text()");
                pg.Picture = xn.ChildNodes[1].InnerText;// xnPic.InnerText;

                //XmlNode xnSound = xn.SelectSingleNode("//sound//text()");
                pg.Sound = xn.ChildNodes[2].InnerText;// xnSound.InnerText;

                //XmlNode xnText = xn.SelectSingleNode("//text//text()");
                pg.Text = xn.ChildNodes[3].InnerText;// xnText.InnerText;

                Pbk.Pages.Add(pg);
            }

                if(isCoverExists())
                {
                   Pbk.Cover=Settings.COVER_FILE;
                }
                if (isThumbnailExists())
                {
                    Pbk.Thumbnail = Settings.THUMBNAIL_FILE;
                }
        }