HamBook – Diff between revs 1 and 5
?pathlinks?
Rev 1 | Rev 5 | |||
---|---|---|---|---|
Line 41... | Line 41... | |||
41 | |
41 | |
|
42 | comboBox1.Text = ports[0]; |
42 | comboBox1.Text = ports[0]; |
|
Line 43... | Line 43... | |||
43 | } |
43 | } |
|
44 | |
44 | |
|
45 | // Create data bindings. |
45 | // Create data bindings. |
|
46 | comboBox1.DataBindings.Add(nameof(comboBox1.Text), _configuration, nameof(_configuration.Port), true, DataSourceUpdateMode.OnPropertyChanged); |
46 | comboBox1.DataBindings.Add(nameof(comboBox1.Text), _configuration, nameof(_configuration.Port), true, DataSourceUpdateMode.OnPropertyChanged, string.Empty); |
|
47 | comboBox2.DataBindings.Add(nameof(comboBox2.Text), _configuration, nameof(_configuration.Speed), true, DataSourceUpdateMode.OnPropertyChanged); |
47 | comboBox2.DataBindings.Add(nameof(comboBox2.Text), _configuration, nameof(_configuration.Speed), true, DataSourceUpdateMode.OnPropertyChanged, string.Empty); |
|
48 | comboBox3.DataBindings.Add(nameof(comboBox3.Text), _configuration, nameof(_configuration.DataBits), true, DataSourceUpdateMode.OnPropertyChanged); |
48 | comboBox3.DataBindings.Add(nameof(comboBox3.Text), _configuration, nameof(_configuration.DataBits), true, DataSourceUpdateMode.OnPropertyChanged, string.Empty); |
|
Line 49... | Line 49... | |||
49 | comboBox4.DataBindings.Add(nameof(comboBox4.Text), _configuration, nameof(_configuration.Parity), true, DataSourceUpdateMode.OnPropertyChanged); |
49 | comboBox4.DataBindings.Add(nameof(comboBox4.Text), _configuration, nameof(_configuration.Parity), true, DataSourceUpdateMode.OnPropertyChanged, string.Empty); |
|
- | 50 | comboBox5.DataBindings.Add(nameof(comboBox5.Text), _configuration, nameof(_configuration.StopBits), true, DataSourceUpdateMode.OnPropertyChanged, string.Empty); |
||
- | 51 | |
||
- | 52 | comboBox7.DataBindings.Add(nameof(comboBox7.Text), _configuration, nameof(_configuration.Radio), true, DataSourceUpdateMode.OnPropertyChanged, string.Empty); |
||
- | 53 | |
||
- | 54 | var bandBindingSource = new BindingSource(); |
||
- | 55 | bandBindingSource.DataSource = _configuration.Definitions.Bands; |
||
- | 56 | comboBox6.DataSource = bandBindingSource; |
||
- | 57 | comboBox6.DisplayMember = nameof(Band.Meters); |
||
50 | comboBox5.DataBindings.Add(nameof(comboBox5.Text), _configuration, nameof(_configuration.StopBits), true, DataSourceUpdateMode.OnPropertyChanged); |
58 | |
|
Line 51... | Line 59... | |||
51 | |
59 | textBox1.DataBindings.Add(nameof(textBox1.Text), bandBindingSource, nameof(Band.Min), true, DataSourceUpdateMode.OnPropertyChanged, string.Empty); |
|
52 | comboBox7.DataBindings.Add(nameof(comboBox7.Text), _configuration, nameof(_configuration.Radio), true, DataSourceUpdateMode.OnPropertyChanged); |
60 | textBox2.DataBindings.Add(nameof(textBox1.Text), bandBindingSource, nameof(Band.Max), true, DataSourceUpdateMode.OnPropertyChanged, string.Empty); |
|
53 | } |
61 | } |
|
Line 61... | Line 69... | |||
61 | private void button2_Click(object sender, EventArgs e) |
69 | private void button2_Click(object sender, EventArgs e) |
|
62 | { |
70 | { |
|
63 | SaveOnClose = false; |
71 | SaveOnClose = false; |
|
64 | Close(); |
72 | Close(); |
|
65 | } |
73 | } |
|
- | 74 | |
||
- | 75 | private void textBox1_TextChanged(object sender, EventArgs e) |
||
- | 76 | { |
||
- | 77 | var textBox = (TextBox)sender; |
||
- | 78 | if(string.IsNullOrEmpty(textBox.Text) || !int.TryParse(textBox.Text, out var frequency)) |
||
- | 79 | { |
||
- | 80 | return; |
||
- | 81 | } |
||
- | 82 | |
||
- | 83 | var band = (Band)comboBox6.SelectedValue; |
||
- | 84 | band.Min = frequency; |
||
- | 85 | } |
||
- | 86 | |
||
- | 87 | private void textBox2_TextChanged(object sender, EventArgs e) |
||
- | 88 | { |
||
- | 89 | var textBox = (TextBox)sender; |
||
- | 90 | if (string.IsNullOrEmpty(textBox.Text) || !int.TryParse(textBox.Text, out var frequency)) |
||
- | 91 | { |
||
- | 92 | return; |
||
- | 93 | } |
||
- | 94 | |
||
- | 95 | var band = (Band)comboBox6.SelectedValue; |
||
- | 96 | band.Max = frequency; |
||
- | 97 | } |
||
66 | } |
98 | } |
|
67 | } |
99 | } |