private void EventHandler_Network_ConfigurationChanged( object sender, ConfigurationChangedEventArgs e) { switch (e.Action) { case ConfigurationChangedAction.DeviceAdded: { if (e.Device != null) { e.Device.StatusChanged += EventHandler_Device_StatusChanged; e.Device.PropertyChanged += EventHandler_Device_PropertyChanged; e.Device.ErrorOccurred += EventHandler_Device_ErrorOccurred; } break; } case ConfigurationChangedAction.DeviceRemoved: { if (e.Device != null) { e.Device.StatusChanged -= EventHandler_Device_StatusChanged; e.Device.PropertyChanged -= EventHandler_Device_PropertyChanged; e.Device.ErrorOccurred -= EventHandler_Device_ErrorOccurred; } break; } default: { throw new NotImplementedException(); } } }
private void OnConfigurationChanged(ConfigurationChangedEventArgs args) { if (args == null) { throw new ArgumentNullException(); } if (ConfigurationChanged != null) { ConfigurationChanged(this, args); } }