Sub admin_StateChanged (NewState As Int, OldState As Int)
If (IsPaused(Main) = False Or IsPaused(Parameters) = False Or IsPaused(calibration)=False) And (NewState = admin.STATE_OFF) Then
Common.connected = False
Log ("Off")
Service.StopForeground(0)
CallSub(another,"Finish")
End If
End Sub