@@ -34,6 +34,7 @@ private ATISControl Control
34
34
public EventHandler RefreshEvent { get ; set ; }
35
35
public InstalledVoice Voice { get ; set ; }
36
36
public PromptRate Rate { get ; set ; }
37
+ private string ZuluFrequency { get ; set ; }
37
38
38
39
public EditorWindow ( )
39
40
{
@@ -98,6 +99,18 @@ private void LoadOptions()
98
99
{
99
100
comboBoxVoice . Items . Add ( voice . VoiceInfo . Name ) ;
100
101
}
102
+
103
+ comboBoxZuluFrequency . Items . Clear ( ) ;
104
+
105
+ if ( Plugin . Frequencies . Any ( ) )
106
+ {
107
+ foreach ( var frequency in Plugin . Frequencies )
108
+ {
109
+ comboBoxZuluFrequency . Items . Add ( string . IsNullOrWhiteSpace ( frequency . FriendlyName ) ? frequency . Name : frequency . FriendlyName ) ;
110
+ }
111
+
112
+ comboBoxZuluFrequency . SelectedIndex = 0 ;
113
+ }
101
114
}
102
115
103
116
private void RefreshForm ( )
@@ -114,6 +127,18 @@ private void RefreshForm()
114
127
115
128
comboBoxTimecheck . SelectedIndex = comboBoxTimecheck . FindStringExact ( TimeCheck . ToString ( ) ) ;
116
129
130
+ comboBoxZuluFrequency . Items . Clear ( ) ;
131
+
132
+ foreach ( var frequency in Plugin . Frequencies )
133
+ {
134
+ comboBoxZuluFrequency . Items . Add ( string . IsNullOrWhiteSpace ( frequency . FriendlyName ) ? frequency . Name : frequency . FriendlyName ) ;
135
+ }
136
+
137
+ if ( ! string . IsNullOrWhiteSpace ( ZuluFrequency ) )
138
+ {
139
+ comboBoxZuluFrequency . SelectedIndex = comboBoxZuluFrequency . FindStringExact ( ZuluFrequency ) ;
140
+ }
141
+
117
142
if ( Plugin . ATIS1 . ICAO != null )
118
143
{
119
144
buttonATIS1 . Text = Plugin . ATIS1 . ICAO ;
@@ -260,9 +285,13 @@ private void RefreshForm()
260
285
261
286
if ( Control . IsZulu && Network . IsConnected && Control ? . ICAO != null )
262
287
{
288
+ textBoxZulu . TextChanged += TextBox_TextChanged ;
289
+
290
+ textBoxZulu . Visible = true ;
291
+ comboBoxZuluFrequency . Visible = true ;
292
+ labelFrequency . Visible = true ;
263
293
buttonZulu . BackColor = Color . FromName ( "ControlDarkDark" ) ;
264
294
buttonZulu . ForeColor = Color . FromName ( "ControlLightLight" ) ;
265
- textBoxZulu . Visible = true ;
266
295
textBoxAPCH . Visible = false ;
267
296
textBoxRWY . Visible = false ;
268
297
textBoxSFCCOND . Visible = false ;
@@ -291,9 +320,13 @@ private void RefreshForm()
291
320
}
292
321
else
293
322
{
323
+ textBoxZulu . TextChanged -= TextBox_TextChanged ;
324
+
294
325
buttonZulu . BackColor = Color . FromName ( "Control" ) ;
295
326
buttonZulu . ForeColor = default ;
296
327
textBoxZulu . Visible = false ;
328
+ labelFrequency . Visible = false ;
329
+ comboBoxZuluFrequency . Visible = false ;
297
330
textBoxAPCH . Visible = true ;
298
331
textBoxRWY . Visible = true ;
299
332
textBoxSFCCOND . Visible = true ;
@@ -710,6 +743,7 @@ private void RefreshForm()
710
743
711
744
textBoxZulu . Enabled = false ;
712
745
textBoxZulu . Visible = false ;
746
+ comboBoxZuluFrequency . Visible = false ;
713
747
textBoxAPCH . Enabled = false ;
714
748
textBoxRWY . Enabled = false ;
715
749
textBoxSFCCOND . Enabled = false ;
@@ -1054,20 +1088,58 @@ private void ButtonZulu_Click(object sender, EventArgs e)
1054
1088
if ( ! Control . IsZulu )
1055
1089
{
1056
1090
Control . IsZulu = true ;
1057
- var zuluInfo = Plugin . ZuluInfo . FirstOrDefault ( x => x . ICAO == ICAO ) ;
1058
- var zuluLine = Control . Lines . FirstOrDefault ( x => x . Name == "ZULU" ) ;
1059
- if ( zuluInfo != null && zuluLine != null )
1060
- {
1061
- zuluLine . Value = zuluInfo . Text ;
1062
- textBoxZulu . Text = zuluInfo . Text ;
1063
- }
1091
+
1092
+ GenerateZulu ( ) ;
1064
1093
}
1065
1094
else
1066
1095
{
1067
1096
Control . IsZulu = false ;
1097
+
1098
+ textBoxZulu . Text = string . Empty ;
1099
+
1100
+ ZuluFrequency = string . Empty ;
1068
1101
}
1069
1102
1070
1103
RefreshForm ( ) ;
1071
1104
}
1105
+
1106
+ private void ComboBoxZuluFrequency_SelectedIndexChanged ( object sender , EventArgs e )
1107
+ {
1108
+ var zuluFrequency = ( string ) comboBoxZuluFrequency . SelectedItem ;
1109
+
1110
+ if ( zuluFrequency == ZuluFrequency ) return ;
1111
+
1112
+ ZuluFrequency = zuluFrequency ;
1113
+
1114
+ GenerateZulu ( ) ;
1115
+
1116
+ RefreshForm ( ) ;
1117
+ }
1118
+
1119
+ private void GenerateZulu ( )
1120
+ {
1121
+ var zuluInfo = Plugin . ZuluInfo . FirstOrDefault ( x => x . ICAO == ICAO ) ;
1122
+
1123
+ var zuluLine = Control . Lines . FirstOrDefault ( x => x . Name == "ZULU" ) ;
1124
+
1125
+ if ( zuluInfo == null || zuluLine == null ) return ;
1126
+
1127
+ var atis = zuluInfo . Text ;
1128
+
1129
+ var frequency = Plugin . Frequencies . FirstOrDefault ( x => x . Name == ZuluFrequency || x . FriendlyName == ZuluFrequency ) ;
1130
+
1131
+ if ( frequency != null )
1132
+ {
1133
+ var station = string . IsNullOrWhiteSpace ( frequency . FriendlyName ) ? frequency . Name : frequency . FriendlyName ;
1134
+
1135
+ atis = atis . Replace ( "{STATION}" , station . ToUpper ( ) ) ;
1136
+
1137
+ atis = atis . Replace ( "{FREQ}" , Conversions . FrequencyToString ( frequency . Frequency ) ) ;
1138
+ }
1139
+
1140
+ zuluLine . Value = atis ;
1141
+
1142
+ textBoxZulu . Text = atis ;
1143
+ }
1072
1144
}
1073
1145
}
0 commit comments