├── Nuget ├── Pack.cmd ├── FormsUsbMonitor.nuspec └── WpfUsbMonitor.nuspec ├── DocFx ├── images │ ├── bassman.ico │ └── bassman.svg ├── toc.yml ├── index.md ├── history │ └── index.md └── docfx.json ├── .github ├── images │ └── donate.gif ├── dependabot.yml └── workflows │ ├── codeql.yml │ ├── docfx.yml │ └── build.yml ├── Doc ├── WpfUsbMonitorDocumentation │ ├── icons │ │ └── Help.png │ ├── ContentLayout.content │ └── Content │ │ ├── VersionHistory │ │ └── VersionHistory.aml │ │ └── Welcome.aml └── FormsUsbMonitorDocumentation │ ├── icons │ └── Help.png │ ├── ContentLayout.content │ └── Content │ ├── Welcome.aml │ └── VersionHistory │ └── VersionHistory.aml ├── Src ├── UsbMonitorShare │ ├── IUsbMonitor.cs │ ├── UsbVolumeFlags.cs │ ├── IUsbMonitorCommands.cs │ ├── EnumGuidAttribute.cs │ ├── UsbEventArgs.cs │ ├── IUsbMonitorOverrides.cs │ ├── IUsbMonitorEvents.cs │ ├── UsbMonitorShare.shproj │ ├── UsbDeviceType.cs │ ├── UsbEventPortArgs.cs │ ├── UsbEventOemArgs.cs │ ├── UsbDeviceChangeEvent.cs │ ├── UsbEventDeviceInterfaceArgs.cs │ ├── UsbMonitorShare.projitems │ ├── UsbEventVolumeArgs.cs │ └── UsbEventHandleArgs.cs ├── WpfUsbMonitor48 │ ├── Properties │ │ ├── Settings.settings │ │ ├── Settings.Designer.cs │ │ ├── AssemblyInfo.cs │ │ └── Resources.Designer.cs │ └── WpfUsbMonitor48.csproj ├── WpfUsbMonitorShare │ ├── WpfUsbMonitorShare.projitems │ ├── WpfUsbMonitorShare.shproj │ └── UsbMonitorManager.cs ├── FormsUsbMonitorShare │ ├── FormsUsbMonitorShare.projitems │ ├── FormsUsbMonitorShare.shproj │ └── UsbMonitorManager.cs ├── WpfUsbMonitor60 │ └── WpfUsbMonitor60.csproj ├── FormsUsbMonitor60 │ └── FormsUsbMonitor60.csproj ├── WpfUsbMonitor70 │ └── WpfUsbMonitor70.csproj ├── WpfUsbMonitor80 │ └── WpfUsbMonitor80.csproj ├── WpfUsbMonitor90 │ └── WpfUsbMonitor90.csproj ├── FormsUsbMonitor70 │ └── FormsUsbMonitor70.csproj ├── FormsUsbMonitor80 │ └── FormsUsbMonitor80.csproj ├── FormsUsbMonitor90 │ └── FormsUsbMonitor90.csproj └── FormsUsbMonitor48 │ ├── Properties │ └── AssemblyInfo.cs │ └── FormsUsbMonitor48.csproj ├── Demo ├── Demo Share │ ├── WpfDeviceCatcherEventShare │ │ ├── UnknownDrive.ico │ │ ├── App.xaml.cs │ │ ├── App.xaml │ │ ├── MainWindow.xaml.cs │ │ ├── MainWindow.xaml │ │ ├── WpfDeviceCatcherEventShare.shproj │ │ └── WpfDeviceCatcherEventShare.projitems │ ├── WpfDeviceCatcherMvvmShare │ │ ├── UnknownDrive.ico │ │ ├── MainView.xaml.cs │ │ ├── App.xaml │ │ ├── App.xaml.cs │ │ ├── WpfDeviceCatcherMvvmShare.shproj │ │ ├── MainView.xaml │ │ ├── WpfDeviceCatcherMvvmShare.projitems │ │ ├── MainViewModel.cs │ │ └── DelegateCommand.cs │ ├── WpfDeviceCatcherMemberShare │ │ ├── UnknownDrive.ico │ │ ├── App.xaml.cs │ │ ├── App.xaml │ │ ├── MainWindow.xaml │ │ ├── MainWindow.xaml.cs │ │ ├── WpfDeviceCatcherMemberShare.shproj │ │ └── WpfDeviceCatcherMemberShare.projitems │ ├── WpfDeviceCatcherOverrideShare │ │ ├── UnknownDrive.ico │ │ ├── App.xaml.cs │ │ ├── App.xaml │ │ ├── MainWindow.xaml │ │ ├── WpfDeviceCatcherOverrideShare.shproj │ │ ├── MainWindow.xaml.cs │ │ └── WpfDeviceCatcherOverrideShare.projitems │ ├── FormsDeviceCatcherEventShare │ │ ├── Program.cs │ │ ├── MainForm.cs │ │ ├── FormsDeviceCatcherEventShare.shproj │ │ ├── FormsDeviceCatcherEventShare.projitems │ │ └── MainForm.Designer.cs │ ├── FormsDeviceCatcherOverrideShare │ │ ├── Program.cs │ │ ├── FormsDeviceCatcherOverrideShare.shproj │ │ ├── FormsDeviceCatcherOverrideShare.projitems │ │ ├── MainForm.cs │ │ └── MainForm.Designer.cs │ └── FormsDeviceCatcherMemberShare │ │ ├── Program.cs │ │ ├── FormsDeviceCatcherMemberShare.shproj │ │ ├── FormsDeviceCatcherMemberShare.projitems │ │ ├── MainForm.cs │ │ └── MainForm.Designer.cs ├── Demo .NET 4.8 │ ├── FormsDeviceCatcherEvent48 │ │ ├── App.config │ │ ├── Properties │ │ │ ├── Settings.settings │ │ │ ├── Settings.Designer.cs │ │ │ ├── AssemblyInfo.cs │ │ │ └── Resources.Designer.cs │ │ └── FormsDeviceCatcherEventk48.csproj │ ├── FormsDeviceCatcherMember48 │ │ ├── App.config │ │ ├── Properties │ │ │ ├── Settings.settings │ │ │ ├── Settings.Designer.cs │ │ │ ├── AssemblyInfo.cs │ │ │ └── Resources.Designer.cs │ │ └── FormsDeviceCatcherMember48.csproj │ ├── WpfDeviceCatcherEvent48 │ │ ├── App.config │ │ └── Properties │ │ │ ├── Settings.settings │ │ │ ├── Settings.Designer.cs │ │ │ ├── AssemblyInfo.cs │ │ │ └── Resources.Designer.cs │ ├── WpfDeviceCatcherMember48 │ │ ├── App.config │ │ └── Properties │ │ │ ├── Settings.settings │ │ │ ├── Settings.Designer.cs │ │ │ ├── AssemblyInfo.cs │ │ │ └── Resources.Designer.cs │ ├── WpfDeviceCatcherMvvm48 │ │ ├── App.config │ │ └── Properties │ │ │ ├── Settings.settings │ │ │ ├── Settings.Designer.cs │ │ │ ├── AssemblyInfo.cs │ │ │ └── Resources.Designer.cs │ ├── WpfDeviceCatcherOverride48 │ │ ├── App.config │ │ └── Properties │ │ │ ├── Settings.settings │ │ │ ├── Settings.Designer.cs │ │ │ ├── AssemblyInfo.cs │ │ │ └── Resources.Designer.cs │ └── FormsDeviceCatcherOverride48 │ │ ├── App.config │ │ ├── Properties │ │ ├── Settings.settings │ │ ├── Settings.Designer.cs │ │ ├── AssemblyInfo.cs │ │ └── Resources.Designer.cs │ │ └── FormsDeviceCatcherOverride48.csproj ├── Demo .NET 6.0 │ ├── WpfDeviceCatcherMvvm60 │ │ └── WpfDeviceCatcherMvvm60.csproj │ ├── WpfDeviceCatcherEvent60 │ │ └── WpfDeviceCatcherEvent60.csproj │ ├── WpfDeviceCatcherMember60 │ │ └── WpfDeviceCatcherMember60.csproj │ ├── WpfDeviceCatcherOverride60 │ │ └── WpfDeviceCatcherOverride60.csproj │ ├── FormsDeviceCatcherEvent60 │ │ └── FormsDeviceCatcherEvent60.csproj │ ├── FormsDeviceCatcherMember60 │ │ └── FormsDeviceCatcherMember60.csproj │ └── FormsDeviceCatcherOverride60 │ │ └── FormsDeviceCatcherOverride60.csproj ├── Demo .NET 7.0 │ ├── WpfDeviceCatcherMvvm70 │ │ └── WpfDeviceCatcherMvvm70.csproj │ ├── WpfDeviceCatcherEvent70 │ │ └── WpfDeviceCatcherEvent70.csproj │ ├── WpfDeviceCatcherMember70 │ │ └── WpfDeviceCatcherMember70.csproj │ ├── WpfDeviceCatcherOverride70 │ │ └── WpfDeviceCatcherOverride70.csproj │ ├── FormsDeviceCatcherEvent70 │ │ └── FormsDeviceCatcherEvent70.csproj │ ├── FormsDeviceCatcherMember70 │ │ └── FormsDeviceCatcherMember70.csproj │ └── FormsDeviceCatcherOverride70 │ │ └── FormsDeviceCatcherOverride70.csproj ├── Demo .NET 8.0 │ ├── WpfDeviceCatcherMvvm80 │ │ └── WpfDeviceCatcherMvvm80.csproj │ ├── WpfDeviceCatcherEvent80 │ │ └── WpfDeviceCatcherEvent80.csproj │ ├── WpfDeviceCatcherMember80 │ │ └── WpfDeviceCatcherMember80.csproj │ ├── WpfDeviceCatcherOverride80 │ │ └── WpfDeviceCatcherOverride80.csproj │ ├── FormsDeviceCatcherEvent80 │ │ └── FormsDeviceCatcherEvent80.csproj │ ├── FormsDeviceCatcherMember80 │ │ └── FormsDeviceCatcherMember80.csproj │ └── FormsDeviceCatcherOverride80 │ │ └── FormsDeviceCatcherOverride80.csproj └── Demo .NET 9.0 │ ├── WpfDeviceCatcherMvvm90 │ └── WpfDeviceCatcherMvvm90.csproj │ ├── WpfDeviceCatcherEvent90 │ └── WpfDeviceCatcherEvent90.csproj │ ├── WpfDeviceCatcherMember90 │ └── WpfDeviceCatcherMember90.csproj │ ├── WpfDeviceCatcherOverride90 │ └── WpfDeviceCatcherOverride90.csproj │ ├── FormsDeviceCatcherMember90 │ └── FormsDeviceCatcherMember90.csproj │ ├── FormsDeviceCatcherEvent90 │ └── FormsDeviceCatcherEvent90.csproj │ └── FormsDeviceCatcherOverride90 │ └── FormsDeviceCatcherOverride90.csproj ├── README.md └── LICENSE /Nuget/Pack.cmd: -------------------------------------------------------------------------------- 1 | nuget pack FormsUsbMonitor.nuspec 2 | nuget pack WpfUsbMonitor.nuspec -------------------------------------------------------------------------------- /DocFx/images/bassman.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bassman2/UsbMonitor/HEAD/DocFx/images/bassman.ico -------------------------------------------------------------------------------- /.github/images/donate.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bassman2/UsbMonitor/HEAD/.github/images/donate.gif -------------------------------------------------------------------------------- /DocFx/toc.yml: -------------------------------------------------------------------------------- 1 | - name: Forms API 2 | href: forms/ 3 | - name: WPF API 4 | href: wpf/ 5 | - name: History 6 | href: history/ -------------------------------------------------------------------------------- /Doc/WpfUsbMonitorDocumentation/icons/Help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bassman2/UsbMonitor/HEAD/Doc/WpfUsbMonitorDocumentation/icons/Help.png -------------------------------------------------------------------------------- /Src/UsbMonitorShare/IUsbMonitor.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace UsbMonitor 4 | { 5 | internal interface IUsbMonitor 6 | { } 7 | } 8 | -------------------------------------------------------------------------------- /Doc/FormsUsbMonitorDocumentation/icons/Help.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bassman2/UsbMonitor/HEAD/Doc/FormsUsbMonitorDocumentation/icons/Help.png -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherEventShare/UnknownDrive.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bassman2/UsbMonitor/HEAD/Demo/Demo Share/WpfDeviceCatcherEventShare/UnknownDrive.ico -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherMvvmShare/UnknownDrive.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bassman2/UsbMonitor/HEAD/Demo/Demo Share/WpfDeviceCatcherMvvmShare/UnknownDrive.ico -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherMemberShare/UnknownDrive.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bassman2/UsbMonitor/HEAD/Demo/Demo Share/WpfDeviceCatcherMemberShare/UnknownDrive.ico -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherOverrideShare/UnknownDrive.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Bassman2/UsbMonitor/HEAD/Demo/Demo Share/WpfDeviceCatcherOverrideShare/UnknownDrive.ico -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/FormsDeviceCatcherEvent48/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/FormsDeviceCatcherMember48/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/WpfDeviceCatcherEvent48/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/WpfDeviceCatcherMember48/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/WpfDeviceCatcherMvvm48/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/WpfDeviceCatcherOverride48/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/FormsDeviceCatcherOverride48/App.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Src/WpfUsbMonitor48/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/WpfDeviceCatcherEvent48/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/WpfDeviceCatcherMember48/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/WpfDeviceCatcherMvvm48/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/WpfDeviceCatcherOverride48/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherEventShare/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace DeviceCatcherEvent 4 | { 5 | /// 6 | /// Interaction logic for App.xaml 7 | /// 8 | public partial class App : Application 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherOverrideShare/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | 3 | namespace DeviceCatcherOverride 4 | { 5 | /// 6 | /// Interaction logic for App.xaml 7 | /// 8 | public partial class App : Application 9 | { 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/FormsDeviceCatcherEvent48/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/FormsDeviceCatcherMember48/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/FormsDeviceCatcherOverride48/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherMvvmShare/MainView.xaml.cs: -------------------------------------------------------------------------------- 1 | using UsbMonitor; 2 | 3 | namespace DeviceCatcherMvvm 4 | { 5 | /// 6 | /// Interaction logic for MainWindow.xaml 7 | /// 8 | public partial class MainWindow : UsbMonitorWindow 9 | { 10 | public MainWindow() 11 | { 12 | InitializeComponent(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherMemberShare/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace DeviceCatcherMember 10 | { 11 | /// 12 | /// Interaction logic for App.xaml 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherMvvmShare/App.xaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherMvvmShare/App.xaml.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Configuration; 4 | using System.Data; 5 | using System.Linq; 6 | using System.Threading.Tasks; 7 | using System.Windows; 8 | 9 | namespace DeviceCatcherMvvm 10 | { 11 | /// 12 | /// Interaction logic for App.xaml 13 | /// 14 | public partial class App : Application 15 | { 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherEventShare/App.xaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherMemberShare/App.xaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherOverrideShare/App.xaml: -------------------------------------------------------------------------------- 1 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Src/UsbMonitorShare/UsbVolumeFlags.cs: -------------------------------------------------------------------------------- 1 | namespace UsbMonitor 2 | { 3 | /// 4 | /// Volume flags 5 | /// 6 | public enum UsbVolumeFlags : ushort 7 | { 8 | /// 9 | /// Change affects media in drive. If not set, change affects physical device or drive. 10 | /// 11 | Media = 0x0001, 12 | 13 | /// 14 | /// Indicated logical volume is a network volume. 15 | /// 16 | Net = 0x0002 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # UsbMonitor 2 | Common repository for WpfUsbMonitor and FormsUsbMonitor 3 | 4 | # WpfUsbMonitor 5 | WPF USB Monitor to detect if a USB device is plugged in or out 6 | 7 | # FormsUsbMonitor 8 | Forms USB Monitor to detect if a USB device is plugged in or out 9 | 10 | # Documentation 11 | [Pages](https://bassman2.github.io/UsbMonitor/) 12 | 13 | ## Donate 14 | 15 | You are welcome to support this project. 16 | 17 | [![Donate](https://raw.githubusercontent.com/Bassman2/UsbMonitor/master/.github/images/donate.gif)](https://www.paypal.me/GBassman) 18 | -------------------------------------------------------------------------------- /Demo/Demo Share/FormsDeviceCatcherEventShare/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace DeviceCatcherEvent 5 | { 6 | static class Program 7 | { 8 | /// 9 | /// The main entry point for the application. 10 | /// 11 | [STAThread] 12 | static void Main() 13 | { 14 | Application.EnableVisualStyles(); 15 | Application.SetCompatibleTextRenderingDefault(false); 16 | Application.Run(new MainForm()); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Demo/Demo Share/FormsDeviceCatcherOverrideShare/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | 4 | namespace DeviceCatcherOverride 5 | { 6 | static class Program 7 | { 8 | /// 9 | /// The main entry point for the application. 10 | /// 11 | [STAThread] 12 | static void Main() 13 | { 14 | Application.EnableVisualStyles(); 15 | Application.SetCompatibleTextRenderingDefault(false); 16 | Application.Run(new MainForm()); 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherEventShare/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using UsbMonitor; 2 | 3 | namespace DeviceCatcherEvent 4 | { 5 | /// 6 | /// Interaction logic for MainWindow.xaml 7 | /// 8 | public partial class MainWindow : UsbMonitorWindow 9 | { 10 | public MainWindow() 11 | { 12 | InitializeComponent(); 13 | } 14 | 15 | private void UsbMonitorWindow_Usb(object sender, UsbEventArgs e) 16 | { 17 | this.textBox.Text += e.ToString() + "\r\n"; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Doc/WpfUsbMonitorDocumentation/ContentLayout.content: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Doc/FormsUsbMonitorDocumentation/ContentLayout.content: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /DocFx/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | _layout: landing 3 | --- 4 | 5 | ## UsbMonitor 6 | 7 | 8 | 9 | ### Getting Started 10 | 11 | To get started, add the UsbMonitor package to your project. 12 | 13 | ### Examples 14 | 15 | # [Forms](#tab/forms) 16 | 17 | Content for Forms 18 | 19 | # [WPF](#tab/wpf) 20 | 21 | Content for WPF 22 | 23 | --- 24 | 25 | ## Donate 26 | 27 | 28 | 29 | Donate 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /Demo/Demo .NET 6.0/WpfDeviceCatcherMvvm60/WpfDeviceCatcherMvvm60.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net6.0-windows 6 | true 7 | 3.3.0.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Demo/Demo .NET 7.0/WpfDeviceCatcherMvvm70/WpfDeviceCatcherMvvm70.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net7.0-windows 6 | true 7 | 3.3.0.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Demo/Demo .NET 8.0/WpfDeviceCatcherMvvm80/WpfDeviceCatcherMvvm80.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net8.0-windows 6 | true 7 | 3.3.0.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Demo/Demo .NET 6.0/WpfDeviceCatcherEvent60/WpfDeviceCatcherEvent60.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net6.0-windows 6 | true 7 | 3.3.0.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Demo/Demo .NET 7.0/WpfDeviceCatcherEvent70/WpfDeviceCatcherEvent70.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net7.0-windows 6 | true 7 | 3.3.0.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Demo/Demo .NET 8.0/WpfDeviceCatcherEvent80/WpfDeviceCatcherEvent80.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net8.0-windows 6 | true 7 | 3.3.0.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Demo/Demo .NET 9.0/WpfDeviceCatcherMvvm90/WpfDeviceCatcherMvvm90.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net9.0-windows7.0 6 | true 7 | 3.3.0.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Demo/Demo .NET 6.0/WpfDeviceCatcherMember60/WpfDeviceCatcherMember60.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net6.0-windows 6 | true 7 | 3.3.0.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Demo/Demo .NET 7.0/WpfDeviceCatcherMember70/WpfDeviceCatcherMember70.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net7.0-windows 6 | true 7 | 3.3.0.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Demo/Demo .NET 8.0/WpfDeviceCatcherMember80/WpfDeviceCatcherMember80.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net8.0-windows 6 | true 7 | 3.3.0.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Demo/Demo .NET 9.0/WpfDeviceCatcherEvent90/WpfDeviceCatcherEvent90.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net9.0-windows7.0 6 | true 7 | 3.3.0.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Demo/Demo .NET 9.0/WpfDeviceCatcherMember90/WpfDeviceCatcherMember90.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net9.0-windows7.0 6 | true 7 | 3.3.0.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Demo/Demo .NET 6.0/WpfDeviceCatcherOverride60/WpfDeviceCatcherOverride60.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net6.0-windows 6 | true 7 | 3.3.0.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Demo/Demo .NET 7.0/WpfDeviceCatcherOverride70/WpfDeviceCatcherOverride70.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net7.0-windows 6 | true 7 | 3.3.0.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Demo/Demo .NET 8.0/WpfDeviceCatcherOverride80/WpfDeviceCatcherOverride80.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net8.0-windows 6 | true 7 | 3.3.0.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Demo/Demo .NET 9.0/WpfDeviceCatcherOverride90/WpfDeviceCatcherOverride90.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net9.0-windows7.0 6 | true 7 | 3.3.0.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Demo/Demo .NET 6.0/FormsDeviceCatcherEvent60/FormsDeviceCatcherEvent60.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net6.0-windows 6 | true 7 | 3.3.0.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Demo/Demo .NET 6.0/FormsDeviceCatcherMember60/FormsDeviceCatcherMember60.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net6.0-windows 6 | true 7 | 3.3.0.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Demo/Demo .NET 7.0/FormsDeviceCatcherEvent70/FormsDeviceCatcherEvent70.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net7.0-windows 6 | true 7 | 3.3.0.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Demo/Demo .NET 7.0/FormsDeviceCatcherMember70/FormsDeviceCatcherMember70.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net7.0-windows 6 | true 7 | 3.3.0.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Demo/Demo .NET 8.0/FormsDeviceCatcherEvent80/FormsDeviceCatcherEvent80.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net8.0-windows 6 | true 7 | 3.3.0.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Demo/Demo .NET 8.0/FormsDeviceCatcherMember80/FormsDeviceCatcherMember80.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net8.0-windows 6 | true 7 | 3.3.0.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Demo/Demo .NET 9.0/FormsDeviceCatcherMember90/FormsDeviceCatcherMember90.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net9.0-windows7.0 6 | true 7 | 3.3.0.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Demo/Demo .NET 6.0/FormsDeviceCatcherOverride60/FormsDeviceCatcherOverride60.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net6.0-windows 6 | true 7 | 3.3.0.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Demo/Demo .NET 7.0/FormsDeviceCatcherOverride70/FormsDeviceCatcherOverride70.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net7.0-windows 6 | true 7 | 3.3.0.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Demo/Demo .NET 8.0/FormsDeviceCatcherOverride80/FormsDeviceCatcherOverride80.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net8.0-windows 6 | true 7 | 3.3.0.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /Demo/Demo .NET 9.0/FormsDeviceCatcherEvent90/FormsDeviceCatcherEvent90.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net9.0-windows7.0 6 | true 7 | 3.3.0.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Demo/Demo .NET 9.0/FormsDeviceCatcherOverride90/FormsDeviceCatcherOverride90.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WinExe 5 | net9.0-windows7.0 6 | true 7 | 3.3.0.0 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /DocFx/history/index.md: -------------------------------------------------------------------------------- 1 | ## Version History 2 | 3 | #### Version 3.3 was released on Dec. 24th, 2024. 4 | 5 | * Support for .NET 9.0 6 | 7 | #### Version 3.2 was released on Dec. 9th, 2023. 8 | 9 | * Support for .NET 8.0 10 | 11 | #### Version 3.1 was released on Nov. 13th, 2022. 12 | 13 | * Support for .NET 7.0 14 | 15 | #### Version 3.0 was released on Jun. 6th, 2021. 16 | 17 | * New framewoks and projects organisation 18 | 19 | #### Version 2.0 was released on Feb. 20th, 2019. 20 | 21 | * New interface (split of events) 22 | 23 | #### Version 1.0 was released on Dec. 18th, 2017. 24 | 25 | * Creation 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /Src/UsbMonitorShare/IUsbMonitorCommands.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | using System.Windows.Input; 7 | 8 | namespace UsbMonitor 9 | { 10 | internal interface IUsbMonitorCommands : IUsbMonitor 11 | { 12 | ICommand UsbOemCommand { get; set; } 13 | ICommand UsbVolumeCommand { get; set; } 14 | ICommand UsbPortCommand { get; set; } 15 | ICommand UsbDeviceInterfaceCommand { get; set; } 16 | ICommand UsbHandleCommand { get; set; } 17 | ICommand UsbChangedCommand { get; set; } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Demo/Demo Share/FormsDeviceCatcherMemberShare/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Threading.Tasks; 5 | using System.Windows.Forms; 6 | 7 | namespace DeviceCatcherMember 8 | { 9 | static class Program 10 | { 11 | /// 12 | /// The main entry point for the application. 13 | /// 14 | [STAThread] 15 | static void Main() 16 | { 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new MainForm()); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Src/UsbMonitorShare/EnumGuidAttribute.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace UsbMonitor 4 | { 5 | internal class EnumGuidAttribute : Attribute 6 | { 7 | public EnumGuidAttribute() 8 | { 9 | this.Guid = Guid.Empty; 10 | } 11 | 12 | public EnumGuidAttribute(uint a, ushort b, ushort c, byte d, byte e, byte f, byte g, byte h, byte i, byte j, byte k) 13 | { 14 | this.Guid = new Guid(a, b, c, d, e, f, g, h, i, j, k); 15 | } 16 | 17 | public EnumGuidAttribute(string guid) 18 | { 19 | this.Guid = new Guid(guid); 20 | } 21 | 22 | public Guid Guid { get; private set; } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "nuget" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "weekly" 12 | 13 | # Maintain dependencies for GitHub Actions 14 | - package-ecosystem: "github-actions" 15 | directory: "/" 16 | schedule: 17 | interval: "weekly" 18 | -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherMemberShare/MainWindow.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherOverrideShare/MainWindow.xaml: -------------------------------------------------------------------------------- 1 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /Src/UsbMonitorShare/UsbEventArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace UsbMonitor 4 | { 5 | /// 6 | /// A class for containing USB event data 7 | /// 8 | public class UsbEventArgs : EventArgs 9 | { 10 | internal UsbEventArgs(UsbDeviceChangeEvent action) 11 | { 12 | this.Action = action; 13 | } 14 | 15 | /// 16 | /// Device action 17 | /// 18 | public UsbDeviceChangeEvent Action { get; private set; } 19 | 20 | /// 21 | /// Override ToString 22 | /// 23 | /// Debug string 24 | public override string ToString() 25 | { 26 | return $"{Action}"; 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Src/WpfUsbMonitorShare/WpfUsbMonitorShare.projitems: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | true 6 | f15eb8ae-3211-40cd-a1d9-952aeda5a592 7 | 8 | 9 | WpfUsbMonitorShare 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Demo/Demo Share/FormsDeviceCatcherEventShare/MainForm.cs: -------------------------------------------------------------------------------- 1 | using UsbMonitor; 2 | 3 | 4 | namespace DeviceCatcherEvent 5 | { 6 | public partial class MainForm : UsbMonitorForm 7 | { 8 | public MainForm() 9 | { 10 | InitializeComponent(); 11 | 12 | this.UsbOem += (s, e) => { this.textBox.Text += e.ToString() + "\r\n"; }; 13 | this.UsbVolume += (s, e) => { this.textBox.Text += e.ToString() + "\r\n"; }; 14 | this.UsbPort += (s, e) => { this.textBox.Text += e.ToString() + "\r\n"; }; 15 | this.UsbDeviceInterface += (s, e) => { this.textBox.Text += e.ToString() + "\r\n"; }; 16 | this.UsbHandle += (s, e) => { this.textBox.Text += e.ToString() + "\r\n"; }; 17 | this.UsbChanged += (s, e) => { this.textBox.Text += e.ToString() + "\r\n"; }; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Src/FormsUsbMonitorShare/FormsUsbMonitorShare.projitems: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | true 6 | 2a112440-e40a-4b26-ad18-c38f502af974 7 | 8 | 9 | FormsUsbMonitorShare 10 | 11 | 12 | 13 | Form 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /Src/UsbMonitorShare/IUsbMonitorOverrides.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Text; 5 | using System.Threading.Tasks; 6 | 7 | namespace UsbMonitor 8 | { 9 | internal interface IUsbMonitorOverrides : IUsbMonitor 10 | { 11 | /// 12 | /// Override to handle USB interface notification. 13 | /// 14 | /// Update arguments 15 | void OnUsbOem(UsbEventOemArgs args); 16 | 17 | void OnUsbVolume(UsbEventVolumeArgs args); 18 | 19 | void OnUsbPort(UsbEventPortArgs args); 20 | 21 | void OnUsbInterface(UsbEventDeviceInterfaceArgs args); 22 | 23 | void OnUsbHandle(UsbEventHandleArgs args); 24 | 25 | /// 26 | /// Override to handle USB changed notification. 27 | /// 28 | void OnUsbChanged(UsbEventArgs args); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Src/UsbMonitorShare/IUsbMonitorEvents.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace UsbMonitor 4 | { 5 | interface IUsbMonitorEvents : IUsbMonitor 6 | { 7 | event EventHandler UsbOem; 8 | 9 | event EventHandler UsbVolume; 10 | 11 | event EventHandler UsbPort; 12 | 13 | event EventHandler UsbDeviceInterface; 14 | 15 | event EventHandler UsbHandle; 16 | 17 | event EventHandler UsbChanged; 18 | 19 | void CallUsbOem(object sender, UsbEventOemArgs args); 20 | void CallUsbVolumem(object sender, UsbEventVolumeArgs args); 21 | void CallUsbPort(object sender, UsbEventPortArgs args); 22 | void CallUsbDeviceInterface(object sender, UsbEventDeviceInterfaceArgs args); 23 | void CallUsbHandle(object sender, UsbEventHandleArgs args); 24 | void CallUsbChanged(object sender, UsbEventArgs args); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherMemberShare/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using System.Windows; 2 | using UsbMonitor; 3 | 4 | namespace DeviceCatcherMember 5 | { 6 | /// 7 | /// Interaction logic for MainWindow.xaml 8 | /// 9 | public partial class MainWindow : Window 10 | { 11 | private UsbMonitorManager usbMonitor; 12 | 13 | public MainWindow() 14 | { 15 | InitializeComponent(); 16 | this.usbMonitor = new UsbMonitorManager(this); 17 | this.usbMonitor.UsbOem += OnUsb; 18 | this.usbMonitor.UsbVolume += OnUsb; 19 | this.usbMonitor.UsbPort += OnUsb; 20 | this.usbMonitor.UsbDeviceInterface += OnUsb; 21 | this.usbMonitor.UsbHandle += OnUsb; 22 | this.usbMonitor.UsbChanged += OnUsb; 23 | } 24 | 25 | private void OnUsb(object sender, UsbEventArgs e) 26 | { 27 | this.textBox.Text += e.ToString() + "\r\n"; 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherEventShare/MainWindow.xaml: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Src/UsbMonitorShare/UsbMonitorShare.shproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | bd41be34-5d22-458e-b6c3-a9d76fb8a0e4 5 | 14.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Src/UsbMonitorShare/UsbDeviceType.cs: -------------------------------------------------------------------------------- 1 | namespace UsbMonitor 2 | { 3 | /// 4 | /// Device type 5 | /// 6 | public enum UsbDeviceType : uint 7 | { 8 | /// 9 | /// OEM- or IHV-defined device type. This structure is a DEV_BROADCAST_OEM structure. 10 | /// 11 | OEM = 0x00000000, 12 | 13 | /// 14 | /// Logical volume. This structure is a DEV_BROADCAST_VOLUME structure. 15 | /// 16 | Volume = 0x00000002, 17 | 18 | /// 19 | /// Port device (serial or parallel). This structure is a DEV_BROADCAST_PORT structure. 20 | /// 21 | Port = 0x00000003, 22 | 23 | /// 24 | /// Class of devices. This structure is a DEV_BROADCAST_DEVICEINTERFACE structure. 25 | /// 26 | DeviceInterface = 0x00000005, 27 | 28 | /// 29 | /// File system handle. This structure is a DEV_BROADCAST_HANDLE structure. 30 | /// 31 | Handle = 0x00000006, 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Src/WpfUsbMonitorShare/WpfUsbMonitorShare.shproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | f15eb8ae-3211-40cd-a1d9-952aeda5a592 5 | 14.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Src/FormsUsbMonitorShare/FormsUsbMonitorShare.shproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 2a112440-e40a-4b26-ad18-c38f502af974 5 | 14.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 Ralf Beckers 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherEventShare/WpfDeviceCatcherEventShare.shproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | e8eaf939-ab22-4a59-af89-44a085d3e4bc 5 | 14.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherMvvmShare/WpfDeviceCatcherMvvmShare.shproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | f53b6083-86ca-4e52-b354-af9aabd490f9 5 | 14.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherMemberShare/WpfDeviceCatcherMemberShare.shproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 96a1429b-adb1-4b99-960a-2e2ed1c38fdc 5 | 14.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Demo/Demo Share/FormsDeviceCatcherEventShare/FormsDeviceCatcherEventShare.shproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | e0967e4d-eb0c-4415-a37d-7fd9a997ac12 5 | 14.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Demo/Demo Share/FormsDeviceCatcherMemberShare/FormsDeviceCatcherMemberShare.shproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | da0aca86-056e-4140-9991-e9a33117fc1f 5 | 14.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherMvvmShare/MainView.xaml: -------------------------------------------------------------------------------- 1 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherOverrideShare/WpfDeviceCatcherOverrideShare.shproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 60bfc070-30c5-4fe8-b80e-9206db3136d7 5 | 14.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Demo/Demo Share/FormsDeviceCatcherOverrideShare/FormsDeviceCatcherOverrideShare.shproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | bcd3505c-ca92-4b95-9e52-9b1e3da83ccf 5 | 14.0 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /Src/WpfUsbMonitor60/WpfUsbMonitor60.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0-windows7.0 5 | true 6 | UsbMonitor 7 | WpfUsbMonitor 8 | 3.3.0.0 9 | true 10 | Bassman.snk 11 | Ralf Beckers 12 | WPF implementation of a USB monitor to signal if a USB device is plugged in or out. 13 | Copyright © 2017 - 2023 by Ralf Beckers 14 | MIT 15 | https://github.com/Bassman2/UsbMonitor 16 | https://github.com/Bassman2/UsbMonitor 17 | Github 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Demo/Demo Share/FormsDeviceCatcherEventShare/FormsDeviceCatcherEventShare.projitems: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | true 6 | e0967e4d-eb0c-4415-a37d-7fd9a997ac12 7 | 8 | 9 | FormsDeviceCatcherEventShare 10 | 11 | 12 | 13 | 14 | MainForm.cs 15 | 16 | 17 | 18 | 19 | 20 | MainForm.cs 21 | 22 | 23 | -------------------------------------------------------------------------------- /Demo/Demo Share/FormsDeviceCatcherOverrideShare/FormsDeviceCatcherOverrideShare.projitems: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | true 6 | bcd3505c-ca92-4b95-9e52-9b1e3da83ccf 7 | 8 | 9 | FormsDeviceCatcherOverrideShare 10 | 11 | 12 | 13 | 14 | MainForm.cs 15 | 16 | 17 | 18 | 19 | 20 | MainForm.cs 21 | 22 | 23 | -------------------------------------------------------------------------------- /Src/FormsUsbMonitor60/FormsUsbMonitor60.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net6.0-windows7.0 5 | true 6 | UsbMonitor 7 | FormsUsbMonitor 8 | 3.3.0.0 9 | true 10 | Bassman.snk 11 | Ralf Beckers 12 | Forms implementation of a USB monitor to signal if a USB device is plugged in or out. 13 | Copyright © 2017 - 2023 by Ralf Beckers 14 | MIT 15 | https://github.com/Bassman2/UsbMonitor 16 | https://github.com/Bassman2/UsbMonitor 17 | Github 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Src/WpfUsbMonitor48/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace UsbMonitor.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Src/WpfUsbMonitorShare/UsbMonitorManager.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows; 3 | using System.Windows.Interop; 4 | 5 | namespace UsbMonitor 6 | { 7 | /// 8 | /// USB Monitor class to notify if the USB content changes 9 | /// 10 | public partial class UsbMonitorManager : IUsbMonitorEvents 11 | { 12 | 13 | /// 14 | /// Constructor 15 | /// 16 | /// Main window of the application. 17 | /// Enable USB notification on startup or not. 18 | public UsbMonitorManager(Window window, bool start = true) 19 | { 20 | this.windowHandle = new WindowInteropHelper(window).EnsureHandle(); 21 | HwndSource.FromHwnd(this.windowHandle)?.AddHook(HwndHandler); 22 | if (start) 23 | { 24 | Start(); 25 | } 26 | } 27 | 28 | private IntPtr HwndHandler(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam, ref bool handled) 29 | { 30 | DeviceChangeManager.HwndHandler(this, hwnd, msg, wparam, lparam); 31 | return IntPtr.Zero; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Demo/Demo Share/FormsDeviceCatcherMemberShare/FormsDeviceCatcherMemberShare.projitems: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | true 6 | da0aca86-056e-4140-9991-e9a33117fc1f 7 | 8 | 9 | FormsDeviceCatcherMemberShare 10 | 11 | 12 | 13 | Form 14 | 15 | 16 | MainForm.cs 17 | 18 | 19 | 20 | 21 | 22 | MainForm.cs 23 | 24 | 25 | -------------------------------------------------------------------------------- /Src/UsbMonitorShare/UsbEventPortArgs.cs: -------------------------------------------------------------------------------- 1 | namespace UsbMonitor 2 | { 3 | /// 4 | /// Port notification arguments 5 | /// 6 | public class UsbEventPortArgs : UsbEventArgs 7 | { 8 | /// 9 | /// Constructor 10 | /// 11 | /// 12 | /// 13 | internal UsbEventPortArgs(UsbDeviceChangeEvent action, string name) : base(action) 14 | { 15 | this.Name = name; 16 | } 17 | 18 | /// 19 | /// Specifying the friendly name of the port or the device connected to the port. 20 | /// Friendly names are intended to help the user quickly and accurately identify the device 21 | /// for example, "COM1" and "Standard 28800 bps Modem" are considered friendly names. 22 | /// 23 | public string Name { get; private set; } 24 | 25 | /// 26 | /// Converts arguments to readable string 27 | /// 28 | /// String 29 | public override string ToString() 30 | { 31 | return $"{Action} Port: Name={Name}"; 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Src/WpfUsbMonitor70/WpfUsbMonitor70.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net7.0-windows7.0 5 | true 6 | UsbMonitor 7 | WpfUsbMonitor 8 | 3.3.0.0 9 | true 10 | Bassman.snk 11 | Ralf Beckers 12 | WPF implementation of a USB monitor to signal if a USB device is plugged in or out. 13 | Copyright © 2017 - 2023 by Ralf Beckers 14 | MIT 15 | https://github.com/Bassman2/UsbMonitor 16 | https://github.com/Bassman2/UsbMonitor 17 | Github 18 | True 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Src/WpfUsbMonitor80/WpfUsbMonitor80.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0-windows7.0 5 | true 6 | UsbMonitor 7 | WpfUsbMonitor 8 | 3.3.0.0 9 | true 10 | Bassman.snk 11 | Ralf Beckers 12 | WPF implementation of a USB monitor to signal if a USB device is plugged in or out. 13 | Copyright © 2017 - 2023 by Ralf Beckers 14 | MIT 15 | https://github.com/Bassman2/UsbMonitor 16 | https://github.com/Bassman2/UsbMonitor 17 | Github 18 | True 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Src/WpfUsbMonitor90/WpfUsbMonitor90.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0-windows7.0 5 | true 6 | UsbMonitor 7 | WpfUsbMonitor 8 | 3.3.0.0 9 | true 10 | Bassman.snk 11 | Ralf Beckers 12 | WPF implementation of a USB monitor to signal if a USB device is plugged in or out. 13 | Copyright © 2017 - 2023 by Ralf Beckers 14 | MIT 15 | https://github.com/Bassman2/UsbMonitor 16 | https://github.com/Bassman2/UsbMonitor 17 | Github 18 | True 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/WpfDeviceCatcherEvent48/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace WpfDeviceCatcherEventFramework45.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/WpfDeviceCatcherMember48/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace WpfDeviceCatcherMemberFramework45.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/WpfDeviceCatcherMvvm48/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace WpfDeviceCatcherMvvmFramework45.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/FormsDeviceCatcherEvent48/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace FormsDeviceCatcherEventFramework45.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/FormsDeviceCatcherMember48/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace FormsDeviceCatcherMemberFramework45.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/WpfDeviceCatcherOverride48/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace WpfDeviceCatcherOverrideFramework45.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/FormsDeviceCatcherOverride48/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace FormsDeviceCatcherOverrideFramework45.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /DocFx/docfx.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://raw.githubusercontent.com/dotnet/docfx/main/schemas/docfx.schema.json", 3 | "metadata": [ 4 | { 5 | "src": [ 6 | { 7 | "src": "../Src/FormsUsbMonitor90", 8 | "files": [ "**/*.csproj" ] 9 | } 10 | ], 11 | "dest": "forms", 12 | "globalNamespaceId": "Forms" 13 | }, 14 | { 15 | "src": [ 16 | { 17 | "src": "../Src/WpfUsbMonitor90", 18 | "files": [ "**/*.csproj" ] 19 | } 20 | ], 21 | "dest": "wpf", 22 | "globalNamespaceId": "Wpf" 23 | } 24 | ], 25 | "build": { 26 | "content": [ 27 | { 28 | "files": [ "**/*.{md,yml}" ] 29 | } 30 | ], 31 | "resource": [ 32 | { 33 | "files": [ "images/**" ] 34 | } 35 | ], 36 | "output": "../docs", 37 | "template": [ 38 | "default", 39 | "modern" 40 | ], 41 | "globalMetadata": { 42 | "_appLogoPath": "images/bassman.svg", 43 | "_appFaviconPath": "images/bassman.ico", 44 | "_appName": "UsbMonitor", 45 | "_appTitle": "UsbMonitor", 46 | "_appFooter": "Copyright 2025 © by Ralf Beckers", 47 | "_enableSearch": true, 48 | "pdf": false 49 | } 50 | } 51 | } -------------------------------------------------------------------------------- /Demo/Demo Share/FormsDeviceCatcherMemberShare/MainForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Forms; 3 | using UsbMonitor; 4 | 5 | 6 | namespace DeviceCatcherMember 7 | { 8 | public partial class MainForm : Form 9 | { 10 | private UsbMonitorManager usbMonitor; 11 | 12 | public MainForm() 13 | { 14 | InitializeComponent(); 15 | 16 | this.usbMonitor = new UsbMonitorManager(this); 17 | this.usbMonitor.UsbOem += OnUsb; 18 | this.usbMonitor.UsbVolume += OnUsb; 19 | this.usbMonitor.UsbPort += OnUsb; 20 | this.usbMonitor.UsbDeviceInterface += OnUsb; 21 | this.usbMonitor.UsbHandle += OnUsb; 22 | this.usbMonitor.UsbChanged += OnUsb; 23 | } 24 | 25 | private void OnUsb(object sender, UsbEventArgs e) 26 | { 27 | this.textBox.Text += e.ToString() + "\r\n"; 28 | } 29 | 30 | #if NETFRAMEWORK 31 | [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")] 32 | #endif 33 | protected override void WndProc(ref Message m) 34 | { 35 | this.usbMonitor?.HwndHandler(ref m); 36 | base.WndProc(ref m); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /.github/workflows/codeql.yml: -------------------------------------------------------------------------------- 1 | name: CodeQL 2 | 3 | on: 4 | push: 5 | branches: [main, ] 6 | pull_request: 7 | branches: [main] 8 | schedule: 9 | - cron: '0 23 * * 6' 10 | 11 | jobs: 12 | analyze: 13 | name: Analyze 14 | runs-on: windows-2022 15 | environment: sign 16 | env: 17 | Solution: UsbMonitor.slnx 18 | 19 | steps: 20 | - name: Checkout 21 | uses: actions/checkout@v6 22 | 23 | - name: Add msbuild to PATH 24 | uses: microsoft/setup-msbuild@v2 25 | 26 | - name: Setup NuGet 27 | uses: nuget/setup-nuget@v2 28 | 29 | - name: Initialize CodeQL 30 | uses: github/codeql-action/init@v4 31 | 32 | - name: Add SignKeys 33 | uses: Bassman2/SignKey@v1 34 | with: 35 | file: Bassman.snk 36 | key: ${{ secrets.SIGNKEY }} 37 | 38 | - name: Install SHFB 39 | uses: Bassman2/setup-SHFB@v1 40 | 41 | # - name: Nuget restore dependencies 42 | # run: nuget restore $env:Solution 43 | 44 | - name: Dotnet restore dependencies 45 | run: dotnet restore $env:Solution 46 | 47 | - name: MSBuild of solution 48 | run: msbuild $env:Solution /p:configuration="Release" /m /verbosity:minimal 49 | 50 | - name: Perform CodeQL Analysis 51 | uses: github/codeql-action/analyze@v4 52 | -------------------------------------------------------------------------------- /Src/UsbMonitorShare/UsbEventOemArgs.cs: -------------------------------------------------------------------------------- 1 | namespace UsbMonitor 2 | { 3 | 4 | /// 5 | /// OEM notification arguments 6 | /// 7 | public class UsbEventOemArgs : UsbEventArgs 8 | { 9 | /// 10 | /// Constructor 11 | /// 12 | /// 13 | /// 14 | /// 15 | internal UsbEventOemArgs(UsbDeviceChangeEvent action, uint identifier, uint suppFunc) : base(action) 16 | { 17 | this.Identifier = identifier; 18 | this.SuppFunc = suppFunc; 19 | } 20 | 21 | /// 22 | /// The OEM-specific identifier for the device. 23 | /// 24 | public uint Identifier { get; private set; } 25 | 26 | /// 27 | /// The OEM-specific function value. Possible values depend on the device. 28 | /// 29 | public uint SuppFunc { get; private set; } 30 | 31 | /// 32 | /// Converts arguments to readable string 33 | /// 34 | /// String 35 | public override string ToString() 36 | { 37 | return $"{Action} OEM: Identifier={Identifier} SuppFunc={SuppFunc}"; 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherOverrideShare/MainWindow.xaml.cs: -------------------------------------------------------------------------------- 1 | using UsbMonitor; 2 | 3 | namespace DeviceCatcherOverride 4 | { 5 | /// 6 | /// Interaction logic for MainWindow.xaml 7 | /// 8 | public partial class MainWindow : UsbMonitorWindow 9 | { 10 | public MainWindow() 11 | { 12 | InitializeComponent(); 13 | } 14 | 15 | public override void OnUsbOem(UsbEventOemArgs args) 16 | { 17 | this.textBox.Text += args.ToString() + "\r\n"; 18 | } 19 | 20 | public override void OnUsbVolume(UsbEventVolumeArgs args) 21 | { 22 | this.textBox.Text += args.ToString() + "\r\n"; 23 | } 24 | 25 | public override void OnUsbPort(UsbEventPortArgs args) 26 | { 27 | this.textBox.Text += args.ToString() + "\r\n"; 28 | } 29 | 30 | public override void OnUsbInterface(UsbEventDeviceInterfaceArgs args) 31 | { 32 | this.textBox.Text += args.ToString() + "\r\n"; 33 | } 34 | 35 | public override void OnUsbHandle(UsbEventHandleArgs args) 36 | { 37 | this.textBox.Text += args.ToString() + "\r\n"; 38 | } 39 | 40 | public override void OnUsbChanged(UsbEventArgs args) 41 | { 42 | this.textBox.Text += args.ToString() + "\r\n"; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Src/FormsUsbMonitor70/FormsUsbMonitor70.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net7.0-windows7.0 5 | true 6 | UsbMonitor 7 | FormsUsbMonitor 8 | 3.3.0.0 9 | true 10 | Bassman.snk 11 | Ralf Beckers 12 | Forms implementation of a USB monitor to signal if a USB device is plugged in or out. 13 | Copyright © 2017 - 2023 by Ralf Beckers 14 | MIT 15 | https://github.com/Bassman2/UsbMonitor 16 | https://github.com/Bassman2/UsbMonitor 17 | Github 18 | False 19 | 7.0 20 | True 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Src/FormsUsbMonitor80/FormsUsbMonitor80.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0-windows7.0 5 | true 6 | UsbMonitor 7 | FormsUsbMonitor 8 | 3.3.0.0 9 | true 10 | Bassman.snk 11 | Ralf Beckers 12 | Forms implementation of a USB monitor to signal if a USB device is plugged in or out. 13 | Copyright © 2017 - 2023 by Ralf Beckers 14 | MIT 15 | https://github.com/Bassman2/UsbMonitor 16 | https://github.com/Bassman2/UsbMonitor 17 | Github 18 | False 19 | 7.0 20 | True 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Src/FormsUsbMonitor90/FormsUsbMonitor90.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net9.0-windows7.0 5 | true 6 | UsbMonitor 7 | FormsUsbMonitor 8 | 3.3.0.0 9 | true 10 | Bassman.snk 11 | Ralf Beckers 12 | Forms implementation of a USB monitor to signal if a USB device is plugged in or out. 13 | Copyright © 2017 - 2023 by Ralf Beckers 14 | MIT 15 | https://github.com/Bassman2/UsbMonitor 16 | https://github.com/Bassman2/UsbMonitor 17 | Github 18 | False 19 | 7.0 20 | True 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /Demo/Demo Share/FormsDeviceCatcherOverrideShare/MainForm.cs: -------------------------------------------------------------------------------- 1 | using UsbMonitor; 2 | 3 | namespace DeviceCatcherOverride 4 | { 5 | public partial class MainForm : UsbMonitorForm 6 | { 7 | public MainForm() 8 | { 9 | InitializeComponent(); 10 | } 11 | 12 | public override void OnUsbOem(UsbEventOemArgs args) 13 | { 14 | this.textBox.Text += args.ToString() + "\r\n"; 15 | } 16 | 17 | public override void OnUsbVolume(UsbEventVolumeArgs args) 18 | { 19 | this.textBox.Text += args.ToString() + "\r\n"; 20 | } 21 | 22 | public override void OnUsbPort(UsbEventPortArgs args) 23 | { 24 | this.textBox.Text += args.ToString() + "\r\n"; 25 | } 26 | 27 | public override void OnUsbInterface(UsbEventDeviceInterfaceArgs args) 28 | { 29 | this.textBox.Text += args.ToString() + "\r\n"; 30 | } 31 | 32 | public override void OnUsbHandle(UsbEventHandleArgs args) 33 | { 34 | this.textBox.Text += args.ToString() + "\r\n"; 35 | } 36 | 37 | /// 38 | /// Override to handle USB changed notification. 39 | /// 40 | public override void OnUsbChanged(UsbEventArgs args) 41 | { 42 | this.textBox.Text += args.ToString() + "\r\n"; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /.github/workflows/docfx.yml: -------------------------------------------------------------------------------- 1 | name: DocFx 2 | 3 | # Your GitHub workflow file under .github/workflows/ 4 | # Trigger the action on push to main 5 | on: 6 | push: 7 | branches: 8 | - main 9 | 10 | # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages 11 | permissions: 12 | actions: read 13 | pages: write 14 | id-token: write 15 | 16 | # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. 17 | # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. 18 | concurrency: 19 | group: "pages" 20 | cancel-in-progress: false 21 | 22 | jobs: 23 | publish-docs: 24 | environment: 25 | name: github-pages 26 | url: ${{ steps.deployment.outputs.page_url }} 27 | runs-on: windows-latest 28 | steps: 29 | 30 | - name: Checkout Main 31 | uses: actions/checkout@v6 32 | 33 | - name: Dotnet Setup 34 | uses: actions/setup-dotnet@v5 35 | with: 36 | dotnet-version: 9.x 37 | 38 | - name: Add SignKeys 39 | uses: Bassman2/SignKey@v1 40 | with: 41 | file: Bassman.snk 42 | key: ${{ secrets.SIGNKEY }} 43 | 44 | - run: dotnet tool update -g docfx 45 | - run: docfx DocFx/docfx.json 46 | 47 | - name: Upload artifact 48 | uses: actions/upload-pages-artifact@v4 49 | with: 50 | path: 'docs' 51 | 52 | - name: Deploy to GitHub Pages 53 | id: deployment 54 | uses: actions/deploy-pages@v4 -------------------------------------------------------------------------------- /Src/FormsUsbMonitorShare/UsbMonitorManager.cs: -------------------------------------------------------------------------------- 1 | using System.Windows.Forms; 2 | 3 | namespace UsbMonitor 4 | { 5 | /// 6 | /// USB Monitor class to notify if the USB content changes 7 | /// 8 | public partial class UsbMonitorManager : IUsbMonitorEvents //, IMessageFilter 9 | { 10 | /// 11 | /// Constructor 12 | /// 13 | /// Main form of the application. 14 | /// Enable USB notification on startup or not. 15 | public UsbMonitorManager(Form form, bool start = true) 16 | { 17 | this.windowHandle = form.Handle; 18 | // AddMessageFilter does not work for WM_DEVICECHANGE 19 | //Application.AddMessageFilter(this); 20 | if (start) 21 | { 22 | Start(); 23 | } 24 | } 25 | 26 | //public bool PreFilterMessage(ref Message m) 27 | //{ 28 | // if (m.HWnd == this.windowHandle) 29 | // { 30 | // DeviceChangeManager.HwndHandler(this, m.HWnd, m.Msg, m.WParam, m.LParam); 31 | // } 32 | // return false; 33 | //} 34 | 35 | /// 36 | /// Message handler 37 | /// 38 | /// Message parameter 39 | public void HwndHandler(ref Message m) 40 | { 41 | DeviceChangeManager.HwndHandler(this, m.HWnd, m.Msg, m.WParam, m.LParam); 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /.github/workflows/build.yml: -------------------------------------------------------------------------------- 1 | name: Continuous Integration 2 | 3 | on: 4 | push: 5 | branches: [main,] 6 | pull_request: 7 | branches: [main] 8 | 9 | jobs: 10 | build: 11 | name: Build 12 | runs-on: windows-2022 13 | environment: sign 14 | env: 15 | Solution: UsbMonitor.slnx 16 | NugetWpf: WpfUsbMonitor.nuspec 17 | NugetFrm: FormsUsbMonitor.nuspec 18 | strategy: 19 | fail-fast: false 20 | matrix: 21 | build_configuration: [Release, Debug] 22 | 23 | steps: 24 | - name: Checkout 25 | uses: actions/checkout@v6 26 | 27 | - name: Add msbuild to PATH 28 | uses: microsoft/setup-msbuild@v2 29 | 30 | - name: Setup NuGet 31 | uses: nuget/setup-nuget@v2 32 | 33 | - name: Add SignKeys 34 | uses: Bassman2/SignKey@v1 35 | with: 36 | file: Bassman.snk 37 | key: ${{ secrets.SIGNKEY }} 38 | 39 | - name: Install SHFB 40 | uses: Bassman2/setup-SHFB@v1 41 | 42 | # - name: Nuget restore dependencies 43 | # run: nuget restore $env:Solution 44 | 45 | - name: Dotnet restore dependencies 46 | run: dotnet restore $env:Solution 47 | 48 | - name: MSBuild of solution 49 | run: msbuild $env:Solution /p:configuration="${{ matrix.build_configuration }}" /m /verbosity:minimal 50 | 51 | - name: Nuget pack nuspec 52 | if: matrix.build_configuration == 'Release' 53 | working-directory: .\Nuget\ 54 | run: | 55 | nuget pack $env:NugetWpf -properties Configuration=Release 56 | nuget pack $env:NugetFrm -properties Configuration=Release -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/FormsDeviceCatcherEvent48/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("FormsDeviceCatcherEventFramework45")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("FormsDeviceCatcherEventFramework45")] 13 | [assembly: AssemblyCopyright("Copyright © 2021")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("08dc8b4d-9990-49cb-8999-e74d103cbdfe")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("3.3.0.0")] 36 | [assembly: AssemblyFileVersion("3.3.0.0")] 37 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/FormsDeviceCatcherMember48/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("FormsDeviceCatcherMemberFramework45")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("FormsDeviceCatcherMemberFramework45")] 13 | [assembly: AssemblyCopyright("Copyright © 2021")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("a6778443-0808-4607-86cc-c6e5e41893f4")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("3.3.0.0")] 36 | [assembly: AssemblyFileVersion("3.3.0.0")] 37 | -------------------------------------------------------------------------------- /Src/UsbMonitorShare/UsbDeviceChangeEvent.cs: -------------------------------------------------------------------------------- 1 | namespace UsbMonitor 2 | { 3 | /// 4 | /// Device action 5 | /// 6 | public enum UsbDeviceChangeEvent : uint 7 | { 8 | /// 9 | /// A device or piece of media has been inserted and is now available. 10 | /// 11 | /// DBT_DEVICEARRIVAL 12 | Arrival = 0x8000, 13 | 14 | /// 15 | /// Permission is requested to remove a device or piece of media. Any application can deny this request and cancel the removal. 16 | /// 17 | /// DBT_DEVICEQUERYREMOVE 18 | QueryRemove = 0x8001, 19 | 20 | /// 21 | /// A request to remove a device or piece of media has been canceled. 22 | /// 23 | /// DBT_DEVICEQUERYREMOVEFAILED 24 | QueryRemoveFailed = 0x8002, 25 | 26 | /// 27 | /// A device or piece of media is about to be removed. Cannot be denied. 28 | /// 29 | /// DBT_DEVICEREMOVEPENDING 30 | RemovePending = 0x8003, 31 | 32 | /// 33 | /// A device or piece of media has been removed. 34 | /// 35 | /// DBT_DEVICEREMOVECOMPLETE 36 | RemoveComplete = 0x8004, 37 | 38 | /// 39 | /// A device has been added to or removed from the system. 40 | /// 41 | ///DBT_DEVNODES_CHANGED 42 | Changed = 0x0007 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/FormsDeviceCatcherOverride48/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("FormsDeviceCatcherOverrideFramework45")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("FormsDeviceCatcherOverrideFramework45")] 13 | [assembly: AssemblyCopyright("Copyright © 2021")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("496acf30-26a9-4779-90fd-8d9a9b2501eb")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("3.3.0.0")] 36 | [assembly: AssemblyFileVersion("3.3.0.0")] 37 | -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherEventShare/WpfDeviceCatcherEventShare.projitems: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | true 6 | e8eaf939-ab22-4a59-af89-44a085d3e4bc 7 | 8 | 9 | WpfDeviceCatcherEventShare 10 | 11 | 12 | 13 | App.xaml 14 | 15 | 16 | MainWindow.xaml 17 | 18 | 19 | 20 | 21 | $(DefaultXamlRuntime) 22 | MSBuild:Compile 23 | Designer 24 | 25 | 26 | 27 | 28 | $(DefaultXamlRuntime) 29 | MSBuild:Compile 30 | Designer 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherMemberShare/WpfDeviceCatcherMemberShare.projitems: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | true 6 | 96a1429b-adb1-4b99-960a-2e2ed1c38fdc 7 | 8 | 9 | WpfDeviceCatcherMemberShare 10 | 11 | 12 | 13 | App.xaml 14 | 15 | 16 | MainWindow.xaml 17 | 18 | 19 | 20 | 21 | $(DefaultXamlRuntime) 22 | MSBuild:Compile 23 | Designer 24 | 25 | 26 | 27 | 28 | $(DefaultXamlRuntime) 29 | MSBuild:Compile 30 | Designer 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherOverrideShare/WpfDeviceCatcherOverrideShare.projitems: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | true 6 | 60bfc070-30c5-4fe8-b80e-9206db3136d7 7 | 8 | 9 | WpfDeviceCatcherOverrideShare 10 | 11 | 12 | 13 | App.xaml 14 | 15 | 16 | MainWindow.xaml 17 | 18 | 19 | 20 | 21 | $(DefaultXamlRuntime) 22 | MSBuild:Compile 23 | Designer 24 | 25 | 26 | 27 | 28 | $(DefaultXamlRuntime) 29 | MSBuild:Compile 30 | Designer 31 | 32 | 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /Src/FormsUsbMonitor48/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("FormsUsbMonitor")] 9 | [assembly: AssemblyDescription("Forms implementation of a USB monitor to signal if a USB device is plugged in or out.")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("Ralf Beckers")] 12 | [assembly: AssemblyProduct("FormsUsbMonitor")] 13 | [assembly: AssemblyCopyright("Copyright © 2017 - 2021 by Ralf Beckers")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("a1529179-ba0e-4ad8-9f89-3ec007aea44e")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("3.3.0.0")] 36 | [assembly: AssemblyFileVersion("3.3.0.0")] 37 | -------------------------------------------------------------------------------- /Src/UsbMonitorShare/UsbEventDeviceInterfaceArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace UsbMonitor 4 | { 5 | /// 6 | /// Interface notification arguments 7 | /// 8 | public class UsbEventDeviceInterfaceArgs : UsbEventArgs 9 | { 10 | /// 11 | /// Constructor 12 | /// 13 | /// 14 | /// 15 | /// 16 | /// 17 | internal UsbEventDeviceInterfaceArgs(UsbDeviceChangeEvent action, Guid classGuid, UsbDeviceInterface deviceInterface, string name) : base(action) 18 | { 19 | this.ClassGuid = classGuid; 20 | this.DeviceInterface = deviceInterface; 21 | this.Name = name; 22 | } 23 | 24 | /// 25 | /// GUID of the interface class 26 | /// 27 | public Guid ClassGuid { get; private set; } 28 | 29 | /// 30 | /// Interface type 31 | /// 32 | public UsbDeviceInterface DeviceInterface { get; private set; } 33 | 34 | /// 35 | /// Name od the interface 36 | /// 37 | public string Name { get; private set; } 38 | 39 | /// 40 | /// Converts arguments to readable string 41 | /// 42 | /// String 43 | public override string ToString() 44 | { 45 | return $"{Action} DeviceInterface: ClassGuid={ClassGuid} DeviceInterface={DeviceInterface} Name ={Name}"; 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherMvvmShare/WpfDeviceCatcherMvvmShare.projitems: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | true 6 | f53b6083-86ca-4e52-b354-af9aabd490f9 7 | 8 | 9 | WpfDeviceCatcherMvvmShare 10 | 11 | 12 | 13 | App.xaml 14 | 15 | 16 | 17 | MainView.xaml 18 | 19 | 20 | 21 | 22 | 23 | $(DefaultXamlRuntime) 24 | MSBuild:Compile 25 | Designer 26 | 27 | 28 | 29 | 30 | $(DefaultXamlRuntime) 31 | MSBuild:Compile 32 | Designer 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Src/UsbMonitorShare/UsbMonitorShare.projitems: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $(MSBuildAllProjects);$(MSBuildThisFileFullPath) 5 | true 6 | bd41be34-5d22-458e-b6c3-a9d76fb8a0e4 7 | 8 | 9 | UsbMonitorShare 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /Doc/FormsUsbMonitorDocumentation/Content/Welcome.aml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Forms USB Monitor is written in pure Forms. It can be used in a lot of different ways. It does not use any WPF library. For WPF please use 7 | 8 | WPFUsbMonitor 9 | https://www.nuget.org/packages/WPFUsbMonitor/ 10 | 11 | . 12 | 13 | 14 |
15 | Example: USB Monitor as member 16 | 17 | The UsbMonitorManager class can be used as a member of your main form. 18 | 19 | 20 |
21 | 22 |
23 | Example: USB Monitor as Form derived class with event 24 | 25 | The UsbMonitorForm class can be used as the base of your MainForm with event handling. 26 | 27 | 28 |
29 | 30 |
31 | Example: USB Monitor as Form derived class with method override 32 | 33 | The UsbMonitorForm class can be used as the base of your MainForm with a overwritten method. 34 | 35 | 36 |
37 | 38 | 39 | 40 | 41 |
42 |
43 | -------------------------------------------------------------------------------- /Src/UsbMonitorShare/UsbEventVolumeArgs.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | namespace UsbMonitor 4 | { 5 | /// 6 | /// Volume notification arguments 7 | /// 8 | public class UsbEventVolumeArgs : UsbEventArgs 9 | { 10 | /// 11 | /// Constructor 12 | /// 13 | /// 14 | /// 15 | /// 16 | /// 17 | internal UsbEventVolumeArgs(UsbDeviceChangeEvent action, uint unitmask, ushort flags, char[] drives) : base(action) 18 | { 19 | this.UnitMask = unitmask; 20 | this.Flags = (UsbVolumeFlags)flags; 21 | this.Drives = drives; 22 | } 23 | 24 | /// 25 | /// The logical unit mask identifying one or more logical units. 26 | /// Each bit in the mask corresponds to one logical drive. 27 | /// Bit 0 represents drive A, bit 1 represents drive B, and so on. 28 | /// 29 | public uint UnitMask { get; private set; } 30 | 31 | /// 32 | /// This parameter can be one of the following values. 33 | /// Media: Change affects media in drive. If not set, change affects physical device or drive. 34 | /// Net: Indicated logical volume is a network volume. 35 | /// 36 | public UsbVolumeFlags Flags { get; private set; } 37 | 38 | /// 39 | /// Array of drive letters, build from UnitMask. 40 | /// 41 | public char[] Drives { get; private set; } 42 | 43 | /// 44 | /// Converts arguments to readable string 45 | /// 46 | /// String 47 | public override string ToString() 48 | { 49 | string drives = Drives.Select(d => $"{d}:").Aggregate((a, b) => $"{a}, {b}"); 50 | return $"{Action} Volume: UnitMask=0x{UnitMask:X} Flags={Flags} Drives={drives}"; 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /Doc/FormsUsbMonitorDocumentation/Content/VersionHistory/VersionHistory.aml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | The topics in this section describe the various changes made to the Forms USB Monitor over the life of the project. 6 | 7 | 8 |
9 | Version 3.3 was released on Dec. 24th, 2024. 10 | 11 | 12 | 13 | Support for .NET 9.0 14 | 15 | 16 | 17 |
18 | 19 |
20 | Version 3.2 was released on Dec. 9th, 2023. 21 | 22 | 23 | 24 | Support for .NET 8.0 25 | 26 | 27 | 28 |
29 | 30 |
31 | Version 3.1 was released on Nov. 13th, 2022. 32 | 33 | 34 | 35 | Support for .NET 7.0 36 | 37 | 38 | 39 |
40 | 41 |
42 | Version 3.0 was released on Jun. 6th, 2021. 43 | 44 | 45 | 46 | New framewoks and projects organisation 47 | 48 | 49 | 50 |
51 | 52 |
53 | Version 2.0 was released on Feb. 20th, 2019. 54 | 55 | 56 | 57 | New interface (split of events) 58 | 59 | 60 | 61 |
62 | 63 | 64 | 65 | 66 | 67 |
68 |
69 | -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherMvvmShare/MainViewModel.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel; 3 | using System.Windows.Threading; 4 | using UsbMonitor; 5 | 6 | namespace DeviceCatcherMvvm 7 | { 8 | public class MainViewModel : INotifyPropertyChanged 9 | { 10 | private string text; 11 | 12 | public DelegateCommand UsbCommand { get; private set; } 13 | 14 | public MainViewModel() 15 | { 16 | this.UsbCommand = new DelegateCommand(OnUsb, OnCanUsb); 17 | } 18 | 19 | public void OnUsb(UsbEventArgs args) 20 | { 21 | this.Text += args.ToString() + "\r\n"; 22 | } 23 | 24 | public bool OnCanUsb(UsbEventArgs args) 25 | { 26 | return true; 27 | } 28 | 29 | public string Text 30 | { 31 | get 32 | { 33 | return this.text; 34 | } 35 | set 36 | { 37 | this.text = value; 38 | NotifyPropertyChanged(nameof(Text)); 39 | } 40 | } 41 | 42 | #region INotifyPropertyChanged 43 | 44 | public event PropertyChangedEventHandler PropertyChanged; 45 | 46 | private delegate void NotifyPropertyChangedDeleagte(string propertyName); 47 | 48 | public virtual void NotifyPropertyChanged(string propertyName) 49 | { 50 | if (string.IsNullOrEmpty(propertyName)) 51 | { 52 | throw new ArgumentNullException(nameof(propertyName)); 53 | } 54 | if (GetType().GetProperty(propertyName) == null) 55 | { 56 | throw new ArgumentOutOfRangeException(nameof(propertyName), $"No property with name {propertyName} exists."); 57 | } 58 | 59 | if (Dispatcher.CurrentDispatcher.CheckAccess()) 60 | { 61 | PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); 62 | } 63 | else 64 | { 65 | Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.DataBind, new NotifyPropertyChangedDeleagte(NotifyPropertyChanged), propertyName); 66 | } 67 | } 68 | 69 | #endregion 70 | } 71 | } 72 | -------------------------------------------------------------------------------- /Src/UsbMonitorShare/UsbEventHandleArgs.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | 4 | namespace UsbMonitor 5 | { 6 | /// 7 | /// Handle notification arguments 8 | /// 9 | public class UsbEventHandleArgs : UsbEventArgs 10 | { 11 | /// 12 | /// Constructor 13 | /// 14 | /// 15 | /// 16 | /// 17 | /// 18 | /// 19 | /// 20 | internal UsbEventHandleArgs(UsbDeviceChangeEvent action, IntPtr handle, IntPtr devNotify, Guid eventGuid, ulong nameOffset, byte[] data) : base(action) 21 | { 22 | this.Handle = handle; 23 | this.DevNotify = devNotify; 24 | this.EventGuid = eventGuid; 25 | this.NameOffset = nameOffset; 26 | this.Data = data; 27 | } 28 | 29 | /// 30 | /// A handle to the device to be checked. 31 | /// 32 | public IntPtr Handle { get; private set; } 33 | 34 | /// 35 | /// A handle to the device notification. 36 | /// 37 | public IntPtr DevNotify { get; private set; } 38 | 39 | /// 40 | /// The GUID for the custom event. 41 | /// 42 | public Guid EventGuid { get; private set; } 43 | 44 | /// 45 | /// The offset of an optional string buffer. 46 | /// 47 | public ulong NameOffset { get; private set; } 48 | 49 | /// 50 | /// Optional binary data. 51 | /// 52 | public byte[] Data { get; private set; } 53 | 54 | /// 55 | /// Converts arguments to readable string 56 | /// 57 | /// String 58 | public override string ToString() 59 | { 60 | string data = Data.Select(d => $"0x{d:X}").Aggregate((a, b) => $"{a}, {b}"); 61 | return $"{Action} Handle: Handle={Handle} DevNotify={DevNotify} EventGuid={EventGuid} NameOffset={NameOffset} Data={data}"; 62 | } 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /Demo/Demo Share/FormsDeviceCatcherEventShare/MainForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace DeviceCatcherEvent 2 | { 3 | partial class MainForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.textBox = new System.Windows.Forms.TextBox(); 32 | this.SuspendLayout(); 33 | // 34 | // textBox 35 | // 36 | this.textBox.AcceptsReturn = true; 37 | this.textBox.AcceptsTab = true; 38 | this.textBox.Dock = System.Windows.Forms.DockStyle.Fill; 39 | this.textBox.Location = new System.Drawing.Point(0, 0); 40 | this.textBox.Multiline = true; 41 | this.textBox.Name = "textBox"; 42 | this.textBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; 43 | this.textBox.Size = new System.Drawing.Size(800, 450); 44 | this.textBox.TabIndex = 0; 45 | // 46 | // Form1 47 | // 48 | this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 25F); 49 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 50 | this.ClientSize = new System.Drawing.Size(800, 450); 51 | this.Controls.Add(this.textBox); 52 | this.Name = "MainForm"; 53 | this.Text = "Device Catcher Member"; 54 | this.ResumeLayout(false); 55 | 56 | } 57 | 58 | #endregion 59 | 60 | private System.Windows.Forms.TextBox textBox; 61 | } 62 | } 63 | 64 | -------------------------------------------------------------------------------- /Demo/Demo Share/FormsDeviceCatcherMemberShare/MainForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace DeviceCatcherMember 2 | { 3 | partial class MainForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.textBox = new System.Windows.Forms.TextBox(); 32 | this.SuspendLayout(); 33 | // 34 | // textBox 35 | // 36 | this.textBox.AcceptsReturn = true; 37 | this.textBox.AcceptsTab = true; 38 | this.textBox.Dock = System.Windows.Forms.DockStyle.Fill; 39 | this.textBox.Location = new System.Drawing.Point(0, 0); 40 | this.textBox.Multiline = true; 41 | this.textBox.Name = "textBox"; 42 | this.textBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; 43 | this.textBox.Size = new System.Drawing.Size(800, 450); 44 | this.textBox.TabIndex = 0; 45 | // 46 | // MainForm 47 | // 48 | this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 25F); 49 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 50 | this.ClientSize = new System.Drawing.Size(800, 450); 51 | this.Controls.Add(this.textBox); 52 | this.Name = "MainForm"; 53 | this.Text = "Device Catcher Member"; 54 | this.ResumeLayout(false); 55 | 56 | } 57 | 58 | #endregion 59 | 60 | private System.Windows.Forms.TextBox textBox; 61 | } 62 | } 63 | 64 | -------------------------------------------------------------------------------- /Demo/Demo Share/FormsDeviceCatcherOverrideShare/MainForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace DeviceCatcherOverride 2 | { 3 | partial class MainForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.textBox = new System.Windows.Forms.TextBox(); 32 | this.SuspendLayout(); 33 | // 34 | // textBox 35 | // 36 | this.textBox.AcceptsReturn = true; 37 | this.textBox.AcceptsTab = true; 38 | this.textBox.Dock = System.Windows.Forms.DockStyle.Fill; 39 | this.textBox.Location = new System.Drawing.Point(0, 0); 40 | this.textBox.Multiline = true; 41 | this.textBox.Name = "textBox"; 42 | this.textBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; 43 | this.textBox.Size = new System.Drawing.Size(800, 450); 44 | this.textBox.TabIndex = 0; 45 | // 46 | // Form1 47 | // 48 | this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 25F); 49 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 50 | this.ClientSize = new System.Drawing.Size(800, 450); 51 | this.Controls.Add(this.textBox); 52 | this.Name = "MainForm"; 53 | this.Text = "Device Catcher Override"; 54 | this.ResumeLayout(false); 55 | 56 | } 57 | 58 | #endregion 59 | 60 | private System.Windows.Forms.TextBox textBox; 61 | } 62 | } 63 | 64 | -------------------------------------------------------------------------------- /Doc/WpfUsbMonitorDocumentation/Content/VersionHistory/VersionHistory.aml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | The topics in this section describe the various changes made to the WPF USB Monitor over the life of the project. 6 | 7 | 8 |
9 | Version 3.3 was released on Dec. 24th, 2024. 10 | 11 | 12 | 13 | Support for .NET 9.0 14 | 15 | 16 | 17 |
18 | 19 |
20 | Version 3.2 was released on Dec. 9th, 2023. 21 | 22 | 23 | 24 | Support for .NET 8.0 25 | 26 | 27 | 28 |
29 | 30 |
31 | Version 3.1 was released on Nov. 13th, 2022. 32 | 33 | 34 | 35 | Support for .NET 7.0 36 | 37 | 38 | 39 |
40 | 41 |
42 | Version 3.0 was released on Jun. 6th, 2021. 43 | 44 | 45 | 46 | New framewoks and projects organisation 47 | 48 | 49 | 50 |
51 | 52 |
53 | Version 2.0 was released on Feb. 20th, 2019. 54 | 55 | 56 | 57 | New interface (split of events) 58 | 59 | 60 | 61 |
62 | 63 |
64 | Version 1.0 was released on Dec. 18th, 2017. 65 | 66 | 67 | 68 | Creation 69 | 70 | 71 | 72 |
73 | 74 | 75 | 76 | 77 | 78 |
79 |
80 | -------------------------------------------------------------------------------- /Nuget/FormsUsbMonitor.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | FormsUsbMonitor 5 | 3.3.0 6 | FormsUsbMonitor 7 | Ralf Beckers 8 | Ralf Beckers 9 | false 10 | MIT 11 | https://licenses.nuget.org/MIT 12 | https://github.com/Bassman2/UsbMonitor 13 | Forms implementation of a USB monitor to signal if a USB device is plugged in or out. Documentation included. 14 | .NET 9 added 15 | Copyright © 2017 - 2024 by Ralf Beckers 16 | 17 | Forms USB Monitor 18 | docs\README.md 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/WpfDeviceCatcherMvvm48/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | [assembly: AssemblyTitle("WpfDeviceCatcherMvvmFramework45")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("")] 14 | [assembly: AssemblyProduct("WpfDeviceCatcherMvvmFramework45")] 15 | [assembly: AssemblyCopyright("Copyright © 2021")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // Setting ComVisible to false makes the types in this assembly not visible 20 | // to COM components. If you need to access a type in this assembly from 21 | // COM, set the ComVisible attribute to true on that type. 22 | [assembly: ComVisible(false)] 23 | 24 | //In order to begin building localizable applications, set 25 | //CultureYouAreCodingWith in your .csproj file 26 | //inside a . For example, if you are using US english 27 | //in your source files, set the to en-US. Then uncomment 28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 29 | //the line below to match the UICulture setting in the project file. 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly: ThemeInfo( 35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 36 | //(used if a resource is not found in the page, 37 | // or application resource dictionaries) 38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 39 | //(used if a resource is not found in the page, 40 | // app, or any theme specific resource dictionaries) 41 | )] 42 | 43 | 44 | // Version information for an assembly consists of the following four values: 45 | // 46 | // Major Version 47 | // Minor Version 48 | // Build Number 49 | // Revision 50 | // 51 | // You can specify all the values or you can default the Build and Revision Numbers 52 | // by using the '*' as shown below: 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("3.3.0.0")] 55 | [assembly: AssemblyFileVersion("3.3.0.0")] 56 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/WpfDeviceCatcherEvent48/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | [assembly: AssemblyTitle("WpfDeviceCatcherEventFramework45")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("")] 14 | [assembly: AssemblyProduct("WpfDeviceCatcherEventFramework45")] 15 | [assembly: AssemblyCopyright("Copyright © 2021")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // Setting ComVisible to false makes the types in this assembly not visible 20 | // to COM components. If you need to access a type in this assembly from 21 | // COM, set the ComVisible attribute to true on that type. 22 | [assembly: ComVisible(false)] 23 | 24 | //In order to begin building localizable applications, set 25 | //CultureYouAreCodingWith in your .csproj file 26 | //inside a . For example, if you are using US english 27 | //in your source files, set the to en-US. Then uncomment 28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 29 | //the line below to match the UICulture setting in the project file. 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly: ThemeInfo( 35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 36 | //(used if a resource is not found in the page, 37 | // or application resource dictionaries) 38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 39 | //(used if a resource is not found in the page, 40 | // app, or any theme specific resource dictionaries) 41 | )] 42 | 43 | 44 | // Version information for an assembly consists of the following four values: 45 | // 46 | // Major Version 47 | // Minor Version 48 | // Build Number 49 | // Revision 50 | // 51 | // You can specify all the values or you can default the Build and Revision Numbers 52 | // by using the '*' as shown below: 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("3.3.0.0")] 55 | [assembly: AssemblyFileVersion("3.3.0.0")] 56 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/WpfDeviceCatcherMember48/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | [assembly: AssemblyTitle("WpfDeviceCatcherMemberFramework45")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("")] 14 | [assembly: AssemblyProduct("WpfDeviceCatcherMemberFramework45")] 15 | [assembly: AssemblyCopyright("Copyright © 2021")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // Setting ComVisible to false makes the types in this assembly not visible 20 | // to COM components. If you need to access a type in this assembly from 21 | // COM, set the ComVisible attribute to true on that type. 22 | [assembly: ComVisible(false)] 23 | 24 | //In order to begin building localizable applications, set 25 | //CultureYouAreCodingWith in your .csproj file 26 | //inside a . For example, if you are using US english 27 | //in your source files, set the to en-US. Then uncomment 28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 29 | //the line below to match the UICulture setting in the project file. 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly: ThemeInfo( 35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 36 | //(used if a resource is not found in the page, 37 | // or application resource dictionaries) 38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 39 | //(used if a resource is not found in the page, 40 | // app, or any theme specific resource dictionaries) 41 | )] 42 | 43 | 44 | // Version information for an assembly consists of the following four values: 45 | // 46 | // Major Version 47 | // Minor Version 48 | // Build Number 49 | // Revision 50 | // 51 | // You can specify all the values or you can default the Build and Revision Numbers 52 | // by using the '*' as shown below: 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("3.3.0.0")] 55 | [assembly: AssemblyFileVersion("3.3.0.0")] 56 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/WpfDeviceCatcherOverride48/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | // General Information about an assembly is controlled through the following 8 | // set of attributes. Change these attribute values to modify the information 9 | // associated with an assembly. 10 | [assembly: AssemblyTitle("WpfDeviceCatcherOverrideFramework45")] 11 | [assembly: AssemblyDescription("")] 12 | [assembly: AssemblyConfiguration("")] 13 | [assembly: AssemblyCompany("")] 14 | [assembly: AssemblyProduct("WpfDeviceCatcherOverrideFramework45")] 15 | [assembly: AssemblyCopyright("Copyright © 2021")] 16 | [assembly: AssemblyTrademark("")] 17 | [assembly: AssemblyCulture("")] 18 | 19 | // Setting ComVisible to false makes the types in this assembly not visible 20 | // to COM components. If you need to access a type in this assembly from 21 | // COM, set the ComVisible attribute to true on that type. 22 | [assembly: ComVisible(false)] 23 | 24 | //In order to begin building localizable applications, set 25 | //CultureYouAreCodingWith in your .csproj file 26 | //inside a . For example, if you are using US english 27 | //in your source files, set the to en-US. Then uncomment 28 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 29 | //the line below to match the UICulture setting in the project file. 30 | 31 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 32 | 33 | 34 | [assembly: ThemeInfo( 35 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 36 | //(used if a resource is not found in the page, 37 | // or application resource dictionaries) 38 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 39 | //(used if a resource is not found in the page, 40 | // app, or any theme specific resource dictionaries) 41 | )] 42 | 43 | 44 | // Version information for an assembly consists of the following four values: 45 | // 46 | // Major Version 47 | // Minor Version 48 | // Build Number 49 | // Revision 50 | // 51 | // You can specify all the values or you can default the Build and Revision Numbers 52 | // by using the '*' as shown below: 53 | // [assembly: AssemblyVersion("1.0.*")] 54 | [assembly: AssemblyVersion("3.3.0.0")] 55 | [assembly: AssemblyFileVersion("3.3.0.0")] 56 | -------------------------------------------------------------------------------- /Src/WpfUsbMonitor48/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Resources; 3 | using System.Runtime.CompilerServices; 4 | using System.Runtime.InteropServices; 5 | using System.Windows; 6 | 7 | //[assembly: XmlnsDefinition("http://schemas.microsoft.com/winfx/2006/xaml/presentation", "UsbMonitor")] 8 | 9 | // General Information about an assembly is controlled through the following 10 | // set of attributes. Change these attribute values to modify the information 11 | // associated with an assembly. 12 | [assembly: AssemblyTitle("WpfUsbMonitor")] 13 | [assembly: AssemblyDescription("WPF implementation of a USB monitor to signal if a USB device is plugged in or out.")] 14 | [assembly: AssemblyConfiguration("")] 15 | [assembly: AssemblyCompany("Ralf Beckers")] 16 | [assembly: AssemblyProduct("WpfUsbMonitor")] 17 | [assembly: AssemblyCopyright("Copyright © 2017 - 2021 by Ralf Beckers")] 18 | [assembly: AssemblyTrademark("")] 19 | [assembly: AssemblyCulture("")] 20 | 21 | // Setting ComVisible to false makes the types in this assembly not visible 22 | // to COM components. If you need to access a type in this assembly from 23 | // COM, set the ComVisible attribute to true on that type. 24 | [assembly: ComVisible(false)] 25 | 26 | //In order to begin building localizable applications, set 27 | //CultureYouAreCodingWith in your .csproj file 28 | //inside a . For example, if you are using US english 29 | //in your source files, set the to en-US. Then uncomment 30 | //the NeutralResourceLanguage attribute below. Update the "en-US" in 31 | //the line below to match the UICulture setting in the project file. 32 | 33 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] 34 | 35 | 36 | [assembly:ThemeInfo( 37 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located 38 | //(used if a resource is not found in the page, 39 | // or application resource dictionaries) 40 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located 41 | //(used if a resource is not found in the page, 42 | // app, or any theme specific resource dictionaries) 43 | )] 44 | 45 | 46 | // Version information for an assembly consists of the following four values: 47 | // 48 | // Major Version 49 | // Minor Version 50 | // Build Number 51 | // Revision 52 | // 53 | // You can specify all the values or you can default the Build and Revision Numbers 54 | // by using the '*' as shown below: 55 | // [assembly: AssemblyVersion("1.0.*")] 56 | [assembly: AssemblyVersion("3.3.0.0")] 57 | [assembly: AssemblyFileVersion("3.3.0.0")] 58 | -------------------------------------------------------------------------------- /Doc/WpfUsbMonitorDocumentation/Content/Welcome.aml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | WPF USB Monitor is written in pure WPF. It can be used in a lot of different ways. It does not use any Forms library. For Forms please use 7 | 8 | FormsUsbMonitor 9 | https://www.nuget.org/packages/FormsUsbMonitor/ 10 | 11 | . 12 | 13 | 14 |
15 | Example: USB Monitor as member 16 | 17 | The UsbMonitorManager class can be used as a member of your main window. 18 | 19 | 20 |
21 | 22 |
23 | Example: USB Monitor as window derived class with event 24 | 25 | The UsbMonitorWindow class can be used as the base of your MainWindow with event handling. 26 | 27 | 28 | 29 |
30 | 31 |
32 | Example: USB Monitor as window derived class with method override 33 | 34 | The UsbMonitorWindow class can be used as the base of your MainWindow with a overwritten method. 35 | 36 | 37 | 38 |
39 | 40 |
41 | Example: USB Monitor as window derived class in a MVVM environment 42 | 43 | The UsbMonitorWindow class can be used as the base of your MainWindow with a command for MVVM architecture. 44 | 45 | 46 | 47 |
48 | 49 | 50 | 51 | 52 |
53 |
54 | -------------------------------------------------------------------------------- /Src/FormsUsbMonitor48/FormsUsbMonitor48.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {A1529179-BA0E-4AD8-9F89-3EC007AEA44E} 8 | Library 9 | UsbMonitor 10 | FormsUsbMonitor 11 | v4.8 12 | 512 13 | true 14 | 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | true 35 | 36 | 37 | Bassman.snk 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /Src/WpfUsbMonitor48/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace UsbMonitor.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("UsbMonitor.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/WpfDeviceCatcherEvent48/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace WpfDeviceCatcherEventFramework45.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WpfDeviceCatcherEventFramework45.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/WpfDeviceCatcherMvvm48/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace WpfDeviceCatcherMvvmFramework45.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WpfDeviceCatcherMvvmFramework45.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/WpfDeviceCatcherMember48/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace WpfDeviceCatcherMemberFramework45.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WpfDeviceCatcherMemberFramework45.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/FormsDeviceCatcherEvent48/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace FormsDeviceCatcherEventFramework45.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("FormsDeviceCatcherEventFramework45.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/FormsDeviceCatcherMember48/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace FormsDeviceCatcherMemberFramework45.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("FormsDeviceCatcherMemberFramework45.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/WpfDeviceCatcherOverride48/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace WpfDeviceCatcherOverrideFramework45.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WpfDeviceCatcherOverrideFramework45.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/FormsDeviceCatcherOverride48/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.42000 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace FormsDeviceCatcherOverrideFramework45.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("FormsDeviceCatcherOverrideFramework45.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Nuget/WpfUsbMonitor.nuspec: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | WpfUsbMonitor 5 | 3.3.0 6 | WpfUsbMonitor 7 | Ralf Beckers 8 | Ralf Beckers 9 | false 10 | MIT 11 | https://licenses.nuget.org/MIT 12 | https://github.com/Bassman2/UsbMonitor 13 | WPF implementation of a USB monitor to signal if a USB device is plugged in or out. This implementation if Forms free and can also be used by MVVM. Documentation included. 14 | .NET 9 added 15 | Copyright © 2017 - 2024 by Ralf Beckers 16 | 17 | WPF USB Monitor MVVM 18 | docs\README.md 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /DocFx/images/bassman.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | Double Bass (38×38) 4 | Compact realistic-styled double-bass mark optimized for 38×38 pixels. 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 34 | 35 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | -------------------------------------------------------------------------------- /Demo/Demo Share/WpfDeviceCatcherMvvmShare/DelegateCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Windows.Input; 3 | 4 | namespace DeviceCatcherMvvm 5 | { 6 | /// 7 | /// This class allows delegating the commanding logic to methods passed as parameters, 8 | /// and enables a View to bind commands to objects that are not part of the element tree. 9 | /// 10 | public class DelegateCommand : ICommand 11 | { 12 | private readonly Action execute = null; 13 | private readonly Func canExecute = null; 14 | 15 | /// 16 | /// Constructor 17 | /// 18 | public DelegateCommand(Action execute, Func canExecute = null) 19 | { 20 | if (execute == null) 21 | { 22 | throw new ArgumentNullException("execute"); 23 | } 24 | 25 | this.execute = execute; 26 | this.canExecute = canExecute ?? new Func(() => true); 27 | } 28 | 29 | /// 30 | /// Method to determine if the command can be executed 31 | /// 32 | public bool CanExecute(object param) 33 | { 34 | return this.canExecute(); 35 | } 36 | 37 | /// 38 | /// Execution of the command 39 | /// 40 | public void Execute(object param) 41 | { 42 | this.execute(); 43 | } 44 | 45 | /// 46 | /// ICommand.CanExecuteChanged implementation 47 | /// 48 | public event EventHandler CanExecuteChanged 49 | { 50 | add 51 | { 52 | CommandManager.RequerySuggested += value; 53 | } 54 | remove 55 | { 56 | CommandManager.RequerySuggested -= value; 57 | } 58 | } 59 | } 60 | 61 | public class DelegateCommand : ICommand 62 | { 63 | private readonly Action execute; 64 | private readonly Func canExecute; 65 | 66 | /// 67 | /// Constructor 68 | /// 69 | public DelegateCommand(Action execute, Func canExecuteMethod = null) 70 | { 71 | if (execute == null) 72 | { 73 | throw new ArgumentNullException("execute"); 74 | } 75 | 76 | this.execute = execute; 77 | this.canExecute = canExecute ?? new Func(t => true); 78 | } 79 | 80 | /// 81 | /// Method to determine if the command can be executed 82 | /// 83 | public bool CanExecute(object parameter) 84 | { 85 | return this.canExecute((T)parameter); 86 | } 87 | 88 | /// 89 | /// Execution of the command 90 | /// 91 | public void Execute(object parameter) 92 | { 93 | this.execute((T)parameter); 94 | } 95 | 96 | /// 97 | /// ICommand.CanExecuteChanged implementation 98 | /// 99 | public event EventHandler CanExecuteChanged 100 | { 101 | add 102 | { 103 | CommandManager.RequerySuggested += value; 104 | } 105 | remove 106 | { 107 | CommandManager.RequerySuggested -= value; 108 | } 109 | } 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/FormsDeviceCatcherEvent48/FormsDeviceCatcherEventk48.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {08DC8B4D-9990-49CB-8999-E74D103CBDFE} 8 | WinExe 9 | FormsDeviceCatcherEventFramework45 10 | FormsDeviceCatcherEventFramework45 11 | v4.8 12 | 512 13 | true 14 | 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | ResXFileCodeGenerator 52 | Resources.Designer.cs 53 | Designer 54 | 55 | 56 | True 57 | Resources.resx 58 | True 59 | 60 | 61 | SettingsSingleFileGenerator 62 | Settings.Designer.cs 63 | 64 | 65 | True 66 | Settings.settings 67 | True 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | {a1529179-ba0e-4ad8-9f89-3ec007aea44e} 76 | FormsUsbMonitor48 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/FormsDeviceCatcherMember48/FormsDeviceCatcherMember48.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {A6778443-0808-4607-86CC-C6E5E41893F4} 8 | WinExe 9 | FormsDeviceCatcherMemberFramework45 10 | FormsDeviceCatcherMemberFramework45 11 | v4.8 12 | 512 13 | true 14 | 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | ResXFileCodeGenerator 52 | Resources.Designer.cs 53 | Designer 54 | 55 | 56 | True 57 | Resources.resx 58 | True 59 | 60 | 61 | SettingsSingleFileGenerator 62 | Settings.Designer.cs 63 | 64 | 65 | True 66 | Settings.settings 67 | True 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | {a1529179-ba0e-4ad8-9f89-3ec007aea44e} 76 | FormsUsbMonitor48 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /Demo/Demo .NET 4.8/FormsDeviceCatcherOverride48/FormsDeviceCatcherOverride48.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {496ACF30-26A9-4779-90FD-8D9A9B2501EB} 8 | WinExe 9 | FormsDeviceCatcherOverrideFramework45 10 | FormsDeviceCatcherOverrideFramework45 11 | v4.8 12 | 512 13 | true 14 | 15 | 16 | 17 | AnyCPU 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | AnyCPU 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | ResXFileCodeGenerator 52 | Resources.Designer.cs 53 | Designer 54 | 55 | 56 | True 57 | Resources.resx 58 | True 59 | 60 | 61 | SettingsSingleFileGenerator 62 | Settings.Designer.cs 63 | 64 | 65 | True 66 | Settings.settings 67 | True 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | {a1529179-ba0e-4ad8-9f89-3ec007aea44e} 76 | FormsUsbMonitor48 77 | 78 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /Src/WpfUsbMonitor48/WpfUsbMonitor48.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Debug 6 | AnyCPU 7 | {494A3E91-10E0-4F20-A0FC-77F0CE01E576} 8 | library 9 | UsbMonitor 10 | WpfUsbMonitor 11 | v4.8 12 | 512 13 | {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 14 | 4 15 | true 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | true 37 | 38 | 39 | Bassman.snk 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 4.0 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | Code 60 | 61 | 62 | True 63 | True 64 | Resources.resx 65 | 66 | 67 | True 68 | Settings.settings 69 | True 70 | 71 | 72 | ResXFileCodeGenerator 73 | Resources.Designer.cs 74 | 75 | 76 | 77 | SettingsSingleFileGenerator 78 | Settings.Designer.cs 79 | 80 | 81 | 82 | 83 | 84 | --------------------------------------------------------------------------------