Example #1
0
 /// <summary>
 ///     Display messages from the target process
 /// </summary>
 /// <param name="message"></param>
 private void CaptureInterface_RemoteMessage(MessageReceivedEventArgs message)
 {
     txtDebugLog.Invoke(
         new MethodInvoker(
             delegate { txtDebugLog.Text = string.Format("{0}\r\n{1}", message, txtDebugLog.Text); })
         );
 }
        private void SafeInvokeMessageRecevied(MessageReceivedEventArgs eventArgs)
        {
            if (RemoteMessage == null)
                return; //No Listeners

            MessageReceivedEvent listener = null;
            var dels = RemoteMessage.GetInvocationList();

            foreach (var del in dels)
            {
                try
                {
                    listener = (MessageReceivedEvent) del;
                    listener.Invoke(eventArgs);
                }
                catch (Exception)
                {
                    //Could not reach the destination, so remove it
                    //from the list
                    RemoteMessage -= listener;
                }
            }
        }