コード例 #1
0
        private void cboManual_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(cboP1.Text) ||
                string.IsNullOrEmpty(cboP2.Text) ||
                string.IsNullOrEmpty(cboC.Text) ||
                string.IsNullOrEmpty(cboType.Text))
            {
                return;
            }

            var sb = new StringBuilder();
            var q  = new char[3];

            q[0] = cboP1.Text[0];
            q[1] = cboP2.Text[0];
            q[2] = cboC.Text[0];
            var type   = int.Parse(cboType.Text);
            var syl    = new Syllogism(q, type);
            var strSyl = Syllogism.GenerateSyllogism(type, q, txtS.Text, txtP.Text, txtM.Text);

            sb.AppendLine(syl.ToString());
            sb.AppendLine();
            sb.AppendLine(strSyl);
            if (syl.IsValid)
            {
                sb.AppendLine("HỢP LỆ");
            }
            else
            {
                sb.AppendLine("KHÔNG HỢP LỆ");
            }
            txtManualResult.Text = sb.ToString();
        }
コード例 #2
0
        private void btnGenerateAllValid_Click(object sender, EventArgs e)
        {
            var sb = new StringBuilder();

            foreach (var pattern in _patterns)
            {
                sb.AppendLine(pattern.ToString());
                var s = Syllogism.GenerateSyllogism(pattern.Type, pattern.Content, txtS.Text, txtP.Text, txtM.Text);
                sb.AppendLine(s);
            }
            txtAutoResult.Text = sb.ToString();
        }