HamBook – Diff between revs 54 and 56

Subversion Repositories:
Rev:
Show entire fileIgnore whitespace
Rev 54 Rev 56
Line 476... Line 476...
476 try 476 try
477 { 477 {
478 using (var soundPlayer = new SoundPlayer(Assembly.GetExecutingAssembly() 478 using (var soundPlayer = new SoundPlayer(Assembly.GetExecutingAssembly()
479 .GetManifestResourceStream("HamBook.Effects.pot.wav"))) 479 .GetManifestResourceStream("HamBook.Effects.pot.wav")))
480 { 480 {
481 if (await _catAssemblies.CatSetAsync<int, bool>("FB", new object[] { frequency }, 481 if (!await _catAssemblies.CatSetAsync<int, bool>("FB", new object[] { frequency },
482 _cancellationToken)) 482 _cancellationToken))
483 { 483 return;
484 toolStripComboBox.Text = $"{frequency}"; 484 toolStripComboBox.Text = $"{frequency}";
Line 485... Line 485...
485   485  
486 if (Configuration.Navigation.MouseScrollSound) soundPlayer.Play(); -  
487 } 486 if (Configuration.Navigation.MouseScrollSound) soundPlayer.Play();
488 } 487 }
489 } 488 }
490 catch (Exception exception) 489 catch (Exception exception)
491 { 490 {
Line 805... Line 804...
805 _tickerTextMemoryChannel.CurrentLocation = $"{_storedMemoryChannelLocation:000}"; 804 _tickerTextMemoryChannel.CurrentLocation = $"{_storedMemoryChannelLocation:000}";
806 _tickerTextMemoryChannel.Text = $"{_storedMemoryChannelTagText,-12}"; 805 _tickerTextMemoryChannel.Text = $"{_storedMemoryChannelTagText,-12}";
Line 807... Line 806...
807   806  
808 var success = await _catAssemblies.CatSetAsync<MemoryChannel, bool>("MT", 807 var success = await _catAssemblies.CatSetAsync<MemoryChannel, bool>("MT",
809 new object[] { _tickerTextMemoryChannel }, _cancellationToken); -  
810 if (!success) -  
811 { 808 new object[] { _tickerTextMemoryChannel }, _cancellationToken);
812 Log.Error(Resources.Error_while_restoring_memory_text); -  
813 } 809 if (!success) Log.Error(Resources.Error_while_restoring_memory_text);
814 } 810 }
815 catch (Exception exception) 811 catch (Exception exception)
816 { 812 {
817 Log.Error(exception, Resources.Error_while_restoring_memory_text); 813 Log.Error(exception, Resources.Error_while_restoring_memory_text);
Line 1060... Line 1056...
1060 try 1056 try
1061 { 1057 {
1062 using (var soundPlayer = new SoundPlayer(Assembly.GetExecutingAssembly() 1058 using (var soundPlayer = new SoundPlayer(Assembly.GetExecutingAssembly()
1063 .GetManifestResourceStream("HamBook.Effects.pot.wav"))) 1059 .GetManifestResourceStream("HamBook.Effects.pot.wav")))
1064 { 1060 {
1065 if (await _catAssemblies.CatSetAsync<int, bool>("FA", new object[] { frequency }, 1061 if (!await _catAssemblies.CatSetAsync<int, bool>("FA", new object[] { frequency },
1066 _cancellationToken)) 1062 _cancellationToken))
1067 { 1063 return;
1068 toolStripComboBox.Text = $"{frequency}"; -  
Line -... Line 1064...
-   1064  
-   1065 toolStripComboBox.Text = $"{frequency}";
1069   1066  
1070 if (Configuration.Navigation.MouseScrollSound) soundPlayer.Play(); -  
1071 } 1067 if (Configuration.Navigation.MouseScrollSound) soundPlayer.Play();
1072 } 1068 }
1073 } 1069 }
1074 catch (Exception exception) 1070 catch (Exception exception)
1075 { 1071 {
Line 1085... Line 1081...
1085 case (char)Keys.Enter: 1081 case (char)Keys.Enter:
Line 1086... Line 1082...
1086   1082  
Line 1087... Line 1083...
1087   1083  
-   1084 var toolStripComboBox = (ScrollableToolStripComboBox)sender;
1088 var toolStripComboBox = (ScrollableToolStripComboBox)sender; 1085  
-   1086 if (!int.TryParse(toolStripComboBox.Text, out var frequency)) break;
-   1087  
-   1088 try
1089   1089 {
1090 if (int.TryParse(toolStripComboBox.Text, out var frequency)) 1090 using (var soundPlayer = new SoundPlayer(Assembly.GetExecutingAssembly()
1091 try 1091 .GetManifestResourceStream("HamBook.Effects.pot.wav")))
1092 { 1092 {
1093 using (var soundPlayer = new SoundPlayer(Assembly.GetExecutingAssembly() -  
1094 .GetManifestResourceStream("HamBook.Effects.pot.wav"))) -  
1095 { -  
1096 if (await _catAssemblies.CatSetAsync<int, bool>("FA", new object[] { frequency }, 1093 if (await _catAssemblies.CatSetAsync<int, bool>("FA", new object[] { frequency },
Line 1097... Line 1094...
1097 _cancellationToken)) 1094 _cancellationToken))
1098 { -  
1099 e.Handled = true; 1095 {
1100   1096 e.Handled = true;
-   1097  
1101 if (Configuration.Navigation.MouseScrollSound) soundPlayer.Play(); 1098 if (Configuration.Navigation.MouseScrollSound) soundPlayer.Play();
1102 } 1099 }
1103 } 1100 }
1104 } 1101 }
Line 1105... Line 1102...
1105 catch (Exception exception) 1102 catch (Exception exception)
1106 { 1103 {
1107 Log.Error(exception, Resources.Failed_to_set_VFO_A_frequency); 1104 Log.Error(exception, Resources.Failed_to_set_VFO_A_frequency);
Line 1117... Line 1114...
1117   1114  
1118 _squelchScheduledContinuation.Schedule(TimeSpan.FromSeconds(1), () => 1115 _squelchScheduledContinuation.Schedule(TimeSpan.FromSeconds(1), () =>
1119 { 1116 {
1120 contextMenuStrip1.InvokeIfRequired(async contextMenuStrip1 => 1117 contextMenuStrip1.InvokeIfRequired(async contextMenuStrip1 =>
1121 { 1118 {
1122 if (int.TryParse(toolStripComboBox.Text, out var squelch)) -  
1123 try -  
1124 { -  
Line -... Line 1119...
-   1119 if (!int.TryParse(toolStripComboBox.Text, out var squelch)) return;
-   1120  
1125 await _catAssemblies.CatWriteAsync<int>("SQ", new object[] { squelch }, _cancellationToken); 1121 try
Line -... Line 1122...
-   1122 {
-   1123 await _catAssemblies.CatWriteAsync<int>("SQ", new object[] { squelch }, _cancellationToken);
1126   1124  
1127 toolStripComboBox.Text = $"{squelch}"; 1125 toolStripComboBox.Text = $"{squelch}";
1128   1126  
1129 Log.Information($"{Resources.Squelch_set} {squelch}"); 1127 Log.Information($"{Resources.Squelch_set} {squelch}");
1130 } 1128 }
1131 catch (Exception exception) 1129 catch (Exception exception)
1132 { 1130 {
1133 Log.Error(exception, Resources.Failed_to_set_squelch); 1131 Log.Error(exception, Resources.Failed_to_set_squelch);
1134 } 1132 }
Line 1135... Line 1133...
1135 }); 1133 });
Line 1238... Line 1236...
1238   1236  
1239 try 1237 try
1240 { 1238 {
1241 if (await _catAssemblies.CatSetAsync<TxState, bool>("TX", new object[] { TxState.ON }, 1239 if (await _catAssemblies.CatSetAsync<TxState, bool>("TX", new object[] { TxState.ON },
1242 _cancellationToken)) -  
1243 { 1240 _cancellationToken))
1244 toolStripMenuItem.Text = Resources.On; -  
1245 } 1241 toolStripMenuItem.Text = Resources.On;
1246 } 1242 }
1247 catch (Exception exception) 1243 catch (Exception exception)
1248 { 1244 {
1249 Log.Error(exception, Resources.Failed_to_set_PTT_state); 1245 Log.Error(exception, Resources.Failed_to_set_PTT_state);
Line 1256... Line 1252...
1256   1252  
1257 try 1253 try
1258 { 1254 {
1259 if (await _catAssemblies.CatSetAsync<TxState, bool>("TX", new object[] { TxState.OFF }, 1255 if (await _catAssemblies.CatSetAsync<TxState, bool>("TX", new object[] { TxState.OFF },
1260 _cancellationToken)) -  
1261 { 1256 _cancellationToken))
1262 toolStripMenuItem.Text = Resources.Off; -  
1263 } 1257 toolStripMenuItem.Text = Resources.Off;
1264 } 1258 }
1265 catch (Exception exception) 1259 catch (Exception exception)
1266 { 1260 {
1267 Log.Error(exception, Resources.Failed_to_set_PTT_state); 1261 Log.Error(exception, Resources.Failed_to_set_PTT_state);
Line 1292... Line 1286...
1292   1286  
1293 private async void scrollableToolStripComboBox8_SelectedIndexChanged(object sender, EventArgs e) 1287 private async void scrollableToolStripComboBox8_SelectedIndexChanged(object sender, EventArgs e)
1294 { 1288 {
Line 1295... Line 1289...
1295 var toolStripComboBox = (ScrollableToolStripComboBox)sender; 1289 var toolStripComboBox = (ScrollableToolStripComboBox)sender;
-   1290  
1296   1291 if (!SplitState.TryParse(toolStripComboBox.Text, out var splitState)) return;
1297 if (SplitState.TryParse(toolStripComboBox.Text, out var splitState)) 1292  
1298 try 1293 try
1299 { 1294 {
1300 if (await _catAssemblies.CatSetAsync<int, bool>("ST", new object[] { splitState }, 1295 if (await _catAssemblies.CatSetAsync<int, bool>("ST", new object[] { splitState },
1301 _cancellationToken)) Log.Information($"{Resources.Split_state_set} {splitState}W"); 1296 _cancellationToken)) Log.Information($"{Resources.Split_state_set} {splitState}W");
1302 } 1297 }
1303 catch (Exception exception) 1298 catch (Exception exception)
1304 { 1299 {
1305 Log.Error(exception, Resources.Failed_to_set_split_state); 1300 Log.Error(exception, Resources.Failed_to_set_split_state);
Line 1306... Line 1301...
1306 } 1301 }
1307 } 1302 }
1308   1303