patrick.xu
2021-05-24 3c583b1091133e4af23c2534ae96bd094c132d58
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
 
namespace M423project
{
    public partial class FormGetRunMode : Form
    {
        SystemRunMode rm = new SystemRunMode();
        public SystemRunMode RunMode { get { return rm; } }
        public bool _repeat;
 
        public FormGetRunMode(SystemRunMode _rm,bool repeat)
        {
            InitializeComponent();
            rm = _rm;
            _repeat = repeat;
        }
 
        private void FormGetRunMode_Load(object sender, EventArgs e)
        {
            if (_repeat)
            {
                rbRepeat.Checked = true;
                return;
            }
            rbTest.Checked = rm.runMode == true;
            tbRunTimes.Enabled = rbTest.Checked;
            tbRunTimes.Text = rm.runTimes.ToString();
        }
 
        private void button1_Click(object sender, EventArgs e)
        {
            rm.runMode = rbTest.Checked;
            ushort v;
            if (ushort.TryParse(tbRunTimes.Text, out v))
                rm.runTimes = v;
            rm.Repeat = rbRepeat.Checked;
            this.DialogResult = System.Windows.Forms.DialogResult.OK;
        }
 
        private void rbNormal_CheckedChanged(object sender, EventArgs e)
        {
            tbRunTimes.Enabled = rbTest.Checked;
 
        }
 
        private void rbTest_CheckedChanged(object sender, EventArgs e)
        {
            tbRunTimes.Enabled = rbTest.Checked;
        }
    }
}