public VolumeWatcher() { #if PLATFORM_MACOSX _helper = new VolumeWatcherHelper(this); #elif PLATFORM_WINDOWS _detector = new DriveDetector(); _detector.DeviceArrived += delegate(object sender, DriveDetectorEventArgs e) { if (e.Drive == _hookeddrive) e.HookQueryRemove = true; ev_VolumeChanged(VolumeWatcherEvent.DidMount, e.Drive); }; _detector.DeviceRemoved += delegate(object sender, DriveDetectorEventArgs e) { ev_VolumeChanged(VolumeWatcherEvent.DidUnmount, e.Drive); }; _detector.QueryRemove += delegate(object sender, DriveDetectorEventArgs e) { // QueryRemove only gets fired if the device is "hooked" (see // DriveDetector for explanation) and only one drive can be hooked // at a time. may need to fix if this event is needed. ev_VolumeChanged(VolumeWatcherEvent.WillUnmount, e.Drive); }; #else throw new NotSupportedException(); #endif }
public VolumeWatcher() { _helper = new VolumeWatcherHelper(this); }