private async void button1_Click(object sender, EventArgs e) { OtherMethods.IlushaMethod(checkBox4); OtherMethods.PlaySound("Поехали"); SetDir(); SetSymbols(); var tmp = GetDataPaths(); string[] names = tmp.Item1; string[] wheredata = tmp.Item2; List <string> pathellipse = new List <string>(sources.Length * (sources.Length - 1)); int alles = sources.Length * (sources.Length - 1); IProgress <int> progress = new Progress <int>((int val) => save = val); for (int i = 0; i < sources.Length; i++) { var itSource = sources[i]; var otherSources = sources.Without(itSource); var othernames = names.Without(names[i]); var snames = new string(symbols.ToCharArray().Without(symbols[i])); timer1.Start(); for (int k = 0; k < otherSources.Length; k++) { TransformArea(Path.Combine(wheredata[i], $"{snames[k]}.txt"), Path.Combine(wheredata[i], othernames[k]), globalTimeMin, timestep); GetData(); string savename = $"{snames[k]} -> {symbols[i]}"; toolStripLabel1.Text = $"Замер {symbols[i]}, источник {snames[k]}, осталось {alles--}"; var tuple = (radioButton1.Checked) ? await Functions.GetMaximunFromAreaAsync(Wnet, Tnet, progress, new System.Threading.CancellationToken(), globalTimeMin, timestep, tickCount, othernames[k], Path.Combine(dir, savename.Replace(" -> ", "to")), MyWavelet, wheredata[i], byevery, epsForWaveletValues) : await Functions.GetMaximunFromAreaAsync(wmin, wmax, tmin, tmax, globalTimeMin, timestep, tickCount, othernames[k], Path.Combine(dir, savename.Replace(" -> ", "to")), MyWavelet, wheredata[i], byevery, epsForWaveletValues, pointcount, pointmax, pointmax2); pathellipse.Add($"{otherSources[k].Center.x} {otherSources[k].Center.y} {itSource.Center.x} {itSource.Center.y} {Functions.Vg2(tuple.Item1).ToRString()} {tuple.Item2.ToRString()} {i} {savename} {tuple.Item1}"); } Expendator.WriteInFile(Path.Combine("EllipseData", "Params.txt"), pathellipse.ToArray()); SetDefaltProgressBar(); timer1.Stop(); OtherMethods.PlaySound("ЗамерОбработан"); } string where = Path.GetDirectoryName(Path.GetDirectoryName(wheredata[0])); await Expendator.DirectoryCopyAsync( Path.Combine(Environment.CurrentDirectory, "EllipseData"), Path.Combine(where, "EllipseData") ); OtherMethods.PlaySound("СоздаемЭллипсы"); MakeEllipses(pathellipse.ToArray()); SetDefaultStrip(); }
private async Task GenerateUXWAsync() { OtherMethods.PlaySound("ГенерацияДанных"); timer2.Start(); toolStripStatusLabel1.Text = "Выполняется генерация u(x,w) и f(w)"; //await Task.Run( // () => // Parallel.Invoke( // () => OtherMethods.Saveuxw3(xmin, xmax, count, ymin, ymax, sourcesArray), // () => IlushaMethod() // ) // ); Task tt = Task.Run(() => OtherMethods.Saveuxw3(xmin, xmax, count, count2, ymin, ymax, sourcesArray)); OtherMethods.IlushaMethod(checkBox4); //Task.WaitAll(tt); await tt; Timer2_Tick(new object(), new EventArgs()); timer2.Stop(); toolStripStatusLabel2.Text = ""; }