I am to have such a requirement, the circulation perform two operations, these two operations is a timer timer, is a thread, need is to cycle through the two operations, should how to write this way? Using a for loop to perform two operations, it will not wait until the operation is performed, the cycle will continue to run, the great god give directions
CodePudding user response:
Didn't understand what you mean is performed an operation and then perform another operation?
CodePudding user response:
Two are directly winform timer is not good, also cycle?
CodePudding user response:
I am now so write
For (int I=0; i { The Monitor. The Enter (obj); Visitor_name=visitorList [I] f_name; If (isRunNum==0) { //timer implementation IdTimer. Enable=true;
If (readIDCardCompleted) { WeiDunFingerTool wdTool=new WeiDunFingerTool ();
WdTool. FeatureRegister=featureRegister; WdTool. ShowMessage=ShowWndMessageMethod; WdTool. SetParam=SetParamMethod; WdTool. SetVisitorFingerInfo=setVisitorFingerInfoMethod; WdTool. FeatureLen=featureLen; if (! WdTool. OpenDevice ()) { This. RtbFinger. Text="refers to open the vein equipment failure!" ; return false; } If (0!=threadrunning) { This. RtbFinger. Text="registered or validation in the operation of the thread!" ; return false; }
But this content is not performed every time, will continue the loop, I this is spelled wrong? How to write
CodePudding user response:
When we used to "future tense" programming, looking at the code is awkward,
Ok, here are not ready to accept the "future tense" programming, so we also don't say, so that a few "five years the couple want to spit again,"
It is obvious that you use thread is because you don't want to block, you use the timer is because you don't know what time the thread end, If use "future tense" programming, it is simple a few words, because he can say "sometime in the future I'm ready or I failed"
As for you, I can only say, since the result is asynchronous, so direct on line by the asynchronous signal (remove the so-called timer, we have been tired all day and all night here, endless, that a few five years of the couple's mouth, the so-called standard answer -- -- -- -- -- -- -- what four timer how)
CodePudding user response:
In fact, If (0!=threadrunning) { This. RtbFinger. Text="registered or validation in the operation of the thread!" ; return false; }