private async void btnSimplify_Click(object sender, RoutedEventArgs e) { if (IsSolving) { MessageBox.Show("The solver is busy."); return; } IsSolving = true; string transformMe = this.GetMainLine(); if (transformMe == "" | transformMe == null) { IsSolving = false; return; } SolverDialog = new SolverDialog(); SolverDialog.ParentWindow = this; SolverDialog.Show(); List <Operator> operators = Operator.BuildOperators(); string transformedResult = await Task.Run(() => Solvers.Simplify(transformMe, MaxRepetitions, MaxPopulationSize, operators)); SolverDialog.Close(); if (transformedResult != "" & transformedResult != null) { PutTextInTextBox(transformedResult); } IsSolving = false; }
private async void btnIsolate_Click(object sender, RoutedEventArgs e) { if (IsSolving) { MessageBox.Show("The solver is busy."); return; } IsSolving = true; InputBox inputBox = new InputBox(); inputBox.Label1.Content = "Enter the variable you want to isolate."; inputBox.ShowDialog(); string isolateMe = inputBox.TextBox1.Text; if (isolateMe == null | isolateMe == "") { IsSolving = false; return; } //string equation = this.GetLine(); string equation = this.GetMainLine(); if (equation == "" | equation == null) { IsSolving = false; return; } if (equation.Contains("=") == false) { MessageBox.Show("You have to enter an equation."); IsSolving = false; return; } SolverDialog = new SolverDialog(); SolverDialog.ParentWindow = this; SolverDialog.Show(); List <Operator> operators = Operator.BuildOperators(); string transformedResult = await Task.Run(() => Solvers.Isolate(equation, isolateMe, MaxRepetitions, MaxPopulationSize, operators)); SolverDialog.Close(); if (transformedResult != "" & transformedResult != null) { PutTextInTextBox(transformedResult); } IsSolving = false; }