Click here to Skip to main content
16,020,103 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am currently working on a form that has a menu. I have one particular item in the menu that once clicked some process (Process A) is being done which takes approximately 60 seconds, in the meantime I want that if this item is clicked again a message showing that Process A is in progress.

I have tried doing some OnTimedEvent but cannot find a way on how to implement a clean solution.

Any hints please of how is the best way to do it.

What I have tried:

I have tried with an OnTimedEvent.
Posted
Updated 15-Mar-16 0:45am
Comments
F-ES Sitecore 15-Mar-16 6:45am    
It'd be simpler to disable the menu item when the task runs and re-enable it when it stops.

1 solution

The simplest way would be to use a BackgroundWorker, and handle the RunWorkerCompleted[^] event.
Create a class level private bool "taskInProgress" and set it true just before you start the task.
In the event handler, set it to false.
Then all you have to do is check the bool and report the message or start the task.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900