/// <summary>
        ///
        /// </summary>
        private void Save()
        {
            List <DisplayPageSerialise> displayLstS = new List <DisplayPageSerialise>();
            XMLConverter xml = new XMLConverter();

            //Directory.CreateDirectory(saveFolder + @"\images");

            foreach (DisplayPage d in pageLst)
            {
                DisplayPageSerialise dS = new DisplayPageSerialise();
                dS.name            = d.displayPageName;
                dS.backgroundImage = d.GetByteArrayFromBachgroundImage();
                dS.buttonList      = new List <CustomButtonSerialise>();
                dS.circleBtnLst    = new List <CircleButtonSerialise>();

                if (d.GetButtonList().Count > 0)
                {
                    foreach (CustomButton c in d.GetButtonList())
                    {
                        CustomButtonSerialise cS = new CustomButtonSerialise();
                        cS.btnType  = c.GetButtonType();
                        cS.pageLink = c.GetPageLink();
                        cS.poly     = c.GetPoly();
                        dS.buttonList.Add(cS);
                    }
                }

                if (d.GetCircleBtnLst().Count > 0)
                {
                    foreach (CircleButton c in d.GetCircleBtnLst())
                    {
                        CircleButtonSerialise cS = new CircleButtonSerialise();
                        cS.centre   = c.GetCentre();
                        cS.pageLink = c.GetPageLink();
                        cS.radius   = c.GetRadius();
                        dS.circleBtnLst.Add(cS);
                    }
                }

                displayLstS.Add(dS);
            }
            File.WriteAllText(saveFolder, xml.ToXml(displayLstS));
        }
예제 #2
0
        public string FormatToXML(List <DisplayPage> dLst)
        {
            List <DisplayPageSerialise> displayLstS = new List <DisplayPageSerialise>();
            XMLConverter xml = new XMLConverter();

            foreach (DisplayPage d in dLst)
            {
                DisplayPageSerialise dS = new DisplayPageSerialise();
                dS.name            = d.displayPageName;
                dS.backgroundImage = d.GetBackgroundImage();
                dS.buttonList      = new List <CustomButtonSerialise>();
                dS.circleBtnLst    = new List <CircleButtonSerialise>();

                if (d.GetButtonList().Count > 0)
                {
                    foreach (CustomButton c in d.GetButtonList())
                    {
                        CustomButtonSerialise cS = new CustomButtonSerialise();
                        cS.btnType  = c.GetButtonType();
                        cS.pageLink = c.GetPageLink();
                        cS.poly     = c.GetPoly();
                        dS.buttonList.Add(cS);
                    }
                }

                if (d.GetCircleBtnLst().Count > 0)
                {
                    foreach (CircleButton c in d.GetCircleBtnLst())
                    {
                        CircleButtonSerialise cS = new CircleButtonSerialise();
                        cS.centre   = c.GetCentre();
                        cS.pageLink = c.GetPageLink();
                        cS.radius   = c.GetRadius();
                    }
                }

                displayLstS.Add(dS);
            }

            return(xml.ToXml(displayLstS));
        }