0 Replies Latest reply on Feb 15, 2018 3:01 AM by Johannes Kamani

    Execute code before going in suspend using device event WorkaboutPro .net

    Johannes Kamani

      Hello,

       

      I'm creating a .netcf application for Workabout Pro 4. Because of special hardware attached to the device, I have to react on a "Suspend" and "Resume" event of the device.

      Via the software SDKs included device .dll "PsionTeklogixNet" library, I can get some events, but the "Suspend" event seams to be not fast enough

       

      PsionTeklogix.Power.PowerManagement PowerManager = new PsionTeklogix.Power.PowerManagement();           private void PowerEvent(object sender, PsionTeklogix.Power.PowerTransitionEventArgs e) {         PsionTeklogix.Power.PowerTransitionEventArgs p = e;                  lock(thislock){              switch (p.State) {                  case PowerStates.Suspend:                      oReader.UnLoadUSB(MyConnection);                      break;                  case PowerStates.Resume:                      oReader.ReLoadUSB(MyConnection);                      break;              }           }     }

       

      So when i press the power button on the device, the handheld goes to suspend mode and stops working. When the device is resumed, first an event  with "Resume" state fires, afterward the event with "Suspend" state fires.

       

      How can I execute code, making sure it's done before the device goes in suspend mode?