/// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="deviceId"></param>
        internal PortableDevice(string deviceId)
        {
            if (string.IsNullOrEmpty(deviceId))
                throw new ArgumentNullException("deviceId");
            this.dispatcher = new object();
            this.portableDeviceClass = new PortableDeviceApiLib.PortableDeviceClass();
            this.values = new Dictionary<string, object>();

            this.DeviceId = deviceId;
        }
        /// <summary>
        /// Default constructor
        /// </summary>
        /// <param name="deviceId"></param>
        internal PortableDevice(string deviceId)
        {
            if (string.IsNullOrEmpty(deviceId))
            {
                throw new ArgumentNullException("deviceId");
            }
            this.dispatcher          = new object();
            this.portableDeviceClass = new PortableDeviceApiLib.PortableDeviceClass();
            this.values = new Dictionary <string, object>();

            this.DeviceId = deviceId;
        }
        private void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (!string.IsNullOrEmpty(this.adviseCookie))
                {
                    this.portableDeviceClass.Unadvise(this.adviseCookie);
                }

                if (this.IsConnected)
                {
                    this.portableDeviceClass.Close();
                }
            }

            this.portableDeviceClass = null;
        }
        private void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (!string.IsNullOrEmpty(this.adviseCookie))
                    this.portableDeviceClass.Unadvise(this.adviseCookie);

                if (this.IsConnected)
                    this.portableDeviceClass.Close();
            }

            this.portableDeviceClass = null;
        }