public CommunicationAction(CommunicationInterface commInterface)
        {
            CommInterface = commInterface;

            IsComplete            = true;
            CompletedSuccessfully = true;
            CompletedWithoutCommunicationError = true;
        }
 protected virtual void OnConnectionChanged(CommunicationInterface commInteface, CommunicationInterface.ConnectionStatusType status, bool willReconnect)
 {
     if ((status == CommunicationInterface.ConnectionStatusType.CommunicationTerminated) || (status == CommunicationInterface.ConnectionStatusType.Disconnected))
     {
         if (ShouldFailOnDisconnect())
         {
             OperationCompleted(false);
         }
     }
 }
 private void ConnectionChangedHandler(CommunicationInterface commInterface, CommunicationInterface.ConnectionStatusType status, bool willReconnect)
 {
     lock (this)        //lock to ensure we don't accidentally get other callbacks while handling this one
     {
         if (IsRunning) //always need to check this in case we are getting callbacks after we complete
         {
             OnConnectionChanged(commInterface, status, willReconnect);
         }
     }
 }
            protected override void BeginInvoke(CommunicationInterface commInterface, Delegate del, AsyncCallback callback, object invokeParam)
            {
                if (del is ConnectionStatusChangedDelegate)
                {
                    var statusChangedDel     = del as ConnectionStatusChangedDelegate;
                    var KwP2000CommInterface = commInterface as KWP2000Interface;

#if DEBUG//cut down on work in non debug builds
                    commInterface.DisplayStatusMessage("Invoking: " + del.Target.ToString() + "." + del.Method.ToString() + " at " + DateTime.Now.ToString("hh:mm:ss.fff"), StatusMessageType.DEV);
#endif
                    statusChangedDel.BeginInvoke(KwP2000CommInterface, mStatus, mWillReconnect, callback, invokeParam);
                }
            }
            public bool BeginInvoke(CommunicationInterface commInterface, Delegate[] dels, AsyncCallback callback, object invokeParam)
            {
                commInterface.LogProfileEventDispatch("EventHolder BeginInvoke");

                bool invokedAny = false;

                if ((dels != null) && (dels.Length > 0))
                {
                    foreach (Delegate del in dels)
                    {
                        BeginInvoke(commInterface, del, callback, invokeParam);
                        invokedAny = true;
                    }
                }

                commInterface.LogProfileEventDispatch("EventHolder BeginInvoke Finished");

                return(invokedAny);
            }
 protected abstract void BeginInvoke(CommunicationInterface commInterface, Delegate del, AsyncCallback callback, object invokeParam);
 public CommunicationOperation(CommunicationInterface commInterface)
 {
     CommInterface = commInterface;
     CurrentAction = null;
 }