public RuleWindow(Rule rule)
 {
     InitializeComponent();
     PEFunctionControl.SetValues(rule.F1);
     CPEFunctionControl.SetValues(rule.F2);
     DHFunctionControl.SetValues(rule.Output);
     FunctionNameTextBox.Text = rule.Label;
     TitleTextBlock.Text      = "Edit Rule";
     CreateButton.Content     = "Apply Changes";
 }
 private void CreateButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         Result = new Rule(FunctionNameTextBox.Text, PEFunctionControl.CreateMembershipFunction(41, -5, 5),
                           CPEFunctionControl.CreateMembershipFunction(41, -5, 5),
                           DHFunctionControl.CreateMembershipFunction(41, -5, 5));
         this.Close();
     }
     catch (FormatException exception)
     {
         MessageBox.Show("The values you have given are invalid. Plese recheck them");
         Console.Out.WriteLine(exception);
     }
 }