HamBook – Diff between revs 45 and 46
?pathlinks?
Rev 45 | Rev 46 | |||
---|---|---|---|---|
Line 19... | Line 19... | |||
19 | using System.Text; |
19 | using System.Text; |
|
20 | using System.Text.RegularExpressions; |
20 | using System.Text.RegularExpressions; |
|
21 | using System.Threading; |
21 | using System.Threading; |
|
22 | using System.Threading.Tasks; |
22 | using System.Threading.Tasks; |
|
23 | using System.Windows.Forms; |
23 | using System.Windows.Forms; |
|
- | 24 | using MemoryChannel = HamBook.Radios.Generic.MemoryChannel; |
||
Line 24... | Line 25... | |||
24 | |
25 | |
|
25 | namespace HamBook |
26 | namespace HamBook |
|
26 | { |
27 | { |
|
27 | public partial class MemoryOrganizerForm : Form |
28 | public partial class MemoryOrganizerForm : Form |
|
Line 85... | Line 86... | |||
85 | try |
86 | try |
|
86 | { |
87 | { |
|
87 | switch (rowProgress) |
88 | switch (rowProgress) |
|
88 | { |
89 | { |
|
89 | case DataGridViewRowProgressSuccess<MemoryChannel> rowProgressSuccess: |
90 | case DataGridViewRowProgressSuccess<MemoryChannel> rowProgressSuccess: |
|
90 | var result = rowProgressSuccess.Data; |
91 | var result = (Radios.Yaesu.FT_891.MemoryChannel)rowProgressSuccess.Data; |
|
Line 91... | Line 92... | |||
91 | |
92 | |
|
92 | rowProgress.Row.Cells["FrequencyColumn"].Value = result.Frequency; |
93 | rowProgress.Row.Cells["FrequencyColumn"].Value = result.Frequency; |
|
93 | rowProgress.Row.Cells["ClarifierDirectionColumn"].Value = (char)result.ClarifierDirection; |
94 | rowProgress.Row.Cells["ClarifierDirectionColumn"].Value = (char)result.ClarifierDirection; |
|
94 | rowProgress.Row.Cells["ClarifierOffsetColumn"].Value = result.ClarifierOffset; |
95 | rowProgress.Row.Cells["ClarifierOffsetColumn"].Value = result.ClarifierOffset; |
|
95 | rowProgress.Row.Cells["ClarColumn"].Value = result.Clar; |
96 | rowProgress.Row.Cells["ClarColumn"].Value = result.Clar; |
|
96 | rowProgress.Row.Cells["ModeColumn"].Value = result.MemoryRadioMode.Name; |
97 | rowProgress.Row.Cells["ModeColumn"].Value = result.MemoryRadioMode.Name; |
|
97 | rowProgress.Row.Cells["CtcssColumn"].Value = (string)result.CtcssMode; |
98 | rowProgress.Row.Cells["CtcssColumn"].Value = (string)result.Ctcss; |
|
98 | rowProgress.Row.Cells["PhaseColumn"].Value = (string)result.Phase; |
99 | rowProgress.Row.Cells["PhaseColumn"].Value = (string)result.Phase; |
|
99 | rowProgress.Row.Cells["TagColumn"].Value = result.Tag; |
100 | rowProgress.Row.Cells["TagColumn"].Value = result.Tag; |
|
100 | rowProgress.Row.Cells["TextColumn"].Value = result.Text; |
101 | rowProgress.Row.Cells["TextColumn"].Value = result.Text; |
|
Line 369... | Line 370... | |||
369 | |
370 | |
|
370 | for (var i = 0; i < count && !cancellationToken.IsCancellationRequested; ++i) |
371 | for (var i = 0; i < count && !cancellationToken.IsCancellationRequested; ++i) |
|
371 | { |
372 | { |
|
372 | try |
373 | try |
|
373 | { |
- | ||
374 | var location = $"{rows[i].Cells["LocationColumn"].Value}"; |
- | ||
375 | |
- | ||
376 | var frequency = int.Parse($"{rows[i].Cells["FrequencyColumn"].Value}"); |
- | ||
377 | var clarifierDirection = char.Parse($"{rows[i].Cells["ClarifierDirectionColumn"].Value}"); |
- | ||
378 | var clarifierOffset = int.Parse($"{rows[i].Cells["ClarifierOffsetColumn"].Value}"); |
- | ||
379 | var clar = Convert.ToBoolean(rows[i].Cells["ClarColumn"].Value); |
374 | { |
|
380 | var radioMode = Radios.Generic.MemoryRadioMode.Create(Configuration.Radio, $"{rows[i].Cells["ModeColumn"].Value}"); |
- | ||
381 | var ctcssMode = new CtcssMode($"{rows[i].Cells["CtcssColumn"].Value}"); |
- | ||
382 | var phase = new RadioPhase($"{rows[i].Cells["PhaseColumn"].Value}"); |
- | ||
383 | var tag = Convert.ToBoolean(rows[i].Cells["TagColumn"].Value); |
- | ||
Line 384... | Line -... | |||
384 | var text = $"{rows[i].Cells["TextColumn"].Value, -12}"; |
- | ||
385 | |
- | ||
386 | var memoryChannel = new MemoryChannel |
375 | var memoryChannel = (Radios.Yaesu.FT_891.MemoryChannel)MemoryChannel.Create(Configuration.Radio); |
|
387 | { |
376 | |
|
388 | CurrentLocation = location, |
377 | memoryChannel.CurrentLocation = $"{rows[i].Cells["LocationColumn"].Value}"; |
|
389 | Frequency = frequency, |
378 | memoryChannel.Frequency = int.Parse($"{rows[i].Cells["FrequencyColumn"].Value}"); |
|
390 | ClarifierDirection = clarifierDirection, |
379 | memoryChannel.ClarifierDirection = char.Parse($"{rows[i].Cells["ClarifierDirectionColumn"].Value}"); |
|
391 | ClarifierOffset = clarifierOffset, |
380 | memoryChannel.ClarifierOffset = int.Parse($"{rows[i].Cells["ClarifierOffsetColumn"].Value}"); |
|
392 | Clar = clar, |
381 | memoryChannel.Clar = Convert.ToBoolean(rows[i].Cells["ClarColumn"].Value); |
|
393 | MemoryRadioMode = radioMode, |
382 | memoryChannel.MemoryRadioMode = Radios.Generic.MemoryRadioMode.Create(Configuration.Radio, $"{rows[i].Cells["ModeColumn"].Value}"); |
|
394 | CtcssMode = ctcssMode, |
383 | memoryChannel.Ctcss = new Ctcss($"{rows[i].Cells["CtcssColumn"].Value}"); |
|
395 | Phase = phase, |
384 | memoryChannel.Phase = new Phase($"{rows[i].Cells["PhaseColumn"].Value}"); |
|
396 | Tag = tag, |
- | ||
Line 397... | Line 385... | |||
397 | Text = text |
385 | memoryChannel.Tag = Convert.ToBoolean(rows[i].Cells["TagColumn"].Value); |
|
Line 398... | Line 386... | |||
398 | }; |
386 | memoryChannel.Text = $"{rows[i].Cells["TextColumn"].Value, -12}"; |
|
399 | |
387 | |
|
Line 431... | Line 419... | |||
431 | |
419 | |
|
432 | var fileName = saveFileDialog1.FileName; |
420 | var fileName = saveFileDialog1.FileName; |
|
433 | var list = new List<MemoryChannelIndexed>(); |
421 | var list = new List<MemoryChannelIndexed>(); |
|
434 | foreach(var row in dataGridView1.Rows.OfType<DataGridViewRow>().OrderBy(row => row.Index)) |
422 | foreach(var row in dataGridView1.Rows.OfType<DataGridViewRow>().OrderBy(row => row.Index)) |
|
435 | { |
423 | { |
|
436 | if (row.Tag is MemoryChannel memoryChannel) |
424 | if (row.Tag is Radios.Yaesu.FT_891.MemoryChannel memoryChannel) |
|
437 | { |
425 | { |
|
438 | var memoryChannelOrganizerBanks = new MemoryChannelIndexed(row.Index, memoryChannel); |
426 | var memoryChannelOrganizerBanks = new MemoryChannelIndexed(row.Index, memoryChannel); |
|
439 | list.Add(memoryChannelOrganizerBanks); |
427 | list.Add(memoryChannelOrganizerBanks); |
|
440 | } |
428 | } |
|
Line 505... | Line 493... | |||
505 | dataGridView1.Rows[memoryBank.Index].Cells["FrequencyColumn"].Value = memoryBank.MemoryChannel.Frequency; |
493 | dataGridView1.Rows[memoryBank.Index].Cells["FrequencyColumn"].Value = memoryBank.MemoryChannel.Frequency; |
|
506 | dataGridView1.Rows[memoryBank.Index].Cells["ClarifierDirectionColumn"].Value = (char)memoryBank.MemoryChannel.ClarifierDirection; |
494 | dataGridView1.Rows[memoryBank.Index].Cells["ClarifierDirectionColumn"].Value = (char)memoryBank.MemoryChannel.ClarifierDirection; |
|
507 | dataGridView1.Rows[memoryBank.Index].Cells["ClarifierOffsetColumn"].Value = memoryBank.MemoryChannel.ClarifierOffset; |
495 | dataGridView1.Rows[memoryBank.Index].Cells["ClarifierOffsetColumn"].Value = memoryBank.MemoryChannel.ClarifierOffset; |
|
508 | dataGridView1.Rows[memoryBank.Index].Cells["ClarColumn"].Value = memoryBank.MemoryChannel.Clar; |
496 | dataGridView1.Rows[memoryBank.Index].Cells["ClarColumn"].Value = memoryBank.MemoryChannel.Clar; |
|
509 | dataGridView1.Rows[memoryBank.Index].Cells["ModeColumn"].Value = memoryBank.MemoryChannel.MemoryRadioMode.Name; |
497 | dataGridView1.Rows[memoryBank.Index].Cells["ModeColumn"].Value = memoryBank.MemoryChannel.MemoryRadioMode.Name; |
|
510 | dataGridView1.Rows[memoryBank.Index].Cells["CtcssColumn"].Value = (string)memoryBank.MemoryChannel.CtcssMode; |
498 | dataGridView1.Rows[memoryBank.Index].Cells["CtcssColumn"].Value = (string)memoryBank.MemoryChannel.Ctcss; |
|
511 | dataGridView1.Rows[memoryBank.Index].Cells["PhaseColumn"].Value = (string)memoryBank.MemoryChannel.Phase; |
499 | dataGridView1.Rows[memoryBank.Index].Cells["PhaseColumn"].Value = (string)memoryBank.MemoryChannel.Phase; |
|
512 | dataGridView1.Rows[memoryBank.Index].Cells["TagColumn"].Value = memoryBank.MemoryChannel.Tag; |
500 | dataGridView1.Rows[memoryBank.Index].Cells["TagColumn"].Value = memoryBank.MemoryChannel.Tag; |
|
513 | dataGridView1.Rows[memoryBank.Index].Cells["TextColumn"].Value = memoryBank.MemoryChannel.Text; |
501 | dataGridView1.Rows[memoryBank.Index].Cells["TextColumn"].Value = memoryBank.MemoryChannel.Text; |
|
- | 502 | dataGridView1.Rows[memoryBank.Index].Tag = memoryBank.MemoryChannel; |
||
Line 514... | Line 503... | |||
514 | |
503 | |
|
Line 515... | Line 504... | |||
515 | toolStripProgressBar1.Increment(1); |
504 | toolStripProgressBar1.Increment(1); |
|
516 | |
505 | |
|
Line 561... | Line 550... | |||
561 | { |
550 | { |
|
562 | try |
551 | try |
|
563 | { |
552 | { |
|
564 | switch (rowProgress) |
553 | switch (rowProgress) |
|
565 | { |
554 | { |
|
566 | case DataGridViewRowProgressSuccess<MemoryChannel> rowProgressSuccess: |
555 | case DataGridViewRowProgressSuccess<Radios.Yaesu.FT_891.MemoryChannel> rowProgressSuccess: |
|
567 | var result = rowProgressSuccess.Data; |
556 | var result = (Radios.Yaesu.FT_891.MemoryChannel)rowProgressSuccess.Data; |
|
Line 568... | Line 557... | |||
568 | |
557 | |
|
569 | rowProgress.Row.Cells["FrequencyColumn"].Value = result.Frequency; |
558 | rowProgress.Row.Cells["FrequencyColumn"].Value = result.Frequency; |
|
570 | rowProgress.Row.Cells["ClarifierDirectionColumn"].Value = (char)result.ClarifierDirection; |
559 | rowProgress.Row.Cells["ClarifierDirectionColumn"].Value = (char)result.ClarifierDirection; |
|
571 | rowProgress.Row.Cells["ClarifierOffsetColumn"].Value = result.ClarifierOffset; |
560 | rowProgress.Row.Cells["ClarifierOffsetColumn"].Value = result.ClarifierOffset; |
|
572 | rowProgress.Row.Cells["ClarColumn"].Value = result.Clar; |
561 | rowProgress.Row.Cells["ClarColumn"].Value = result.Clar; |
|
573 | rowProgress.Row.Cells["ModeColumn"].Value = result.MemoryRadioMode.Name; |
562 | rowProgress.Row.Cells["ModeColumn"].Value = result.MemoryRadioMode.Name; |
|
574 | rowProgress.Row.Cells["CtcssColumn"].Value = (string)result.CtcssMode; |
563 | rowProgress.Row.Cells["CtcssColumn"].Value = (string)result.Ctcss; |
|
575 | rowProgress.Row.Cells["PhaseColumn"].Value = (string)result.Phase; |
564 | rowProgress.Row.Cells["PhaseColumn"].Value = (string)result.Phase; |
|
576 | rowProgress.Row.Cells["TagColumn"].Value = result.Tag; |
565 | rowProgress.Row.Cells["TagColumn"].Value = result.Tag; |
|
577 | rowProgress.Row.Cells["TextColumn"].Value = result.Text; |
566 | rowProgress.Row.Cells["TextColumn"].Value = result.Text; |