/// <summary> /// The method that unsubscribes the pipe device from all events, stops direct MetaPubSub server /// and remove its pairing with the relative pipe device. /// </summary> /// <param name="pipeDevice">The pipe device that must unsubscribe from all events.</param> /// <param name="pubSub">The key through which you want to remove the pipe device from the dictionary.</param> void DisposePipeDevicePair(IPipeDevice pipeDevice, IMetaPubSub pubSub) { if (pubSub != null) { pipeDevice.DeviceStateChanged -= RemoteConnection_DeviceStateChanged; pubSub.StopServer(); RemotePipeDevicesDictionary.Remove(pubSub); } }