コード例 #1
0
        private async void button1_Click(object sender, EventArgs e)
        {
            await ReadFwsAsync();

            ReadData();

            toolStripStatusLabel1.Text = "Вычисляет u(x,t)";

            timer1.Start();
            await CalcUxtAsync();

            toolStripProgressBar1.Value = toolStripProgressBar1.Maximum;
            timer1.Stop();

            var s = WriteUxt();

            toolStripStatusLabel1.Text = "Вычисляет u(x,w)";

            await CalcUxwAsync();

            toolStripStatusLabel1.Text = "Запускает скрипт";
            await Task.Run(() => OtherMethods.StartProcess2("OnePoint.r"));

            OtherMethods.PlaySound("ВычисленияЗавершены");

            GetUxtInfo(s);
            this.Close();
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        private async void toolStripButton2_Click(object sender, EventArgs e)
        {
            const int howmany = 40;

            if (MessageBox.Show($"Для текущего прямоугольника будут произведены все построения на сетке {howmany}*{howmany}, затем будут показаны некоторые результаты в случайном порядке. Это займёт время. Взглянув на результаты, пользователь должен сам обрезать исходный прямоугольник. Выполнить?",
                                "Тестирование для опеределения области", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.No)
            {
                return;
            }

            OtherMethods.PlaySound("Поехали");
            SetDir();
            SetSymbols();
            GetData();

            var tmp = GetDataPaths();

            string[] names     = tmp.Item1;
            string[] wheredata = tmp.Item2;

            all = howmany * howmany;
            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++)
                {
                    string savename = $"{snames[k]} -> {symbols[i]}";

                    toolStripLabel1.Text = $"Замер {symbols[i]}, источник {snames[k]}, осталось {alles--}";

                    var tuple = await Functions.GetMaximunFromAreaAsync(
                        new NetOnDouble(Wnet, 40), new NetOnDouble(Tnet, 40),
                        progress, new System.Threading.CancellationToken(),
                        globalTimeMin, timestep, tickCount, othernames[k], Path.Combine(Environment.CurrentDirectory, savename.Replace(" -> ", "to")),
                        MyWavelet, wheredata[i], 32, epsForWaveletValues);
                }
                SetDefaltProgressBar();
                timer1.Stop();
                OtherMethods.PlaySound("ЗамерОбработан");
            }

            string where = Path.GetDirectoryName(Path.GetDirectoryName(wheredata[0]));
            CopyAtoA(where);
            ShowPdfs(where);


            SetDefaultStrip();
            OtherMethods.PlaySound("ТестированиеОкончено");
        }
コード例 #4
0
        private async Task UxtIterationAsync(string dir, int i, int len)
        {
            save = 0;
            Timer1_Tick(new object(), new EventArgs());
            label9.Text = $"Обрабатывается{Environment.NewLine}замер {i + 1} (из {len})";
            toolStripStatusLabel1.Text = $"Считывается f(w) для замера {i + 1}";
            var s = Source.GetSourcesWithReadFw(dir, sourcesArray);

            await ManyPZAsync(s, dir);

            OtherMethods.PlaySound("ЗамерОбработан");
        }
コード例 #5
0
 private static void SetExeptions()
 {
     AppDomain.CurrentDomain.UnhandledException += (object sender, UnhandledExceptionEventArgs args) =>
     {
         OtherMethods.PlaySound("КритическаяОшибка");
         var ex = (args.ExceptionObject as Exception);
         if (MessageBox.Show($"Произошло исключение \" {ex.Message} \", которое не было перехвачено. Программа будет закрыта, стек исключения находится в файле Exeptions.txt",
                             "Неперехваченное исключение", MessageBoxButton.OK, MessageBoxImage.Exclamation) == MessageBoxResult.OK)
         {
             МатКлассы.Expendator.WriteStringInFile("Exeptions.txt", (ex.StackTrace));
             Environment.Exit(1);
         }
     };
 }
コード例 #6
0
        /// <summary>
        /// Вычислить/прочесть u(x,w), сделать замеры или не сделать
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public async void button4_Click(object sender, EventArgs e)
        {
            BeforeGenerateUXW();

            await GenerateUXWAsync();

            button2.Show();
            toolStripStatusLabel1.Text = "Начинается построение";
            OtherMethods.PlaySound("Uxt");
            другиеПараметрыToolStripMenuItem.Visible = false;

            await UxtCalcAsync();

            AfterGenerate();
        }
コード例 #7
0
        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 = "";
        }
コード例 #8
0
        /// <summary>
        /// Суммирование замеров, построение анимации и прочие заключительные действия
        /// </summary>
        /// <returns></returns>
        private async Task AfterLoopsActAsync()
        {
            label9.Show();
            label9.Text = $"Суммирование{Environment.NewLine}по замерам";
            toolStripStatusLabel1.Text = $"Запущено построение u-surfaces";
            toolStripStatusLabel2.Text = $"";
            BegShow();
            string gl = $"{Source.ToString(sourcesArray)}, (xmin, xmax, count, ymin, ymax) = ({xmin}, {xmax}, {count}dot{count2}, {ymin}, {ymax})";

            await Task.Run(() =>
            {
                StreamWriter ts  = new StreamWriter("textnames.txt");
                StreamWriter pds = new StreamWriter("pdfnames.txt");

                Expendator.WriteStringInFile("SurfaceMain.txt", gl);

                double th = (tmax - tmin) / (tcount - 1);
                for (int i = 0; i < tcount; i++)
                {
                    double t = tmin + i *th;
                    if (t == 0)
                    {
                        continue;
                    }
                    string tit = $"{Source.ToString(sourcesArray)}, t = {t.ToString(4)}, (xmin, xmax, count, ymin, ymax) = ({xmin}, {xmax}, {count}dot{count2}, {ymin}, {ymax})";
                    ts.WriteLine(tit + ".txt");
                    pds.WriteLine($"3D ur, uz(title , {tit} ).pdf");
                    filenames[i] = "3D " + tit + " .png";
                }
                FilenamesArrayToFile();
                ts.Close();
                pds.Close();

                OtherMethods.PlaySound("ДанныеСуммируются");
                Parallel.Invoke(
                    () => SSum(),
                    () =>
                {
                    if (Functions.ur.Lenght > 0)
                    {
                        Functions.ur.Dispose();
                        GC.Collect();
                    }
                });

                Expendator.CopyFiles(Expendator.GetWordFromFile("WhereData.txt"), Environment.CurrentDirectory, "3D ur, uz(x).txt", "3D ur, uz(y).txt");
            });

            label9.Hide();

            if (source.IsCancellationRequested)
            {
                return;
            }
            await Task.Run(() => StartProcess("OnlySurface.r", global : true));

            //new Библиотека_графики.PdfOpen("Полученные u-surfaces", Path.Combine(Environment.CurrentDirectory, $"{gl} .pdf")).Show();
            CopyImages(gl);
            ShowImages(gl);

            OtherMethods.PlaySound("ПоверхностиПостроены");

            if (count == count2)
            {
                if (MessageBox.Show("Создавать анимацию? (может занять до 15 минут)", "Анимация", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                {
                    toolStripStatusLabel1.Text = $"Построены u-surface. Создаётся массив кадров";
                    await Task.Run(() => Expendator.StartProcessOnly("ReDraw3Duxt2.r", true));

                    if (source.IsCancellationRequested)
                    {
                        return;
                    }
                    OtherMethods.PlaySound("АнимацияГотова");
                    new Anima(filenames).ShowDialog();
                }

                new Scheme(sourcesArray, new Point(xmin, ymin), xmax - xmin, ymax - ymin, gl + " (heatmap).png").Show();
                OtherMethods.PlaySound("ВычисленияЗавершены");
            }

            toolStripStatusLabel1.Text = $"Операции закончены";
        }
コード例 #9
0
 public static void CS() => OtherMethods.PlaySound("gamestartup");
コード例 #10
0
 public static void Egg() => OtherMethods.PlaySound("Пасхалка");
コード例 #11
0
 public static void TukTuk() => OtherMethods.PlaySound("achievement_earned");
コード例 #12
0
 public static void SetPositions() => OtherMethods.PlaySound("ct_point");
コード例 #13
0
 public static void OK() => OtherMethods.PlaySound("roger");
コード例 #14
0
 public static void Clear() => OtherMethods.PlaySound("clear");
コード例 #15
0
 public static void Back() => OtherMethods.PlaySound("circleback");