Esempio n. 1
0
        private void startGenerateButton_Click(object sender, EventArgs e)
        {
            InitFormItem();
            InitText();

            try
            {
                drawNet1 = new DrawNet(graph, new Network(int.Parse(textBoxCityNum.Text), int.Parse(textBoxLineNum.Text)));
            }
            catch (InvalidParamException excp)
            {
                InitFormItem();

                textBoxCityNum.Text  = excp.n.ToString();
                warningLabel.Text    = string.Format("城市数为{0}时,m的范围应为[{1},{2}]", excp.n, excp.mLower, excp.mUpper);
                warningLabel.Visible = true;
                return;
            }
            catch (FormatException)
            {
                InitFormItem();
                warningLabel.Text    = "请输入数据(使用阿拉伯数字)";
                warningLabel.Visible = true;
                return;
            }

            drawNet1.DrawNormalGraphic();

            generateNetwork2Button.Enabled    = true;
            tellDependablility1Button.Enabled = true;
            equipSwitchButton1.Enabled        = true;
            equipSwitchButton2.Enabled        = false;
        }
Esempio n. 2
0
        private void generateNetwork2Button_Click(object sender, EventArgs e)
        {
            InitText();

            drawNet2 = new DrawNet(drawNet1);
            drawNet2.Net.RemoveRedundantLines();
            drawNet2.DrawNormalGraphic();

            equipSwitchButton2.Enabled = true;
            saveNetworkButton.Enabled  = true;
        }
Esempio n. 3
0
        private void tellDependablility1Button_Click(object sender, EventArgs e)
        {
            InitText();

            DrawNet tDrawNet        = new DrawNet(drawNet1);
            var     inDependentList = tDrawNet.Net.GetIndependentLineList();

            tDrawNet.DrawHighlightLineGraphic(inDependentList);

            labelTellReliability.Visible = true;
            if (inDependentList.Count == 0)
            {
                labelTellReliability.Text = "该网络是可靠网络";
            }
            else
            {
                labelTellReliability.Text = "该网络不是可靠网络";
            }
        }