HamBook – Diff between revs 46 and 47
?pathlinks?
Rev 46 | Rev 47 | |||
---|---|---|---|---|
Line 14... | Line 14... | |||
14 | using System.Diagnostics; |
14 | using System.Diagnostics; |
|
15 | using System.Drawing; |
15 | using System.Drawing; |
|
16 | using System.IO; |
16 | using System.IO; |
|
17 | using System.Linq; |
17 | using System.Linq; |
|
18 | using System.Reflection; |
18 | using System.Reflection; |
|
- | 19 | using System.Runtime.CompilerServices; |
||
19 | using System.Text; |
20 | using System.Text; |
|
20 | using System.Text.RegularExpressions; |
21 | using System.Text.RegularExpressions; |
|
21 | using System.Threading; |
22 | using System.Threading; |
|
22 | using System.Threading.Tasks; |
23 | using System.Threading.Tasks; |
|
23 | using System.Windows.Forms; |
24 | using System.Windows.Forms; |
|
Line 86... | Line 87... | |||
86 | try |
87 | try |
|
87 | { |
88 | { |
|
88 | switch (rowProgress) |
89 | switch (rowProgress) |
|
89 | { |
90 | { |
|
90 | case DataGridViewRowProgressSuccess<MemoryChannel> rowProgressSuccess: |
91 | case DataGridViewRowProgressSuccess<MemoryChannel> rowProgressSuccess: |
|
91 | var result = (Radios.Yaesu.FT_891.MemoryChannel)rowProgressSuccess.Data; |
- | ||
Line 92... | Line -... | |||
92 | |
- | ||
93 | rowProgress.Row.Cells["FrequencyColumn"].Value = result.Frequency; |
- | ||
94 | rowProgress.Row.Cells["ClarifierDirectionColumn"].Value = (char)result.ClarifierDirection; |
- | ||
95 | rowProgress.Row.Cells["ClarifierOffsetColumn"].Value = result.ClarifierOffset; |
92 | |
|
96 | rowProgress.Row.Cells["ClarColumn"].Value = result.Clar; |
- | ||
97 | rowProgress.Row.Cells["ModeColumn"].Value = result.MemoryRadioMode.Name; |
- | ||
98 | rowProgress.Row.Cells["CtcssColumn"].Value = (string)result.Ctcss; |
- | ||
99 | rowProgress.Row.Cells["PhaseColumn"].Value = (string)result.Phase; |
93 | switch(Configuration.Radio) |
|
100 | rowProgress.Row.Cells["TagColumn"].Value = result.Tag; |
94 | { |
|
101 | rowProgress.Row.Cells["TextColumn"].Value = result.Text; |
95 | case "Yaesu FT-891": |
|
Line -... | Line 96... | |||
- | 96 | var result = (Radios.Yaesu.FT_891.MemoryChannel)rowProgressSuccess.Data; |
||
- | 97 | |
||
- | 98 | rowProgress.Row.Cells["FrequencyColumn"].Value = result.Frequency; |
||
- | 99 | rowProgress.Row.Cells["ClarifierDirectionColumn"].Value = (char)result.ClarifierDirection; |
||
- | 100 | rowProgress.Row.Cells["ClarifierOffsetColumn"].Value = result.ClarifierOffset; |
||
- | 101 | rowProgress.Row.Cells["ClarColumn"].Value = result.Clar; |
||
- | 102 | rowProgress.Row.Cells["ModeColumn"].Value = result.MemoryRadioMode.Name; |
||
- | 103 | rowProgress.Row.Cells["CtcssColumn"].Value = (string)result.Ctcss; |
||
- | 104 | rowProgress.Row.Cells["PhaseColumn"].Value = (string)result.Phase; |
||
- | 105 | rowProgress.Row.Cells["TagColumn"].Value = result.Tag; |
||
- | 106 | rowProgress.Row.Cells["TextColumn"].Value = result.Text; |
||
- | 107 | rowProgress.Row.Tag = rowProgressSuccess.Data; |
||
Line 102... | Line 108... | |||
102 | rowProgress.Row.Tag = rowProgressSuccess.Data; |
108 | break; |
|
103 | |
109 | } |
|
104 | |
110 | |
|
105 | toolStripStatusLabel1.Text = $"{Resources.Read_memory_bank} {rowProgress.Index + 1}"; |
111 | toolStripStatusLabel1.Text = $"{Resources.Read_memory_bank} {rowProgress.Index + 1}"; |
|
Line 184... | Line 190... | |||
184 | } |
190 | } |
|
185 | } |
191 | } |
|
Line 186... | Line 192... | |||
186 | |
192 | |
|
187 | private void MemoryOrganizerForm_Load(object sender, EventArgs e) |
193 | private void MemoryOrganizerForm_Load(object sender, EventArgs e) |
|
- | 194 | { |
||
- | 195 | // Generate columns based on radio type. |
||
- | 196 | switch(Configuration.Radio) |
||
- | 197 | { |
||
- | 198 | case "Yaesu FT-891": |
||
- | 199 | dataGridView1.Columns.Add(new DataGridViewTextBoxColumn() { Name = "LocationColumn", HeaderText = "Location" }); |
||
- | 200 | dataGridView1.Columns.Add(new DataGridViewTextBoxColumn() { Name = "FrequencyColumn", HeaderText = "Frequency" }); |
||
- | 201 | var clarifierDropDownColumn = new DataGridViewComboBoxColumn() { Name = "ClarifierDirectionColumn", HeaderText = "Clarifier" }; |
||
- | 202 | clarifierDropDownColumn.Items.AddRange( |
||
- | 203 | "+", |
||
- | 204 | "-" |
||
- | 205 | ); |
||
- | 206 | dataGridView1.Columns.Add(clarifierDropDownColumn); |
||
- | 207 | dataGridView1.Columns.Add(new DataGridViewTextBoxColumn() { Name = "ClarifierOffsetColumn", HeaderText = "Offset" }); |
||
- | 208 | dataGridView1.Columns.Add(new DataGridViewCheckBoxColumn() { Name = "ClarColumn", HeaderText = "Clar" }); |
||
- | 209 | var modeComboBoxColumn = new DataGridViewComboBoxColumn() { Name = "ModeColumn", HeaderText = "Mode" }; |
||
- | 210 | modeComboBoxColumn.Items.AddRange( |
||
- | 211 | "SSB_1", |
||
- | 212 | "SSB_2", |
||
- | 213 | "CW_1", |
||
- | 214 | "FM", |
||
- | 215 | "AM", |
||
- | 216 | "RTTY_1", |
||
- | 217 | "CW_2", |
||
- | 218 | "DATA_1", |
||
- | 219 | "RTTY_2", |
||
- | 220 | "FM-N", |
||
- | 221 | "DATA_2", |
||
- | 222 | "AM-N" |
||
- | 223 | ); |
||
- | 224 | dataGridView1.Columns.Add(modeComboBoxColumn); |
||
- | 225 | var ctcssComboBoxColumn = new DataGridViewComboBoxColumn() { Name = "CtcssColumn", HeaderText = "CTCSS" }; |
||
- | 226 | ctcssComboBoxColumn.Items.AddRange( |
||
- | 227 | "Off", |
||
- | 228 | "Enc/Dec", |
||
- | 229 | "Enc" |
||
- | 230 | ); |
||
- | 231 | dataGridView1.Columns.Add(ctcssComboBoxColumn); |
||
- | 232 | var phaseComboBoxColumn = new DataGridViewComboBoxColumn() { Name = "PhaseColumn", HeaderText = "Phase" }; |
||
- | 233 | phaseComboBoxColumn.Items.AddRange( |
||
- | 234 | "Simplex", |
||
- | 235 | "Plus Shift", |
||
- | 236 | "Minus Shift" |
||
- | 237 | ); |
||
- | 238 | dataGridView1.Columns.Add(phaseComboBoxColumn); |
||
- | 239 | dataGridView1.Columns.Add(new DataGridViewCheckBoxColumn() { Name = "TagColumn", HeaderText = "Tag" }); |
||
- | 240 | dataGridView1.Columns.Add(new DataGridViewTextBoxColumn() { Name = "TextColumn", HeaderText = "Text" }); |
||
- | 241 | break; |
||
- | 242 | } |
||
188 | { |
243 | |
|
189 | toolStripProgressBar1.Minimum = 0; |
244 | toolStripProgressBar1.Minimum = 0; |
|
Line 190... | Line 245... | |||
190 | toolStripProgressBar1.Maximum = 98; |
245 | toolStripProgressBar1.Maximum = 98; |
|
191 | |
246 | |
|
Line 208... | Line 263... | |||
208 | return; |
263 | return; |
|
209 | } |
264 | } |
|
Line 210... | Line 265... | |||
210 | |
265 | |
|
Line -... | Line 266... | |||
- | 266 | var index = dataGridView1.Rows.Add(); |
||
- | 267 | |
||
- | 268 | switch(Configuration.Radio) |
||
211 | var index = dataGridView1.Rows.Add(); |
269 | { |
|
212 | |
270 | case "Yaesu FT-891": |
|
213 | dataGridView1.Rows[index].Cells["LocationColumn"].Value = memoryBank; |
271 | dataGridView1.Rows[index].Cells["LocationColumn"].Value = memoryBank; |
|
214 | dataGridView1.Rows[index].Cells["FrequencyColumn"].Value = default; |
272 | dataGridView1.Rows[index].Cells["FrequencyColumn"].Value = default; |
|
215 | dataGridView1.Rows[index].Cells["ClarifierDirectionColumn"].Value = default; |
273 | dataGridView1.Rows[index].Cells["ClarifierDirectionColumn"].Value = default; |
|
216 | dataGridView1.Rows[index].Cells["ClarifierOffsetColumn"].Value = default; |
274 | dataGridView1.Rows[index].Cells["ClarifierOffsetColumn"].Value = default; |
|
217 | dataGridView1.Rows[index].Cells["ClarColumn"].Value = default; |
275 | dataGridView1.Rows[index].Cells["ClarColumn"].Value = default; |
|
218 | dataGridView1.Rows[index].Cells["ModeColumn"].Value = default; |
276 | dataGridView1.Rows[index].Cells["ModeColumn"].Value = default; |
|
219 | dataGridView1.Rows[index].Cells["CtcssColumn"].Value = default; |
277 | dataGridView1.Rows[index].Cells["CtcssColumn"].Value = default; |
|
220 | dataGridView1.Rows[index].Cells["PhaseColumn"].Value = default; |
278 | dataGridView1.Rows[index].Cells["PhaseColumn"].Value = default; |
|
221 | dataGridView1.Rows[index].Cells["TagColumn"].Value = default; |
- | ||
222 | dataGridView1.Rows[index].Cells["TextColumn"].Value = default; |
279 | dataGridView1.Rows[index].Cells["TagColumn"].Value = default; |
|
- | 280 | dataGridView1.Rows[index].Cells["TextColumn"].Value = default; |
||
Line -... | Line 281... | |||
- | 281 | break; |
||
223 | |
282 | } |
|
224 | toolStripStatusLabel1.Text = $"{Resources.Read_memory_bank} {memoryBank}"; |
- | ||
225 | |
283 | |
|
226 | toolStripProgressBar1.Increment(1); |
284 | toolStripStatusLabel1.Text = $"{Resources.Created_memory_bank} {memoryBank}"; |
|
227 | |
285 | toolStripProgressBar1.Increment(1); |
|
228 | statusStrip1.Update(); |
286 | statusStrip1.Update(); |
|
229 | } |
287 | } |
|
Line 370... | Line 428... | |||
370 | |
428 | |
|
371 | for (var i = 0; i < count && !cancellationToken.IsCancellationRequested; ++i) |
429 | for (var i = 0; i < count && !cancellationToken.IsCancellationRequested; ++i) |
|
372 | { |
430 | { |
|
373 | try |
431 | try |
|
- | 432 | { |
||
- | 433 | var success = false; |
||
- | 434 | |
||
- | 435 | switch(Configuration.Radio) |
||
- | 436 | { |
||
374 | { |
437 | case "Yaesu FT-891": |
|
Line 375... | Line 438... | |||
375 | var memoryChannel = (Radios.Yaesu.FT_891.MemoryChannel)MemoryChannel.Create(Configuration.Radio); |
438 | var memoryChannel = (Radios.Yaesu.FT_891.MemoryChannel)MemoryChannel.Create(Configuration.Radio); |
|
376 | |
439 | |
|
377 | memoryChannel.CurrentLocation = $"{rows[i].Cells["LocationColumn"].Value}"; |
440 | memoryChannel.CurrentLocation = $"{rows[i].Cells["LocationColumn"].Value}"; |
|
378 | memoryChannel.Frequency = int.Parse($"{rows[i].Cells["FrequencyColumn"].Value}"); |
441 | memoryChannel.Frequency = int.Parse($"{rows[i].Cells["FrequencyColumn"].Value}"); |
|
379 | memoryChannel.ClarifierDirection = char.Parse($"{rows[i].Cells["ClarifierDirectionColumn"].Value}"); |
442 | memoryChannel.ClarifierDirection = char.Parse($"{rows[i].Cells["ClarifierDirectionColumn"].Value}"); |
|
380 | memoryChannel.ClarifierOffset = int.Parse($"{rows[i].Cells["ClarifierOffsetColumn"].Value}"); |
443 | memoryChannel.ClarifierOffset = int.Parse($"{rows[i].Cells["ClarifierOffsetColumn"].Value}"); |
|
381 | memoryChannel.Clar = Convert.ToBoolean(rows[i].Cells["ClarColumn"].Value); |
444 | memoryChannel.Clar = Convert.ToBoolean(rows[i].Cells["ClarColumn"].Value); |
|
382 | memoryChannel.MemoryRadioMode = Radios.Generic.MemoryRadioMode.Create(Configuration.Radio, $"{rows[i].Cells["ModeColumn"].Value}"); |
445 | memoryChannel.MemoryRadioMode = Radios.Generic.MemoryRadioMode.Create(Configuration.Radio, $"{rows[i].Cells["ModeColumn"].Value}"); |
|
383 | memoryChannel.Ctcss = new Ctcss($"{rows[i].Cells["CtcssColumn"].Value}"); |
446 | memoryChannel.Ctcss = new Ctcss($"{rows[i].Cells["CtcssColumn"].Value}"); |
|
384 | memoryChannel.Phase = new Phase($"{rows[i].Cells["PhaseColumn"].Value}"); |
447 | memoryChannel.Phase = new Phase($"{rows[i].Cells["PhaseColumn"].Value}"); |
|
Line 385... | Line 448... | |||
385 | memoryChannel.Tag = Convert.ToBoolean(rows[i].Cells["TagColumn"].Value); |
448 | memoryChannel.Tag = Convert.ToBoolean(rows[i].Cells["TagColumn"].Value); |
|
- | 449 | memoryChannel.Text = $"{rows[i].Cells["TextColumn"].Value,-12}"; |
||
- | 450 | |
||
Line 386... | Line 451... | |||
386 | memoryChannel.Text = $"{rows[i].Cells["TextColumn"].Value, -12}"; |
451 | success = await _catAssemblies.CatSetAsync<MemoryChannel, bool>("MT", new object[] { memoryChannel }, _cancellationToken); |
|
387 | |
452 | break; |
|
388 | var result = await _catAssemblies.CatSetAsync<MemoryChannel, bool>("MT", new object[] { memoryChannel }, _cancellationToken); |
453 | } |
|
389 | |
454 | |
|
390 | progress.Report(new DataGridViewRowProgressSuccess<bool>(rows[i], i, result)); |
455 | progress.Report(new DataGridViewRowProgressSuccess<bool>(rows[i], i, success)); |
|
391 | } |
456 | } |
|
Line 488... | Line 553... | |||
488 | toolStripStatusLabel1.Text = "Done."; |
553 | toolStripStatusLabel1.Text = "Done."; |
|
Line 489... | Line 554... | |||
489 | |
554 | |
|
490 | return; |
555 | return; |
|
Line -... | Line 556... | |||
- | 556 | } |
||
- | 557 | |
||
- | 558 | switch(Configuration.Radio) |
||
491 | } |
559 | { |
|
492 | |
560 | case "Yaesu FT-891": |
|
493 | dataGridView1.Rows[memoryBank.Index].Cells["FrequencyColumn"].Value = memoryBank.MemoryChannel.Frequency; |
561 | dataGridView1.Rows[memoryBank.Index].Cells["FrequencyColumn"].Value = memoryBank.MemoryChannel.Frequency; |
|
494 | dataGridView1.Rows[memoryBank.Index].Cells["ClarifierDirectionColumn"].Value = (char)memoryBank.MemoryChannel.ClarifierDirection; |
562 | dataGridView1.Rows[memoryBank.Index].Cells["ClarifierDirectionColumn"].Value = (char)memoryBank.MemoryChannel.ClarifierDirection; |
|
495 | dataGridView1.Rows[memoryBank.Index].Cells["ClarifierOffsetColumn"].Value = memoryBank.MemoryChannel.ClarifierOffset; |
563 | dataGridView1.Rows[memoryBank.Index].Cells["ClarifierOffsetColumn"].Value = memoryBank.MemoryChannel.ClarifierOffset; |
|
496 | dataGridView1.Rows[memoryBank.Index].Cells["ClarColumn"].Value = memoryBank.MemoryChannel.Clar; |
564 | dataGridView1.Rows[memoryBank.Index].Cells["ClarColumn"].Value = memoryBank.MemoryChannel.Clar; |
|
497 | dataGridView1.Rows[memoryBank.Index].Cells["ModeColumn"].Value = memoryBank.MemoryChannel.MemoryRadioMode.Name; |
565 | dataGridView1.Rows[memoryBank.Index].Cells["ModeColumn"].Value = memoryBank.MemoryChannel.MemoryRadioMode.Name; |
|
498 | dataGridView1.Rows[memoryBank.Index].Cells["CtcssColumn"].Value = (string)memoryBank.MemoryChannel.Ctcss; |
566 | dataGridView1.Rows[memoryBank.Index].Cells["CtcssColumn"].Value = (string)memoryBank.MemoryChannel.Ctcss; |
|
499 | dataGridView1.Rows[memoryBank.Index].Cells["PhaseColumn"].Value = (string)memoryBank.MemoryChannel.Phase; |
567 | dataGridView1.Rows[memoryBank.Index].Cells["PhaseColumn"].Value = (string)memoryBank.MemoryChannel.Phase; |
|
500 | dataGridView1.Rows[memoryBank.Index].Cells["TagColumn"].Value = memoryBank.MemoryChannel.Tag; |
568 | dataGridView1.Rows[memoryBank.Index].Cells["TagColumn"].Value = memoryBank.MemoryChannel.Tag; |
|
- | 569 | dataGridView1.Rows[memoryBank.Index].Cells["TextColumn"].Value = memoryBank.MemoryChannel.Text; |
||
- | 570 | dataGridView1.Rows[memoryBank.Index].Tag = memoryBank.MemoryChannel; |
||
Line 501... | Line 571... | |||
501 | dataGridView1.Rows[memoryBank.Index].Cells["TextColumn"].Value = memoryBank.MemoryChannel.Text; |
571 | break; |
|
502 | dataGridView1.Rows[memoryBank.Index].Tag = memoryBank.MemoryChannel; |
- | ||
503 | |
572 | } |
|
504 | toolStripProgressBar1.Increment(1); |
573 | |
|
505 | |
574 | toolStripProgressBar1.Increment(1); |
|
506 | statusStrip1.Update(); |
575 | statusStrip1.Update(); |
|
507 | } |
576 | } |
|
Line 550... | Line 619... | |||
550 | { |
619 | { |
|
551 | try |
620 | try |
|
552 | { |
621 | { |
|
553 | switch (rowProgress) |
622 | switch (rowProgress) |
|
554 | { |
623 | { |
|
555 | case DataGridViewRowProgressSuccess<Radios.Yaesu.FT_891.MemoryChannel> rowProgressSuccess: |
624 | case DataGridViewRowProgressSuccess<MemoryChannel> rowProgressSuccess: |
|
- | 625 | switch(rowProgressSuccess.Data) |
||
- | 626 | { |
||
556 | var result = (Radios.Yaesu.FT_891.MemoryChannel)rowProgressSuccess.Data; |
627 | case Radios.Yaesu.FT_891.MemoryChannel memoryChannel: |
|
557 | |
- | ||
558 | rowProgress.Row.Cells["FrequencyColumn"].Value = result.Frequency; |
628 | rowProgress.Row.Cells["FrequencyColumn"].Value = memoryChannel.Frequency; |
|
559 | rowProgress.Row.Cells["ClarifierDirectionColumn"].Value = (char)result.ClarifierDirection; |
629 | rowProgress.Row.Cells["ClarifierDirectionColumn"].Value = (char)memoryChannel.ClarifierDirection; |
|
560 | rowProgress.Row.Cells["ClarifierOffsetColumn"].Value = result.ClarifierOffset; |
630 | rowProgress.Row.Cells["ClarifierOffsetColumn"].Value = memoryChannel.ClarifierOffset; |
|
561 | rowProgress.Row.Cells["ClarColumn"].Value = result.Clar; |
631 | rowProgress.Row.Cells["ClarColumn"].Value = memoryChannel.Clar; |
|
562 | rowProgress.Row.Cells["ModeColumn"].Value = result.MemoryRadioMode.Name; |
632 | rowProgress.Row.Cells["ModeColumn"].Value = memoryChannel.MemoryRadioMode.Name; |
|
563 | rowProgress.Row.Cells["CtcssColumn"].Value = (string)result.Ctcss; |
633 | rowProgress.Row.Cells["CtcssColumn"].Value = (string)memoryChannel.Ctcss; |
|
564 | rowProgress.Row.Cells["PhaseColumn"].Value = (string)result.Phase; |
634 | rowProgress.Row.Cells["PhaseColumn"].Value = (string)memoryChannel.Phase; |
|
565 | rowProgress.Row.Cells["TagColumn"].Value = result.Tag; |
635 | rowProgress.Row.Cells["TagColumn"].Value = memoryChannel.Tag; |
|
566 | rowProgress.Row.Cells["TextColumn"].Value = result.Text; |
636 | rowProgress.Row.Cells["TextColumn"].Value = memoryChannel.Text; |
|
567 | rowProgress.Row.Tag = rowProgressSuccess.Data; |
637 | rowProgress.Row.Tag = rowProgressSuccess.Data; |
|
568 | |
- | ||
- | 638 | break; |
||
- | 639 | } |
||
Line 569... | Line 640... | |||
569 | |
640 | |
|
570 | toolStripStatusLabel1.Text = $"{Resources.Read_memory_bank} {rowProgress.Index + 1}"; |
641 | toolStripStatusLabel1.Text = $"{Resources.Read_memory_bank} {rowProgress.Index + 1}"; |
|
571 | break; |
642 | break; |
|
572 | case DataGridViewRowProgressFailure rowProgressFailure: |
643 | case DataGridViewRowProgressFailure rowProgressFailure: |