protected override void OnDisabled(DisabledEventArgs e) { ifKit.SensorChange -= SensorChange; if (!e.IsConfiguring) { PhidgetManager.Release <InterfaceKit>(ref ifKit); } }
protected override void OnEnabling(EnablingEventArgs e) { if (!e.WasConfiguring) { try { ifKit = PhidgetManager.Get <InterfaceKit>(); } catch (InvalidOperationException) { ErrorLog.AddError(ErrorType.Failure, "The Phidget interface kit is not attached"); e.Cancel = true; return; } } ifKit.SensorChange += SensorChange; }