|
1 | | -using NetAF.Commands.Global; |
| 1 | +using NetAF.Commands; |
| 2 | +using NetAF.Commands.Global; |
2 | 3 | using NetAF.Commands.RegionMap; |
3 | 4 | using NetAF.Logic; |
4 | 5 | using NetAF.Logic.Modes; |
@@ -114,6 +115,16 @@ public double SectionSpacing |
114 | 115 | set { SetValue(SectionSpacingProperty, value); } |
115 | 116 | } |
116 | 117 |
|
| 118 | + /// <summary> |
| 119 | + /// Occurs when a command is selected. |
| 120 | + /// </summary> |
| 121 | + public event EventHandler<CommandHelp> CommandSelected; |
| 122 | + |
| 123 | + /// <summary> |
| 124 | + /// Occurs when a command is executed. |
| 125 | + /// </summary> |
| 126 | + public event EventHandler<string> CommandExecuted; |
| 127 | + |
117 | 128 | #endregion |
118 | 129 |
|
119 | 130 | #region DependencyProperties |
@@ -187,56 +198,69 @@ public NetAFRegionMapCommandPicker() |
187 | 198 |
|
188 | 199 | #endregion |
189 | 200 |
|
| 201 | + #region Methods |
| 202 | + |
| 203 | + private void ExecuteCommand(CommandHelp command) |
| 204 | + { |
| 205 | + CommandSelected?.Invoke(this, command); |
| 206 | + |
| 207 | + GameExecutor.Update(command.Command); |
| 208 | + |
| 209 | + CommandExecuted?.Invoke(this, command.Command); |
| 210 | + } |
| 211 | + |
| 212 | + #endregion |
| 213 | + |
190 | 214 | #region EventHandlers |
191 | 215 |
|
192 | 216 | private void PanNorthSelectedCommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) |
193 | 217 | { |
194 | | - GameExecutor.Update(Pan.NorthCommandHelp.Command); |
| 218 | + ExecuteCommand(Pan.NorthCommandHelp); |
195 | 219 | } |
196 | 220 |
|
197 | 221 | private void PanEastSelectedCommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) |
198 | 222 | { |
199 | | - GameExecutor.Update(Pan.EastCommandHelp.Command); |
| 223 | + ExecuteCommand(Pan.EastCommandHelp); |
200 | 224 | } |
201 | 225 |
|
202 | 226 | private void PanSouthSelectedCommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) |
203 | 227 | { |
204 | | - GameExecutor.Update(Pan.SouthCommandHelp.Command); |
| 228 | + ExecuteCommand(Pan.SouthCommandHelp); |
205 | 229 | } |
206 | 230 |
|
207 | 231 | private void PanWestSelectedCommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) |
208 | 232 | { |
209 | | - GameExecutor.Update(Pan.WestCommandHelp.Command); |
| 233 | + ExecuteCommand(Pan.WestCommandHelp); |
210 | 234 | } |
211 | 235 |
|
212 | 236 | private void PanUpSelectedCommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) |
213 | 237 | { |
214 | | - GameExecutor.Update(Pan.UpCommandHelp.Command); |
| 238 | + ExecuteCommand(Pan.UpCommandHelp); |
215 | 239 | } |
216 | 240 |
|
217 | 241 | private void PanDownSelectedCommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) |
218 | 242 | { |
219 | | - GameExecutor.Update(Pan.DownCommandHelp.Command); |
| 243 | + ExecuteCommand(Pan.DownCommandHelp); |
220 | 244 | } |
221 | 245 |
|
222 | 246 | private void ZoomInSelectedCommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) |
223 | 247 | { |
224 | | - GameExecutor.Update(ZoomIn.CommandHelp.Command); |
| 248 | + ExecuteCommand(ZoomIn.CommandHelp); |
225 | 249 | } |
226 | 250 |
|
227 | 251 | private void PanResetSelectedCommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) |
228 | 252 | { |
229 | | - GameExecutor.Update(PanReset.CommandHelp.Command); |
| 253 | + ExecuteCommand(PanReset.CommandHelp); |
230 | 254 | } |
231 | 255 |
|
232 | 256 | private void ZoomOutSelectedCommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) |
233 | 257 | { |
234 | | - GameExecutor.Update(ZoomOut.CommandHelp.Command); |
| 258 | + ExecuteCommand(ZoomOut.CommandHelp); |
235 | 259 | } |
236 | 260 |
|
237 | 261 | private void EndSelectedCommandBinding_Executed(object sender, ExecutedRoutedEventArgs e) |
238 | 262 | { |
239 | | - GameExecutor.Update(End.CommandHelp.Command); |
| 263 | + ExecuteCommand(End.CommandHelp); |
240 | 264 | } |
241 | 265 |
|
242 | 266 | #endregion |
|
0 commit comments