/// <summary> /// Raises the PackageProcessed event /// </summary> /// <param name="e">the argument received from the real service</param> protected virtual void OnPackageProcessed(PackageFinishedEventArgs e) { PackageFinishedEventHandler handler = PackageProcessed; if (handler != null) { handler(this, e); } }
/// <summary> /// Initializes a new instance of the ParallelClient class /// </summary> /// <param name="client">the base client that supports connecting the remote service</param> /// <param name="remoteObjectName">the object that is able to process this client's tasks</param> /// <param name="localSystemIdentifier">the identification of the local system</param> protected ParallelClient(IBidirectionalClient client, string remoteObjectName, string localSystemIdentifier) { stopEvent = new ManualResetEvent(false); stoppedEvent = new ManualResetEvent(false); this.checkConnectionTimer = new Timer(TestServer, string.Format("::{0}::", GetHashCode()), Timeout.Infinite, Timeout.Infinite); this.remoteObjectName = remoteObjectName; this.localSystemIdentifier = localSystemIdentifier; this.client = client; client.OperationalChanged += HandleClientOperationalChanged; packageFinishedHandler = new PackageFinishedEventHandler(PackageProcessed); if (!CheckConnection()) { } checkConnectionTimer.Change(CheckTimeout, CheckTimeout); }