HamBook – Diff between revs 37 and 38

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 37 Rev 38
Line 30... Line 30...
30 using static System.Net.Mime.MediaTypeNames; 30 using static System.Net.Mime.MediaTypeNames;
31 using System.Diagnostics; 31 using System.Diagnostics;
32 using Newtonsoft.Json.Linq; 32 using Newtonsoft.Json.Linq;
33 using System.Collections.Concurrent; 33 using System.Collections.Concurrent;
34 using Org.BouncyCastle.Math.Field; 34 using Org.BouncyCastle.Math.Field;
-   35 using System.Runtime.Remoting.Channels;
Line 35... Line 36...
35   36  
36 namespace HamBook 37 namespace HamBook
37 { 38 {
38 public partial class Form1 : Form 39 public partial class Form1 : Form
Line 150... Line 151...
150 return; 151 return;
151 } 152 }
Line 152... Line 153...
152   153  
Line -... Line 154...
-   154 var location = $"{memoryBank:000}";
-   155  
153 var location = $"{memoryBank:000}"; 156 scrollableToolStripComboBox12.Items.Add(location);
Line 154... Line 157...
154   157  
155 MemoryChannel memoryChannel = new MemoryChannel(); 158 MemoryChannel memoryChannel = new MemoryChannel();
156   159  
157 try 160 try
158 { 161 {
Line 159... Line 162...
159 memoryChannel = await _catAssemblies.CatReadAsync<MemoryChannel>("MT", new object[] { location }, _cancellationToken); 162 memoryChannel = await _catAssemblies.CatReadAsync<MemoryChannel>("MT", new object[] { location }, _cancellationToken);
160   163
161 scrollableToolStripComboBox5.Items.Add(location); 164 scrollableToolStripComboBox5.Items.Add(location);
Line 189... Line 192...
189 } 192 }
190 catch (Exception exception) 193 catch (Exception exception)
191 { 194 {
192 System.Windows.Forms.Application.Idle -= IdleHandler; 195 System.Windows.Forms.Application.Idle -= IdleHandler;
Line 193... Line 196...
193   196  
194 Log.Error(exception, Resources.Unable_to_create_memory_banks); 197 Log.Error(exception, Resources.Unable_to_read_memory_banks);
195 } 198 }
Line 196... Line 199...
196 } 199 }
197   200  
Line 860... Line 863...
860 } 863 }
861 } 864 }
Line 862... Line 865...
862   865  
863 private async void scrollableToolStripComboBox5_SelectedIndexChanged(object sender, EventArgs e) 866 private async void scrollableToolStripComboBox5_SelectedIndexChanged(object sender, EventArgs e)
-   867 {
-   868 var toolStripComboBox = (ScrollableToolStripComboBox)sender;
864 { 869  
865 using (var soundPlayer = new SoundPlayer(Assembly.GetExecutingAssembly().GetManifestResourceStream("HamBook.Effects.pot.wav"))) 870 if (int.TryParse(toolStripComboBox.Text, out var channel))
866 { -  
867 var toolStripComboBox = (ToolStripComboBox)sender; 871 {
868 if (int.TryParse(toolStripComboBox.Text, out var channel)) 872 if (_memoryChannelStore.TryGetValue(channel, out var memoryChannel))
869 { 873 {
870 if (_memoryChannelStore.TryGetValue(channel, out var memoryChannel)) 874 try
871 { 875 {
872 try 876 using (var soundPlayer = new SoundPlayer(Assembly.GetExecutingAssembly().GetManifestResourceStream("HamBook.Effects.pot.wav")))
873 { 877 {
Line 874... Line 878...
874 await _catAssemblies.CatWriteAsync<int>("MC", new object[] { channel }, _cancellationToken); 878 await _catAssemblies.CatWriteAsync<int>("MC", new object[] { channel }, _cancellationToken);
Line 875... Line 879...
875   879  
Line 876... Line 880...
876 scrollableToolStripComboBox1.Text = $"{memoryChannel.Frequency}"; 880 scrollableToolStripComboBox1.Text = $"{memoryChannel.Frequency}";
877   881  
-   882 toolStripMenuItem27.Text = memoryChannel.Text;
878 toolStripMenuItem27.Text = memoryChannel.Text; 883  
879   884 soundPlayer.Play();
880 soundPlayer.Play(); 885 }
881 } -  
882 catch (Exception exception) 886 }
883 { 887 catch (Exception exception)
884 Log.Error(exception, Resources.Failed_to_set_memory_channel); 888 {
885 } 889 Log.Error(exception, Resources.Failed_to_set_memory_channel);
Line 1323... Line 1327...
1323 { 1327 {
1324 Log.Error(exception, Resources.Failed_to_set_split_state); 1328 Log.Error(exception, Resources.Failed_to_set_split_state);
1325 } 1329 }
1326 } 1330 }
1327 } 1331 }
-   1332  
-   1333 private async void toolStripMenuItem35_Click(object sender, EventArgs e)
-   1334 {
-   1335 var scrollableToolStripComboBox = scrollableToolStripComboBox12;
-   1336  
-   1337 if (int.TryParse(scrollableToolStripComboBox.Text, out var channel))
-   1338 {
-   1339 if (!_memoryChannelStore.TryGetValue(channel, out var memoryChannel))
-   1340 {
-   1341 memoryChannel = new MemoryChannel();
-   1342 memoryChannel.CurrentLocation = $"{channel:000}";
-   1343 memoryChannel.MemoryRadioMode = toolStripComboBox1.Text;
-   1344 }
-   1345  
-   1346 if (memoryChannel.Tag = !string.IsNullOrEmpty(toolStripTextBox1.Text))
-   1347 {
-   1348 memoryChannel.Text = $"{toolStripTextBox1.Text, -12}";
-   1349 }
-   1350  
-   1351 if (int.TryParse(scrollableToolStripComboBox1.Text, out var frequency))
-   1352 {
-   1353 memoryChannel.Frequency = frequency;
-   1354  
-   1355 try
-   1356 {
-   1357 if (await _catAssemblies.CatSetAsync<MemoryChannel, bool>("MT", new object[] { memoryChannel }, _cancellationToken))
-   1358 {
-   1359 Log.Information(Resources.Stored_VFO_A_to_memory);
-   1360 }
-   1361 }
-   1362 catch (Exception exception)
-   1363 {
-   1364 Log.Error(exception, Resources.Failed_to_save_VFO_A_to_memory);
-   1365 }
-   1366 }
-   1367 }
-   1368 }
-   1369  
-   1370 private void scrollableToolStripComboBox12_SelectedIndexChanged(object sender, EventArgs e)
-   1371 {
-   1372 var toolStripComboBox = (ScrollableToolStripComboBox)sender;
-   1373  
-   1374 if (int.TryParse(toolStripComboBox.Text, out var channel))
-   1375 {
-   1376 if (_memoryChannelStore.TryGetValue(channel, out var memoryChannel))
-   1377 {
-   1378 toolStripTextBox1.Text = memoryChannel.Text;
-   1379 return;
-   1380 }
-   1381  
-   1382 toolStripTextBox1.Text = string.Empty;
-   1383 }
-   1384 }
-   1385  
-   1386 private async void toolStripMenuItem20_Click(object sender, EventArgs e)
-   1387 {
-   1388 try
-   1389 {
-   1390 var frequency = await _catAssemblies.CatReadAsync<int>("FA", new object[] { }, _cancellationToken);
-   1391  
-   1392 await _catAssemblies.CatWriteAsync<int>("FA", new object[] { frequency }, _cancellationToken);
-   1393  
-   1394 await _catAssemblies.CatWriteAsync("SV", new object[] { }, _cancellationToken);
-   1395 }
-   1396 catch (Exception exception)
-   1397 {
-   1398 Log.Error(exception, Resources.Unable_to_swap_VFO_A_and_VFO_B);
-   1399 }
-   1400 }
1328 } 1401 }
1329 } 1402 }