private async void button2_Click(object sender, EventArgs e) { if (tBox1.Text != "") { btn[0] = true; UI(btn); cts = new CancellationTokenSource(); var token = cts.Token; Logic.Info info = W.Machine(Duom.name[0]); foreach (var ats1 in FileReader.Veiksmas(info.log, info.x, Duom.ats, info.arr, info.instr, Duom.h, Duom.Stop, Duom.ATS, token)) { await Task.Delay(1); tBox1.Text = ats1; } } btn[0] = false; }
private async void strtBtn4_Click(object sender, EventArgs e) { if (tBox4.Text != "") { btn[3] = true; UI(btn); cts = new CancellationTokenSource(); var token = cts.Token; Logic.Info info3 = W.Machine(Duom.name[3]); foreach (var ats4 in FileReader.Veiksmas(info3.log, info3.x, Duom.ats, info3.arr, info3.instr, Duom.h, Duom.Stop, Duom.ATS, token)) { await Task.Delay(1).ConfigureAwait(false); tBox4.Text = ats4; } btn[3] = false; } }
private void strtAllBtn1_Click(object sender, EventArgs e) { Duom.Stop = false; stopBtn1.Enabled = true; strtAllBtn1.Enabled = false; groupBox1.Enabled = false; groupBox2.Enabled = false; groupBox3.Enabled = false; groupBox4.Enabled = false; cts = new CancellationTokenSource(); var token = cts.Token; Parallel.Invoke(() => { this.BeginInvoke((Action)async delegate() { Logic.Info info = W.Machine(Duom.name[0]); { foreach (var ats1 in FileReader.Veiksmas(info.log, info.x, Duom.ats, info.arr, info.instr, Duom.h, Duom.Stop, Duom.ATS, token)) { await Task.Delay(1); tBox1.Text = ats1; } } }); }, () => { this.BeginInvoke((Action)async delegate() { Logic.Info info1 = W1.Machine(Duom.name[1]); foreach (var ats2 in FileReader.Veiksmas(info1.log, info1.x, Duom.ats, info1.arr, info1.instr, Duom.h, Duom.Stop, Duom.ATS, token)) { await Task.Delay(1); tBox2.Text = ats2; } }); }, () => { this.BeginInvoke((Action)async delegate() { Logic.Info info2 = W2.Machine(Duom.name[2]); foreach (var ats3 in FileReader.Veiksmas(info2.log, info2.x, Duom.ats, info2.arr, info2.instr, Duom.h, Duom.Stop, Duom.ATS, token)) { await Task.Delay(1); tBox3.Text = ats3; } }); }, () => { this.BeginInvoke((Action)async delegate() { Logic.Info info3 = W3.Machine(Duom.name[3]); foreach (var ats4 in FileReader.Veiksmas(info3.log, info3.x, Duom.ats, info3.arr, info3.instr, Duom.h, Duom.Stop, Duom.ATS, token)) { await Task.Delay(1); tBox4.Text = ats4; } }); } ); }