Esempio n. 1
0
        public int ReadTags()
        {
            foreach (GroupInfo gi in tagGroups)
            {
                foreach (TagInfo ti in gi.elements)
                {
                    if (ti is TagSingleInfo)
                    {
                        TagSingleInfo tsi = ti as TagSingleInfo;
                        tsi.ReadValue(errors);
                    }

                    else if (ti is TagMultipleInfo)
                    {
                        TagMultipleInfo tmi = ti as TagMultipleInfo;
                        tmi.ReadValue(errors);
                    }
                }
            }
            if (errors.Count > 0)
            {
                return(1);
            }
            else
            {
                return(0);
            }
        }
        public ErrorForm(List <ReadError> errors)
        {
            InitializeComponent();
            this.errors = errors;

            for (int i = 0; i < errors.Count; i++)
            {
                ErrorsDataGridView.Rows.Add(new DataGridViewRow());
                ErrorsDataGridView["ErrorMessage", i].Value = errors[i].message;

                if (errors[i].problemTag is TagSingleInfo)
                {
                    TagSingleInfo tsi = errors[i].problemTag as TagSingleInfo;
                    ErrorsDataGridView["TagPath", i].Value = tsi.fullXPath;
                }
                else if (errors[i].problemTag is TagMultipleInfo)
                {
                    TagMultipleInfo tmi = errors[i].problemTag as TagMultipleInfo;
                    ErrorsDataGridView["TagPath", i].Value = tmi.fullXPath;
                }
                else
                {
                    MessageBox.Show("Сталася якась хєрня, дзвоніть розробнику");
                }
            }
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        public void SaveTags()
        {
            foreach (GroupInfo gi in tagGroups)
            {
                foreach (TagInfo ti in gi.elements)
                {
                    if (ti is TagSingleInfo)
                    {
                        TagSingleInfo tsi = ti as TagSingleInfo;
                        tsi.SaveValue();
                    }

                    else if (ti is TagMultipleInfo)
                    {
                        TagMultipleInfo tmi = ti as TagMultipleInfo;
                        tmi.SaveValue();
                    }
                }
            }
        }
Esempio n. 5
0
        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);                                          //додання групи з контролами на панель
            }
        }