예제 #1
0
 private void CheckboxCheckedEvent(VariableLine variableLine)
 {
     if (outputVariable != variableLine)
     {
         outputVariable.Checked = false;
     }
     inputVariables.ForEach(x => { if (x != variableLine)
                                   {
                                       x.Checked = false;
                                   }
                            });
     selectedVariable = variableLine;
     RefreshStackPanel(varStackPanel, variableLine.MemberFunctions);
 }
예제 #2
0
        private void cbxInputs_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            inputVariables.Clear();
            inputStackPanel.Children.Clear();
            inputsStackPanel.Children.Clear();

            for (int i = 1; i <= cbxInputs.SelectedIndex + 1; i++)
            {
                var item = new VariableLine(i);
                item.CheckBoxChecked += CheckboxCheckedEvent;
                inputVariables.Add(item);
                inputStackPanel.Children.Add(item);

                var textBox = new TextBox();
                textBox.Margin = new Thickness(5, 10, 15, 0);
                inputsStackPanel.Children.Add(textBox);
                inputTextBoxes.Add(textBox);
            }
            ruleLines.Clear();
            listBoxRules.Items.Refresh();
            btnRefreshRules_Click(this, null);
        }
예제 #3
0
        public MainWindow()
        {
            InitializeComponent();

            processor             = new MamdaniProcessor();
            cbxInputs.ItemsSource = new List <int> {
                1, 2, 3
            };
            inputVariables = new List <VariableLine>();
            outputVariable = new VariableLine(1);
            outputVariable.CheckBoxChecked += CheckboxCheckedEvent;
            outputStackPanel.Children.Add(outputVariable);
            ruleLines                = new List <RuleLine>();
            inputTextBoxes           = new List <TextBox>();
            listBoxRules.ItemsSource = ruleLines;

            cbxDefuzzifiction.Items.Add("Left Max");
            cbxDefuzzifiction.Items.Add("Center Max");
            cbxDefuzzifiction.Items.Add("Right Max");
            cbxDefuzzifiction.SelectedIndex = 0;
            cbxInputs.SelectedIndex         = 1;
        }