private void textBox1_TextChanged(object sender, TextChangedEventArgs e) { if (console_mode) { BaseEquation be = new BaseEquation(textBox1.Text); GUIMethod = be.method; textBoxInput.Text = ExpressionTranslate.get_GUI(be); if (textBoxInput.Text != "") { textBoxInputOld = textBoxInput.Text; } } }
public void setnow(object sender, ConsoleMazeMain.BaseEquationEventArgs beea) { if (beea.be.equation_console != "" && beea.is_ans == false) { textBoxOutput.Text = "First answer:\r\n" + ExpressionTranslate.get_GUI(new BaseEquation(beea.be.equation_console)); } else { console_output("The first answer was found:"); console_output(beea.be.equation_console); int milisec = (int)DateTime.Now.Subtract(t1).TotalMilliseconds; console_output("First Answer Elapsed Time:" + milisec.ToString() + "ms\r\n"); } }
private async void button_Click(object sender, RoutedEventArgs e) { button.IsEnabled = false; //textBox2.Text = ""; //textBox2.AppendText(textBox1.Text + "\r\n"); console_output("Searching..."); t1 = DateTime.Now; ConsoleMazeMain cmm = new ConsoleMazeMain(); cmm.callback += setnow; string ans = await cmm.get_result(textBox1.Text); int milisec = (int)DateTime.Now.Subtract(t1).TotalMilliseconds; string[] anss = ans.Split(new char[1] { '\r' }); int ans_num = (ans == "answer not found\r\n" || ans == "Wrong input\r\n") ? 0 : (anss.Length - 1); console_output(ans + "Quest:\r\n" + textBox1.Text + "\r\n" + ans_num.ToString() + " answer(s) was(were) found.\r\n" + "Elapsed Time:" + milisec.ToString() + "ms\r\n"); textBoxOutput.Text = "First answer:\r\n" + ExpressionTranslate.get_GUI(new BaseEquation(anss[0])); button.IsEnabled = true; }