G
Guest
I'm writing a program to handle multiple tasks in a single batch, which may
take few minutes to complete all tasks. To reduce the impact to user, no
windows form will be displayed, instead I have create a NotifiyIcon for the
program, it can show the current status whenever user put the mouse over the
tray icon.
As it takes time to complete all tasks, user may want to terminate the job
for some reason. I have added the ContextMenu for the NotifyIcon, and user
can choose the option to terminate the job. Everything seems OKay, and I can
call the menu when the program started before I trigger the job (the job will
starte 1 minute after the proram executed).
However, if the job is started, the NotifyIcon can show the status when user
put the mouse over the icon, but there has no response when i clicked on the
icon, the menu does not show up. If i remove the application.exit() after I
complete all task, and let the icon remain here. I found that the menu will
pop up after i finish the task.
I have try to add some code in the loop after each task, to check if user
attempt to stop it. But it seems that all event on the notifyicon will not
execute unless the function is completed. So, i cannot set the viriable to
stop the job after one task. When I'm using other language before, I can add
a function like yield() inside my program to release the CPU, so that i can
handle other events.
I'd like to know if VB.Net has similiar function to allow the CPU to handle
other event of my program (e.g. mouse click on the notifyicon) while it's
inside a function.
Thanks in advance!
take few minutes to complete all tasks. To reduce the impact to user, no
windows form will be displayed, instead I have create a NotifiyIcon for the
program, it can show the current status whenever user put the mouse over the
tray icon.
As it takes time to complete all tasks, user may want to terminate the job
for some reason. I have added the ContextMenu for the NotifyIcon, and user
can choose the option to terminate the job. Everything seems OKay, and I can
call the menu when the program started before I trigger the job (the job will
starte 1 minute after the proram executed).
However, if the job is started, the NotifyIcon can show the status when user
put the mouse over the icon, but there has no response when i clicked on the
icon, the menu does not show up. If i remove the application.exit() after I
complete all task, and let the icon remain here. I found that the menu will
pop up after i finish the task.
I have try to add some code in the loop after each task, to check if user
attempt to stop it. But it seems that all event on the notifyicon will not
execute unless the function is completed. So, i cannot set the viriable to
stop the job after one task. When I'm using other language before, I can add
a function like yield() inside my program to release the CPU, so that i can
handle other events.
I'd like to know if VB.Net has similiar function to allow the CPU to handle
other event of my program (e.g. mouse click on the notifyicon) while it's
inside a function.
Thanks in advance!