예제 #1
0
 protected override void OnDisabled(DisabledEventArgs e)
 {
     ifKit.SensorChange -= SensorChange;
     if (!e.IsConfiguring)
     {
         PhidgetManager.Release <InterfaceKit>(ref ifKit);
     }
 }
예제 #2
0
 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;
 }