Beispiel #1
0
        private void buttonRun_Click(object sender, EventArgs e)
        {
            if (buttonRun.Text == "実行")
            {
                this.isRunning           = true;
                buttonRun.Text           = "キャンセル";
                buttonSaveConfig.Enabled = false;

                #pragma warning disable CS4014
                Task.Run(async() =>
                {
                    while (true)
                    {
                        if (!this.isRunning)
                        {
                            break;
                        }

                        AppConfig.TimeSchedule active = CurrentlyActiveSchedule();
                        if (active != null)
                        {
                            rpaChecker = new RpaChecker(this, appConfig.LogFileDirectory, appConfig.LogFileName, appConfig.WebhookUrl,
                                                        active.SuccessReport, active.ErrorReport, active.ErrorJudgementInterval);
                            Task.Run(() => rpaChecker.Run());
                            await Task.Delay(active.RefreshInterval * 60 * 1000);
                        }
                        else
                        {
                            await Task.Delay(1000);
                        }
                    }
                });
                #pragma warning restore CS4014
            }
            else
            {
                this.isRunning           = false;
                buttonRun.Text           = "実行";
                buttonSaveConfig.Enabled = true;
                rpaChecker?.ResetAll();
            }
        }
Beispiel #2
0
        private void ApplyIntervalList()
        {
            appConfig.LogFileDirectory = textBoxLogDir.Text;
            appConfig.LogFileName      = textBoxLogFile.Text;
            appConfig.WebhookUrl       = textBoxWebhook.Text;
            List <AppConfig.TimeSchedule> tsList = new List <AppConfig.TimeSchedule>();

            foreach (ListViewItem item in listViewIntervalList.Items)
            {
                AppConfig.TimeSchedule ts = new AppConfig.TimeSchedule();
                ts.StartTime              = TimeSpan.Parse(item.SubItems[0].Text);
                ts.EndTime                = TimeSpan.Parse(item.SubItems[1].Text);
                ts.RefreshInterval        = int.Parse(item.SubItems[2].Text);
                ts.ErrorJudgementInterval = int.Parse(item.SubItems[3].Text);
                ts.SuccessReport          = item.SubItems[4].Text.Equals("○");
                ts.ErrorReport            = item.SubItems[5].Text.Equals("○");
                tsList.Add(ts);
            }
            appConfig.Schedules = tsList.ToArray();
        }