public PageInfo(string fileName, string filePath, SchemeInfo scheme)
        {
            isErrorsOccurred = false;
            originalFileName = fileName;
            currentScheme    = scheme;
            xmlFile          = XDocument.Load(filePath);

            tabPage            = new TabPage(originalFileName);
            tabPage.AutoScroll = true;

            xmlFile = MainForm.ReadTagsToReplace(xmlFile, originalFileName);

            xmlFileObject = FillGroups(currentScheme);

            CheckForErrors();

            MainForm.mainTabControl.Controls.Add(tabPage);
        }
        XmlInfo FillGroups(SchemeInfo scheme)
        {
            XmlInfo xmlInfo = new XmlInfo();

            List <GroupInfo> groupsInfo = new List <GroupInfo>();

            for (int i = 0; i < scheme.groupsAbstractions.Count; i++)
            {
                GroupInfo gi = new GroupInfo(scheme.groupsAbstractions[i].groupParameters);
                for (int j = 0; j < scheme.groupsAbstractions[i].tagsInGroup.Count; j++)
                {
                    if (scheme.groupsAbstractions[i].tagsInGroup[j] is SingleTagAbstract)
                    {
                        SingleTagAbstract sta = scheme.groupsAbstractions[i].tagsInGroup[j] as SingleTagAbstract;
                        TagSingleInfo     tsi = new TagSingleInfo(sta.tagParameters);
                        tsi.xmlDoc = xmlFile;
                        gi.elements.Add(tsi);
                    }
                    else if (scheme.groupsAbstractions[i].tagsInGroup[j] is MultipleTagAbstract)
                    {
                        MultipleTagAbstract mta = scheme.groupsAbstractions[i].tagsInGroup[j] as MultipleTagAbstract;
                        TagMultipleInfo     tmi = new TagMultipleInfo(mta.tagParameters);
                        tmi.xmlDoc = xmlFile;
                        gi.elements.Add(tmi);
                    }
                    else if (scheme.groupsAbstractions[i].tagsInGroup[j] is DividerTagAbstract)
                    {
                        DividerTagAbstract dta = scheme.groupsAbstractions[i].tagsInGroup[j] as DividerTagAbstract;
                        TagDivider         td  = new TagDivider(dta.tagParameters, dta.counter);
                        gi.elements.Add(td);
                    }
                    else
                    {
                        throw new Exception("Помилка в побудові обїектної моделі Xml файлу");
                    }
                }
                groupsInfo.Add(gi);
            }

            xmlInfo.tagGroups.AddRange(groupsInfo);

            return(xmlInfo);
        }
        void ShowControls(XmlInfo xmlInfo, TabPage page)
        {
            page.Controls.Clear();

            int previousGBYPosition = 4; //координати попередньої групи

            //цикл перебору груп
            for (int i = 0; i < xmlInfo.tagGroups.Count; i++)
            {
                int previousControlYPosition = 20;            //координати попереднього контролу

                GroupBox gb = xmlInfo.tagGroups[i].infoGroup; //скорочення для групи

                gb.Location = new Point(4, previousGBYPosition);

                int sizeCounter = 0;

                //цикл перебору контролів
                for (int j = 0; j < xmlInfo.tagGroups[i].elements.Count; j++)
                {
                    //якщо тег одиночний
                    if (xmlInfo.tagGroups[i].elements[j] is TagSingleInfo && xmlInfo.tagGroups[i].elements[j].show)
                    {
                        TagSingleInfo tagSI = xmlInfo.tagGroups[i].elements[j] as TagSingleInfo;

                        tagSI.infoLabel.Size     = new Size(150, 13);
                        tagSI.infoLabel.Location = new Point(6, previousControlYPosition);

                        tagSI.infoControl.Size     = new Size(450, 20);
                        tagSI.infoControl.Location = new Point(170, previousControlYPosition);

                        if (tagSI.helperButton != null)
                        {
                            tagSI.helperButton.Size     = new Size(20, 20);
                            tagSI.helperButton.Location = new Point(625, previousControlYPosition);
                            tagSI.helperButton.Click   += HelperButton_Click;
                            tagSI.helperButton.TabStop  = false;
                        }

                        previousControlYPosition = previousControlYPosition + tagSI.infoControl.Size.Height + 4;

                        gb.Controls.Add(tagSI.infoLabel);
                        gb.Controls.Add(tagSI.infoControl);
                        if (tagSI.helperButton != null)
                        {
                            gb.Controls.Add(tagSI.helperButton);
                        }

                        sizeCounter++;
                    }
                    //якщо тег повторюваний
                    else if (xmlInfo.tagGroups[i].elements[j] is TagMultipleInfo)
                    {
                        TagMultipleInfo tagMI = xmlInfo.tagGroups[i].elements[j] as TagMultipleInfo;

                        for (int k = 0; k < tagMI.infoLabels.Count; k++)
                        {
                            tagMI.infoLabels[k].Size     = new Size(150, 13);
                            tagMI.infoLabels[k].Location = new Point(6, previousControlYPosition);

                            tagMI.infoControls[k].Size     = new Size(450, 20);
                            tagMI.infoControls[k].Location = new Point(170, previousControlYPosition);

                            if (tagMI.helperButtons.Count == tagMI.infoLabels.Count)
                            {
                                tagMI.helperButtons[k].Size     = new Size(20, 20);
                                tagMI.helperButtons[k].Location = new Point(625, previousControlYPosition);
                                tagMI.helperButtons[k].Click   += HelperButton_Click;
                                tagMI.helperButtons[k].TabStop  = false;
                            }

                            previousControlYPosition = previousControlYPosition + tagMI.infoControls[k].Size.Height + 4;

                            gb.Controls.AddRange(tagMI.infoLabels.ToArray());
                            gb.Controls.AddRange(tagMI.infoControls.ToArray());
                            if (tagMI.helperButtons.Count == tagMI.infoLabels.Count)
                            {
                                gb.Controls.AddRange(tagMI.helperButtons.ToArray());
                            }
                            sizeCounter++;
                        }
                    }
                    else if (xmlInfo.tagGroups[i].elements[j] is TagDivider)
                    {
                        TagDivider tagDiv = xmlInfo.tagGroups[i].elements[j] as TagDivider;

                        tagDiv.divider.Size     = new Size(150, 13);
                        tagDiv.divider.Location = new Point(6, previousControlYPosition);

                        previousControlYPosition = previousControlYPosition + tagDiv.divider.Size.Height + 12;

                        gb.Controls.Add(tagDiv.divider);
                        sizeCounter++;
                    }
                }
                gb.Size             = new Size(650, (24 * (sizeCounter)) + 26); //обчислення розміру
                previousGBYPosition = previousGBYPosition + gb.Size.Height + 4; //нові координати попередньої групи
                page.Controls.Add(gb);                                          //додання групи з контролами на панель
            }
        }
 public void RefreshPageInfo()
 {
     xmlFileObject = FillGroups(currentScheme);
     CheckForErrors();
 }