Exemple #1
0
        private void Generate( )
        {
            if (GrId != -1)
            {
                System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch();
                stopWatch.Start();
                EnableButtons(false);
                summaryRichTextBox.Text = "";
                var    GeneratorLoop = new GeneratorLoop(GrId);
                string summary       = GeneratorLoop.Start();
                summaryRichTextBox.Text = "Więcej informacji w pliku informacyjnym." + Environment.NewLine + Environment.NewLine + summary;
                var time = DateTime.FromBinary(GeneratorLoop.stopWatch.ElapsedMilliseconds);
                EnableButtons(true);
                stopWatch.Stop();
                MessageBox.Show("Czas generowania: " + stopWatch.Elapsed.ToString("mm\\:ss\\.ff"), "Zrobione!", MessageBoxButtons.OK);

                /*MessageBox.Show("Czas generowania: " + time.Minute + ":" +time.Second + ":" + time.Millisecond
                 *  , "Zrobione!", MessageBoxButtons.OK);*/
            }
        }
Exemple #2
0
        private async Task RunGnerateAsync()
        {
            EnableButtons(false);
            summaryRichTextBox.Text = "";
            Progress <int> progress = new Progress <int>(/*v => { generatorProgressBar.Value = v; }*/);

            progress.ProgressChanged += ReportProgress;
            System.Diagnostics.Stopwatch stopWatch = new System.Diagnostics.Stopwatch();
            stopWatch.Start();
            var groupsNames          = "";
            List <GroupModel> groups = GlobalConfig.Connection.GetGroup();
            var i = 0;

            foreach (var group in groups)
            {
                i++;
                var gen = new GeneratorLoop(group.Id);
                currentGeneratedGrNameTextBox.Text = group.Name;

                string summary = "";

                await Task.Run(() =>
                {
                    summary = gen.Start();
                });

                Report(progress, i, groups.Count);
                summaryRichTextBox.Text += (
                    Environment.NewLine
                    + "------------------"
                    + Environment.NewLine
                    + summary);
                groupsNames += Environment.NewLine + group.Name;
            }
            summaryRichTextBox.Text = "Więcej informacji w pliku informacyjnym." + Environment.NewLine + Environment.NewLine + summaryRichTextBox.Text;
            stopWatch.Stop();
            EnableButtons(true);

            MessageBox.Show("Czas generowania: " + stopWatch.Elapsed.ToString("mm\\:ss\\.ff"), "Zrobione!", MessageBoxButtons.OK);
        }