private Function TakeFunctionDataFromAddFunctionForm()
        {
            if (!double.TryParse(AValueTextBox.Text, out double toTest) ||
                !double.TryParse(BValueTextBox.Text, out toTest) ||
                !double.TryParse(CValueTextBox.Text, out toTest) ||
                FunctionNameTextBox.Text.Length == 0 ||
                ColorSelector.SelectedColor == null ||
                FunctionComboBox.SelectedIndex == -1)
            {
                MessageBox.Show(Constants.IncorrectDataMsg, Constants.ErrorWindowTitle, MessageBoxButton.OK, MessageBoxImage.Error);
                return(null);
            }

            double     a, b, c;
            string     FunctionName       = FunctionNameTextBox.Text;
            Color      FunctionColor      = (Color)ColorSelector.SelectedColor;
            Calculator FunctionCalculator = null;

            a = double.Parse(AValueTextBox.Text.Replace('.', ','));
            b = double.Parse(BValueTextBox.Text.Replace('.', ','));
            c = double.Parse(CValueTextBox.Text.Replace('.', ','));

            switch (FunctionComboBox.SelectedIndex)
            {
            case 0: FunctionCalculator = new CosXCalculator(a, b); break;

            case 1: FunctionCalculator = new SinXCalculator(a, b); break;

            case 2: FunctionCalculator = new NDividedXCalculator(a, b); break;

            case 3: FunctionCalculator = new XExpNCalculator(a, b); break;

            case 4: FunctionCalculator = new NExpXCalculator(a, b); break;

            case 5: FunctionCalculator = new X1Calculator(a, b); break;

            case 6: FunctionCalculator = new X2Calculator(a, b, c); break;
            }

            return(new Function(FunctionName, FunctionCalculator, FunctionColor, false));
        }
        public Calculator ToICalculator()
        {
            Calculator Calculator = null;

            switch (Type)
            {
            case TypeOfCalculator.COS: Calculator = new CosXCalculator(OperationElementsArray[0], OperationElementsArray[1]); break;

            case TypeOfCalculator.SIN: Calculator = new SinXCalculator(OperationElementsArray[0], OperationElementsArray[1]); break;

            case TypeOfCalculator.NEXPX: Calculator = new NExpXCalculator(OperationElementsArray[0], OperationElementsArray[1]); break;

            case TypeOfCalculator.XEXPN: Calculator = new XExpNCalculator(OperationElementsArray[0], OperationElementsArray[1]); break;

            case TypeOfCalculator.NDIVEDX: Calculator = new NDividedXCalculator(OperationElementsArray[0], OperationElementsArray[1]); break;

            case TypeOfCalculator.X1: Calculator = new X1Calculator(OperationElementsArray[0], OperationElementsArray[1]); break;

            case TypeOfCalculator.X2: Calculator = new X2Calculator(OperationElementsArray[0], OperationElementsArray[1], OperationElementsArray[2]); break;
            }
            return(Calculator);
        }