Показаны различия между двумя версиями страницы.
— |
axapta:таймербезформы [2018/04/13 22:43] (текущий) |
||
---|---|---|---|
Строка 1: | Строка 1: | ||
+ | есть два варианта: | ||
+ | * использование нитей (потоков), | ||
+ | * использование Класс/ | ||
+ | ---- | ||
+ | Hi | ||
+ | |||
+ | It only works in 3.0. You could make a class with the following | ||
+ | methods, | ||
+ | and start the class by calling yourclassname.startCheck. You would | ||
+ | probably have to do something about the hardcoded 1000 in the | ||
+ | method | ||
+ | doCheck. | ||
+ | <code XPP> | ||
+ | class yourclassname | ||
+ | { | ||
+ | Int timeOutHandle; | ||
+ | } | ||
+ | |||
+ | |||
+ | private void addTimeOut(int _time = 60*60*1000) | ||
+ | { | ||
+ | ; | ||
+ | timeOutHandle = infolog.addTimeOut(this, | ||
+ | methodstr(yourclassname, | ||
+ | doCheck), _time, false); | ||
+ | } | ||
+ | |||
+ | |||
+ | void startCheck(int time = 1000) | ||
+ | { | ||
+ | ; | ||
+ | infolog.globalCache().set(classstr(yourclassname), | ||
+ | classstr(yourclassname), | ||
+ | this.addTimeOut(time); | ||
+ | } | ||
+ | |||
+ | |||
+ | void doCheck() | ||
+ | { | ||
+ | ; | ||
+ | try | ||
+ | { | ||
+ | // do your thang | ||
+ | } | ||
+ | |||
+ | catch(Exception:: | ||
+ | { | ||
+ | this.stopCheck(); | ||
+ | } | ||
+ | |||
+ | this.addTimeOut(1000); | ||
+ | } | ||
+ | |||
+ | |||
+ | void stopCheck() | ||
+ | { | ||
+ | ; | ||
+ | infolog.globalCache().remove(classstr(yourclassname), | ||
+ | classstr(yourclassname)); | ||
+ | infolog.removeTimeOut(timeOutHandle); | ||
+ | } | ||
+ | |||
+ | </ | ||
+ | Regards | ||
+ | Jan Stelsig Dahlsgaard | ||
+ | Fujitsu DK | ||
+ | ---- | ||
+ | |||
+ | |||
+ | ---- | ||
+ | [[: |