I am using C# and Visual Studio 2013. I've read up on design patterns and I'm currently using the MVP design pattern.
My issue is that I start a Wait Cursor on the mouse and what I want it to do is go into an Aysnc function and perform the time consuming action, but keep the wait cursor going until the time consuming action is complete to assure people the program is still running. Outside of the MVP pattern I've done this before and the whole process works as it should. 1. start wait cursor, 2. start long function, 3. long function finishes, 4. change cursor back to default. However when I go from my presenter to my model from what I can tell in the debugger the wait cursor changes back to a default cursor as soon as the Async function begins.
I've done various tests to see if this affects all GUI components. It also affects marquee progress bars, but if I have a message box after my Async call it will activate the message box after the task is finished.
Is there something I'm missing that happens between the cursor being turned into a wait cursor and the task starting? I've looked around and I don't think anyone else has experienced this problem from what I can tell...
ex code: (please excuse sloppiness writing this from memory so syntax may be closer to pseudo code)
//View
//start wait cursor
public void StartWaitCursor()
{
Cursor.Current = Cursors.WaitCursor;
}
//stop wait cursor
public void StopWaitCursor()
{
Cursor.Current = Cursors.Default;
}
//Presenter
TheView.StartWaitCursor();//For some reason this goes to default cursor before task is finished
await Task_MethodAsync();
TheView.StopWaitCursor();
Aucun commentaire:
Enregistrer un commentaire