Beispiel #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //AltPeriority_dgv.Hide();
            //AltCheckConsistency_button.Hide();
            label2.Hide();
            Criterias_comboBox.Hide();

            NormalizedMatrix_dgv.Hide();
            CriteriaWeight_dgv.Hide();
            label1.Hide();
            CriteriaWeight_label.Hide();
            CheckConsistency_button.Hide();
            treeView1.Nodes.Add(root);

            Criterias_dgv.AutoSizeColumnsMode        = DataGridViewAutoSizeColumnsMode.DisplayedCells;
            NormalizedMatrix_dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;


            Alternatives_dgv.AutoSizeColumnsMode          = DataGridViewAutoSizeColumnsMode.DisplayedCells;
            AlterNormalizedMatrix_dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
            AlternativesWeight_dgv.AutoSizeColumnsMode    = DataGridViewAutoSizeColumnsMode.DisplayedCells;
            //AltPeriority_dgv.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.DisplayedCells;
        }
Beispiel #2
0
        private void Update_button_Click_1(object sender, EventArgs e)
        {
            int max_level = parameterList.Max(m => m.level);

            parametersToCompare = new List <string>();
repeat:
            var query = (from p in parameterList
                         where p.level == current_level
                         select p).ToList();

            if (max_level == 1)
            {
                coveringCriterias     = GetLeafNodes(parameterList);
                Update_button.Enabled = false;
                tabControl1.SelectTab(1);
                return;
            }
            while (query.Count > nextCounter)
            {
                if (query[nextCounter].hasChild)
                {
                    foreach (var item in query[nextCounter].children)
                    {
                        parametersToCompare.Add(item.name);
                    }
                    break;
                }
                else
                {
                    nextCounter++;
                }
            }

            nextCounter++;

            if (parametersToCompare.Count == 0)
            {
                current_level++;
                nextCounter = 0;
                if (current_level == max_level)
                {
                    coveringCriterias     = GetLeafNodes(parameterList);
                    Update_button.Enabled = false;
                    tabControl1.SelectTab(1);
                    return;
                }
                else
                {
                    goto repeat;
                }
            }
            criteria_matrix = Matrix <double> .Build.Dense(parametersToCompare.Count, parametersToCompare.Count, 1);

            DataTable data = ahp.GetTable(parametersToCompare, criteria_matrix);

            ahp.DisplayTable(data, Criterias_dgv, parametersToCompare);

            for (int i = 0; i < Criterias_dgv.Rows.Count; i++)
            {
                for (int j = 0; j < Criterias_dgv.Columns.Count; j++)
                {
                    if (i == j)
                    {
                        Criterias_dgv.Rows[i].Cells[j].ReadOnly        = true;
                        Criterias_dgv.Rows[i].Cells[j].Style.BackColor = Color.LightGray;
                    }
                }
            }

            Criterias_comboBox.Hide();
            label2.Hide();
        }