Beispiel #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NuGenDriveCombo"/> class.
        /// </summary>
        /// <param name="serviceProvider"><para>Requires:</para>
        ///     <para><see cref="INuGenComboBoxRenderer"/></para>
        ///     <para><see cref="INuGenButtonStateService"/></para>
        ///     <para><see cref="INuGenImageListService"/></para></param>
        /// <exception cref="ArgumentNullException"><paramref name="serviceProvider"/> is <see langword="null"/>.</exception>
        public NuGenDriveCombo(INuGenServiceProvider serviceProvider)
            : base(serviceProvider)
        {
            _deviceChangeFilter = new DeviceChangeFilter();
            _deviceChangeFilter.DeviceChanged += _deviceChangeFilter_DeviceChanged;
            Application.AddMessageFilter(_deviceChangeFilter);

            this.DropDownStyle = ComboBoxStyle.DropDownList;
            this.RefreshDrives();
        }
Beispiel #2
0
        /// <summary>
        /// Releases the unmanaged resources used by the <see cref="T:System.Windows.Forms.ComboBox"></see> and optionally releases the managed resources.
        /// </summary>
        /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_deviceChangeFilter != null)
                {
                    Application.RemoveMessageFilter(_deviceChangeFilter);
                    _deviceChangeFilter.DeviceChanged -= _deviceChangeFilter_DeviceChanged;
                    _deviceChangeFilter = null;
                }

                if (_imageList != null)
                {
                    _imageList.Dispose();
                    _imageList = null;
                }
            }

            base.Dispose(disposing);
        }
		/// <summary>
		/// Releases the unmanaged resources used by the <see cref="T:System.Windows.Forms.ComboBox"></see> and optionally releases the managed resources.
		/// </summary>
		/// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
		protected override void Dispose(bool disposing)
		{
			if (disposing)
			{
				if (_deviceChangeFilter != null)
				{
					Application.RemoveMessageFilter(_deviceChangeFilter);
					_deviceChangeFilter.DeviceChanged -= _deviceChangeFilter_DeviceChanged;
					_deviceChangeFilter = null;
				}

				if (_imageList != null)
				{
					_imageList.Dispose();
					_imageList = null;
				}
			}

			base.Dispose(disposing);
		}
		/// <summary>
		/// Initializes a new instance of the <see cref="NuGenDriveCombo"/> class.
		/// </summary>
		/// <param name="serviceProvider"><para>Requires:</para>
		/// 	<para><see cref="INuGenComboBoxRenderer"/></para>
		/// 	<para><see cref="INuGenButtonStateService"/></para>
		/// 	<para><see cref="INuGenImageListService"/></para></param>
		/// <exception cref="ArgumentNullException"><paramref name="serviceProvider"/> is <see langword="null"/>.</exception>
		public NuGenDriveCombo(INuGenServiceProvider serviceProvider)
			: base(serviceProvider)
		{
			_deviceChangeFilter = new DeviceChangeFilter();
			_deviceChangeFilter.DeviceChanged += _deviceChangeFilter_DeviceChanged;
			Application.AddMessageFilter(_deviceChangeFilter);

			this.DropDownStyle = ComboBoxStyle.DropDownList;
			this.RefreshDrives();
		}