IDeviceNotifier Interface

LibUsbDotNet

LibUsbDotNet 2.2.8 IDeviceNotifier Interface
Library ReferenceLibUsbDotNet.DeviceNotifyIDeviceNotifier
LibUsbDotNet on SourceForge
Notifies an application of a change to the hardware Configuration of a device or the computer.
Declaration Syntax
C# Visual Basic Visual C++
public interface IDeviceNotifier
Public Interface IDeviceNotifier
public interface class IDeviceNotifier
Members
All Members Properties Events



Icon Member Description
Enabled
Enables/Disables notification events.

OnDeviceNotify
Main Notify event for all device notifications.

Remarks
For devices that offer software-controllable features, such as ejection and locking, the system typically sends a DeviceRemovePending message to let applications and device drivers end their use of the device gracefully. If the system forcibly removes a device, it may not send a DeviceQueryRemove message before doing so.
Examples
CopyC#
using System;
using System.Windows.Forms;
using LibUsbDotNet.DeviceNotify;

namespace Test_DeviceNotify
{
    public partial class fTestDeviceNotify : Form
    {
        private IDeviceNotifier devNotifier;

        delegate void AppendNotifyDelegate(string s);

        public fTestDeviceNotify()
        {
            InitializeComponent();
            devNotifier = DeviceNotifier.OpenDeviceNotifier();

            devNotifier.OnDeviceNotify += onDevNotify;
        }


        private void onDevNotify(object sender, DeviceNotifyEventArgs e)
        {
            Invoke(new AppendNotifyDelegate(AppendNotifyText),new object[] {e.ToString()});
        }

        private void AppendNotifyText(string s)
        {
           tNotify.AppendText(s);
        }
        private void tNotify_DoubleClick(object sender, EventArgs e)
        {
            tNotify.Clear();
        }
    }
}

Assembly: LibUsbDotNet (Module: LibUsbDotNet) Version: 2.2.8.104 (2.2.8.104)