コード例 #1
0
ファイル: frmRules.cs プロジェクト: jurahf/ImmortalVenture
        /// <summary>
        /// Кнопка "Установить вывод"
        /// </summary>
        private void btnModifyResult_Click(object sender, EventArgs e)
        {
            frmAddReason f = new frmAddReason(this, false);

            if (f.ShowDialog() == DialogResult.OK && newVar != "" && newWeight != "")
            {
                Fact newFact = new Fact(es.Vars[newVar], newWeight);
                rules[getSelectedRuleName()].Result = newFact;
                lstResult.Items.Clear();
                lstResult.Items.Add(newFact);
                RefreshRule();
            }
        }
コード例 #2
0
ファイル: frmRules.cs プロジェクト: jurahf/ImmortalVenture
 /// <summary>
 /// Кнопка "Добавить посылку"
 /// </summary>
 private void btnAddReason_Click(object sender, EventArgs e)
 {
     try
     {
         frmAddReason f = new frmAddReason(this, true);
         if (f.ShowDialog() == DialogResult.OK && newVar != "" && newWeight != "")
         {
             Fact newFact = new Fact(es.Vars[newVar], newWeight);
             rules[getSelectedRuleName()].AddReason(newFact, rules[getSelectedRuleName()].Reasons.Count);
             lstReasons.Items.Add(newFact);
             // обновление имени правила
             RefreshRule();
         }
     }
     catch (RuleException re)
     {
         MessageBox.Show(re.Message);
         lstRules.SelectedIndex = -1;
     }
 }
コード例 #3
0
ファイル: frmRules.cs プロジェクト: jurahf/ImmortalVenture
 /// <summary>
 /// Кнопка "Изменить посылку"
 /// </summary>
 private void btnEditReason_Click(object sender, EventArgs e)
 {
     try
     {
         if (lstReasons.SelectedIndex < 0)
         {
             MessageBox.Show("Сначала необходимо выбрать посылку");
             return;
         }
         Fact         newFact = lstReasons.SelectedItem as Fact;
         frmAddReason fr      = new frmAddReason(this, newFact);
         if (fr.ShowDialog() == DialogResult.OK)
         {
             newFact.V      = es.Vars[newVar];
             newFact.Weight = newWeight;
             lstRules_SelectedIndexChanged(sender, e);
             RefreshRule();
         }
     }
     catch (RuleException re)
     {
         MessageBox.Show(re.Message);
     }
 }