Beispiel #1
0
        private void Edit_Function(object sender, RoutedEventArgs e)
        {
            DlgAddFunction    dlg = new DlgAddFunction();
            EvaluatedFunction evaluatedFunction = FunctionGrid.SelectedItem as EvaluatedFunction;
            int indexOfFunction = evaluatedFunctionsList.IndexOf(evaluatedFunction);

            dlg.functionExpression.Text = evaluatedFunction.Function;
            dlg.xFirst.Value            = evaluatedFunction.xDomain.X;
            dlg.xLast.Value             = evaluatedFunction.xDomain.Y;
            dlg.yFirst.Value            = evaluatedFunction.yDomain.X;
            dlg.yLast.Value             = evaluatedFunction.yDomain.Y;
            if (dlg.ShowDialog() == true)
            {
                evaluatedFunction.setxDomain((double)dlg.xFirst.Value, (double)dlg.xLast.Value);
                evaluatedFunction.setyDomain((double)dlg.yFirst.Value, (double)dlg.yLast.Value);
                evaluatedFunctionsList[indexOfFunction] = evaluatedFunction;
                FunctionGrid.Items.Refresh();
            }
        }
Beispiel #2
0
        private void AddFunction(object sender, RoutedEventArgs e)
        {
            EvaluatedFunction evaluatedFunction;
            DlgAddFunction    dlg = new DlgAddFunction();

            if (dlg.ShowDialog() == true)
            {
                string functionExpression = dlg.functionExpression.Text;
                double xFirstValue        = (double)dlg.xFirst.Value;
                double xLastValue         = (double)dlg.xLast.Value;
                double yFirstValue        = (double)dlg.yFirst.Value;
                double yLastValue         = (double)dlg.yLast.Value;
                evaluatedFunction = new EvaluatedFunction(functionExpression, xFirstValue, xLastValue, yFirstValue, yLastValue);
                evaluatedFunctionsList.Add(evaluatedFunction);
                FunctionGrid.Items.Refresh();
                if (FunctionGrid.Columns.Count == 4)
                {
                    FunctionGrid.Columns[3].Visibility = Visibility.Hidden;
                }
            }
        }