stop method from executing

Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Jan 2008
Posts: 2,052
Reputation: serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light 
Solved Threads: 118
Featured Poster
serkan sendur serkan sendur is offline Offline
Postaholic

stop method from executing

 
0
  #1
Apr 8th, 2009
hi guys, i have a pocket pc application where i scan some barcodes, i want to stop scanning when i open a new form.
do you have any ideas how to stop it?
Due to lack of freedom of speech, i no longer post on this website.
Reply With Quote Quick reply to this message  
Join Date: Mar 2009
Posts: 139
Reputation: thoughtcoder is on a distinguished road 
Solved Threads: 12
thoughtcoder thoughtcoder is offline Offline
Junior Poster

Re: stop method from executing

 
0
  #2
Apr 8th, 2009
The same way you normally stop scanning bar codes?
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 2,052
Reputation: serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light 
Solved Threads: 118
Featured Poster
serkan sendur serkan sendur is offline Offline
Postaholic

Re: stop method from executing

 
0
  #3
Apr 8th, 2009
Originally Posted by thoughtcoder View Post
The same way you normally stop scanning bar codes?
actually my problem was device specific, the scantimeout can be set to 10 seconds which means it is going to scan continuously for 10 seconds, i wanted to stop it but i couldnt because it only stops when the timout is reached or the key is released or something is scanned. i work on handheld dolphin 7900 with sdk 111, it appearantly does not have such method to interrupt scanning.
Due to lack of freedom of speech, i no longer post on this website.
Reply With Quote Quick reply to this message  
Join Date: Dec 2003
Posts: 2,414
Reputation: alc6379 has a spectacular aura about alc6379 has a spectacular aura about alc6379 has a spectacular aura about 
Solved Threads: 123
Team Colleague
alc6379's Avatar
alc6379 alc6379 is offline Offline
Cookie... That's it

Re: stop method from executing

 
0
  #4
Apr 9th, 2009
Could you maybe set a scan timeout for a shorter period of time, set that running on a thread, and have that thread check for some type of stop "signal" before scanning again? I think a Singleton pattern or something could work for this:

instantiate a "ScanMonitor" object that has a "Cancel" boolean property. (This can go to your scan() method)

Then, you could have another thread change ScanMonitor's Cancel property to "true" when you need to stop scanning.

set a while(true) loop to keep looping on that scan method with a short scan time, but before you scan, check if ScanMonitor.Cancel == true.

Does that make sense?
Alex Cavnar, aka alc6379
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 2,052
Reputation: serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light 
Solved Threads: 118
Featured Poster
serkan sendur serkan sendur is offline Offline
Postaholic

Re: stop method from executing

 
0
  #5
Apr 10th, 2009
Originally Posted by alc6379 View Post
Could you maybe set a scan timeout for a shorter period of time, set that running on a thread, and have that thread check for some type of stop "signal" before scanning again? I think a Singleton pattern or something could work for this:

instantiate a "ScanMonitor" object that has a "Cancel" boolean property. (This can go to your scan() method)

Then, you could have another thread change ScanMonitor's Cancel property to "true" when you need to stop scanning.

set a while(true) loop to keep looping on that scan method with a short scan time, but before you scan, check if ScanMonitor.Cancel == true.

Does that make sense?
Actually it doesnt bother to have the scanning on after moving to another form because its scan handle method checks if any handler is registered to that event, since there is none, it does not do anything on the next form, so i got around the problem.
i think i could use some multithreading functionality like abort or interrupt thread, but anyway simpler is better.
thanks.
Due to lack of freedom of speech, i no longer post on this website.
Reply With Quote Quick reply to this message  
Join Date: Aug 2006
Posts: 2,065
Reputation: Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice Ramy Mahrous is just really nice 
Solved Threads: 256
Featured Poster
Ramy Mahrous's Avatar
Ramy Mahrous Ramy Mahrous is offline Offline
Postaholic

Re: stop method from executing

 
0
  #6
Apr 11th, 2009
To stop it noway else putting it on a specific thread then in some defined cases you kill this thread.
BI Developer | LINKdotNET
B.Sc Computer Science, Helwan University
Technical blog | http://ramymahrous.wordpress.com
LinkedIn | http://www.linkedin.com/in/ramymahrous
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC