コード例 #1
0
ファイル: StackToRangeForm.cs プロジェクト: grondman/SNGEGT
        public StackToRangeForm()
        {
            InitializeComponent();
            for (int i = 0; i < dataGridView1.Columns.Count; i++)
            {
                dataGridView1.Columns[i].ValueType = typeof(UInt32);
            }
            stackinfos = new List <stackblind>(5);
            try
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(Path.Combine(Application.StartupPath, xmlfile));
                XmlNode node = doc.DocumentElement == null ? null : doc.DocumentElement.FirstChild;

                while (node != null)
                {
                    XmlNode childnode;
                    if (node.Name == "BlindStacks")
                    {
                        childnode = node.FirstChild;
                        while (childnode != null)
                        {
                            stackblind tmp = new stackblind(-1, -1);
                            if (tmp.Load(childnode))
                            {
                                stackinfos.Add(tmp);
                            }
                            childnode = childnode.NextSibling;
                        }
                    }
                    node = node.NextSibling;
                }
            }
            catch (Exception)
            {
            }
            stackinfos.Sort();

            dataGridView1.Rows.Clear();
            dataGridView1.RowCount = stackinfos.Count + 1;
            int divindex   = dataGridView1.Columns["StackDivBlind"].Index;
            int rangeindex = dataGridView1.Columns["Range"].Index;

            for (int i = 0; i < stackinfos.Count; i++)
            {
                dataGridView1.Rows[i].Cells[divindex].Value   = stackinfos[i].division;
                dataGridView1.Rows[i].Cells[rangeindex].Value = stackinfos[i].range;
            }
        }
コード例 #2
0
ファイル: StackToRangeForm.cs プロジェクト: stephica/SNGEGT
        public StackToRangeForm()
        {
            InitializeComponent();
            for (int i = 0; i < dataGridView1.Columns.Count; i++)
                dataGridView1.Columns[i].ValueType = typeof(UInt32);
            stackinfos = new List<stackblind>(5);
            try
            {
                XmlDocument doc = new XmlDocument();
                doc.Load(Path.Combine(Application.StartupPath, xmlfile));
                XmlNode node = doc.DocumentElement == null ? null : doc.DocumentElement.FirstChild;

                while (node != null)
                {
                    XmlNode childnode;
                    if (node.Name == "BlindStacks")
                    {
                        childnode = node.FirstChild;
                        while (childnode != null)
                        {
                            stackblind tmp = new stackblind(-1, -1);
                            if (tmp.Load(childnode))
                                stackinfos.Add(tmp);
                            childnode = childnode.NextSibling;
                        }
                    }
                    node = node.NextSibling;
                }

            }
            catch (Exception)
            {
            }
            stackinfos.Sort();

            dataGridView1.Rows.Clear();
            dataGridView1.RowCount = stackinfos.Count+1;
            int divindex = dataGridView1.Columns["StackDivBlind"].Index;
            int rangeindex = dataGridView1.Columns["Range"].Index;
            for (int i = 0; i < stackinfos.Count; i++)
            {
                dataGridView1.Rows[i].Cells[divindex].Value = stackinfos[i].division;
                dataGridView1.Rows[i].Cells[rangeindex].Value = stackinfos[i].range;
            }
        }