/// <summary> /// Raises <see cref="ModeSMessageReceived"/>. /// </summary> /// <param name="args"></param> private void OnModeSMessageReceived(ModeSMessageEventArgs args) { if (ModeSMessageReceived != null) { ModeSMessageReceived(this, args); } }
/// <summary> /// Passes through events from the original <see cref="ModeSMessageReceived"/>. /// </summary> /// <param name="sender"></param> /// <param name="args"></param> private void Original_ModeSMessageReceived(object sender, ModeSMessageEventArgs args) { args = Filter.FilterEvent(args); if (args != null) { OnModeSMessageReceived(args); } }
public void ModeSMessageEventArgs_Constructor_Initialises_To_Known_State() { var dateTimeNow = DateTime.UtcNow; var message = new ModeSMessage(); var adsbMessage = new AdsbMessage(message); var eventArgs = new ModeSMessageEventArgs(dateTimeNow, message, adsbMessage); Assert.AreEqual(dateTimeNow, eventArgs.ReceivedUtc); Assert.AreSame(message, eventArgs.ModeSMessage); Assert.AreSame(adsbMessage, eventArgs.AdsbMessage); }
/// <summary> /// Returns the event args passed in, possibly altered, or null if the event must not be passed on. /// </summary> /// <param name="args"></param> /// <returns></returns> public static ModeSMessageEventArgs FilterEvent(ModeSMessageEventArgs args) { var result = args; if (args != null && args.ModeSMessage != null) { if (_ParsedConfiguration.IsIcaoProhibited(args.ModeSMessage.Icao24)) { result = null; } else if (args.ModeSMessage.IsMlat && _ParsedConfiguration.IsMlatProhibited()) { result = null; } } return(result); }
/// <summary> /// Raises <see cref="ModeSMessageReceived"/>. /// </summary> /// <param name="args"></param> private void OnModeSMessageReceived(ModeSMessageEventArgs args) { EventHelper.RaiseQuickly(ModeSMessageReceived, this, args); }