HamBook – Diff between revs 10 and 12

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 10 Rev 12
Line 5... Line 5...
5 using System.Collections.Generic; 5 using System.Collections.Generic;
6 using System.ComponentModel; 6 using System.ComponentModel;
7 using System.Data; 7 using System.Data;
8 using System.Diagnostics; 8 using System.Diagnostics;
9 using System.Drawing; 9 using System.Drawing;
-   10 using System.IO;
10 using System.IO.Ports; 11 using System.IO.Ports;
11 using System.Linq; 12 using System.Linq;
-   13 using System.Reflection;
12 using System.Text; 14 using System.Text;
13 using System.Threading; 15 using System.Threading;
14 using System.Threading.Tasks; 16 using System.Threading.Tasks;
15 using System.Windows.Forms; 17 using System.Windows.Forms;
Line 58... Line 60...
58 comboBox8.DataBindings.Add(nameof(comboBox8.Text), _configuration, nameof(_configuration.Handshake), true, DataSourceUpdateMode.OnPropertyChanged, string.Empty); 60 comboBox8.DataBindings.Add(nameof(comboBox8.Text), _configuration, nameof(_configuration.Handshake), true, DataSourceUpdateMode.OnPropertyChanged, string.Empty);
Line 59... Line 61...
59   61  
60 var bandBindingSource = new BindingSource(); 62 var bandBindingSource = new BindingSource();
61 bandBindingSource.DataSource = _configuration.Definitions.Bands; 63 bandBindingSource.DataSource = _configuration.Definitions.Bands;
62 comboBox6.DataSource = bandBindingSource; 64 comboBox6.DataSource = bandBindingSource;
Line 63... Line 65...
63 comboBox6.DisplayMember = nameof(Band.Meters); 65 comboBox6.DisplayMember = "Meters";
64   66  
Line 65... Line 67...
65 textBox1.DataBindings.Add(nameof(textBox1.Text), bandBindingSource, nameof(Band.Min), true, DataSourceUpdateMode.OnPropertyChanged, string.Empty); 67 textBox1.DataBindings.Add(nameof(textBox1.Text), bandBindingSource, nameof(Band.Min), true, DataSourceUpdateMode.OnPropertyChanged, string.Empty);
Line 83... Line 85...
83 foreach (var deviceNumber in Enumerable.Range(0, WaveOut.DeviceCount)) 85 foreach (var deviceNumber in Enumerable.Range(0, WaveOut.DeviceCount))
84 { 86 {
85 var capabilities = WaveOut.GetCapabilities(deviceNumber); 87 var capabilities = WaveOut.GetCapabilities(deviceNumber);
86 comboBox10.Items.Add(capabilities.ProductName); 88 comboBox10.Items.Add(capabilities.ProductName);
87 } 89 }
-   90
-   91 foreach(var notificationState in _configuration.Notifications.State)
-   92 {
-   93 var index = dataGridView1.Rows.Add();
-   94  
-   95 var nameTextBox = (DataGridViewTextBoxCell)dataGridView1.Rows[index].Cells["NameColumn"];
-   96 nameTextBox.Value = notificationState.Type.GetType().GetCustomAttribute<DescriptionAttribute>().Description;
-   97  
-   98 var enableCheckBox = (DataGridViewCheckBoxCell)dataGridView1.Rows[index].Cells["EnableColumn"];
-   99 enableCheckBox.Value= notificationState.Enabled;
-   100  
-   101 var lingerTextBox = (DataGridViewTextBoxCell)dataGridView1.Rows[index].Cells["LingerColumn"];
-   102 lingerTextBox.Value = notificationState.LingerTime;
-   103 }
88 } 104 }
Line 89... Line 105...
89   105  
90 private void button1_Click(object sender, EventArgs e) 106 private void button1_Click(object sender, EventArgs e)
91 { 107 {
Line 120... Line 136...
120 } 136 }
Line 121... Line 137...
121   137  
122 var band = (Band)comboBox6.SelectedValue; 138 var band = (Band)comboBox6.SelectedValue;
123 band.Max = frequency; 139 band.Max = frequency;
-   140 }
-   141  
-   142 private void DataGridView1_CurrentCellDirtyStateChanged(object sender, EventArgs e)
-   143 {
-   144 var dataGridView = (DataGridView)sender;
-   145  
-   146 if (dataGridView.CurrentCell is DataGridViewCheckBoxCell)
-   147 {
-   148 dataGridView.CommitEdit(DataGridViewDataErrorContexts.Commit);
-   149 }
-   150 }
-   151  
-   152 private void DataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
-   153 {
-   154 var dataGridView = (DataGridView)sender;
-   155  
-   156 dataGridView.CommitEdit(DataGridViewDataErrorContexts.Commit);
-   157 }
-   158  
-   159 private void DataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
-   160 {
-   161 var dataGridView = (DataGridView)sender;
-   162  
-   163 if (dataGridView.CurrentCell is DataGridViewCheckBoxCell)
-   164 {
-   165 if (dataGridView.CurrentCell.IsInEditMode)
-   166 {
-   167 if (dataGridView.IsCurrentCellDirty)
-   168 {
-   169 dataGridView.EndEdit();
-   170 }
-   171 }
-   172 }
-   173 }
-   174  
-   175 private void DataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
-   176 {
-   177 var dataGridView = (DataGridView)sender;
-   178  
-   179 if (e.RowIndex == -1 || e.ColumnIndex == -1)
-   180 {
-   181 return;
-   182 }
-   183  
-   184 switch (dataGridView.Columns[e.ColumnIndex].Name)
-   185 {
-   186 case "EnableColumn":
-   187 ProcessEnable(dataGridView.Rows[e.RowIndex]);
-   188 break;
-   189 }
-   190 }
-   191  
-   192 private void ProcessEnable(DataGridViewRow dataGridViewRow)
-   193 {
-   194 var enableCheckBoxCell =
-   195 (DataGridViewCheckBoxCell)dataGridViewRow.Cells["EnableColumn"];
-   196  
-   197 var dataGridViewNameCell = (DataGridViewTextBoxCell)dataGridViewRow.Cells["NameColumn"];
-   198  
-   199 var name = dataGridViewNameCell.Value;
-   200  
-   201 foreach(var notificationState in _configuration.Notifications.State)
-   202 {
-   203 switch (notificationState.Type)
-   204 {
-   205 case NotificationType.SignalScanDetect:
-   206 notificationState.Enabled = (bool)enableCheckBoxCell.Value;
-   207 break;
-   208 }
-   209 }
-   210 }
-   211  
-   212 private void DataGridView1_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
-   213 {
-   214 var dataGridView = (DataGridView)sender;
-   215  
-   216 if (e.RowIndex == -1 || e.ColumnIndex == -1 ||
-   217 !(dataGridView.Columns[e.ColumnIndex] is DataGridViewCheckBoxColumn))
-   218 {
-   219 return;
-   220 }
-   221  
-   222 dataGridView.EndEdit();
-   223 }
-   224  
-   225 private void DataGridView_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
-   226 {
-   227 var dataGridView = (DataGridView)sender;
-   228  
-   229 if (e.RowIndex == -1 || e.ColumnIndex == -1 ||
-   230 !(dataGridView.Columns[e.ColumnIndex] is DataGridViewCheckBoxColumn))
-   231 {
-   232 return;
-   233 }
-   234  
-   235 dataGridView.EndEdit();
-   236 }
-   237  
-   238 private void DataGridView1_DataError(object sender, DataGridViewDataErrorEventArgs e)
-   239 {
-   240 // Do not allow errors.
-   241 }
124 } 242  
125 } 243 }