m using the following code and the problem is that when I have exception in GetUserData() I get message to the UI and the mouse courser is not stopping ,when I put inside the catch the mouse Cursors.Null cause to dump. my questions is:
- How I can stop the task (tpl) when I got exception i.e. not proceed to the continueWith ?
- How can I omit the mouse cursor when I got exception ?
Mouse.OverrideCursor=Cursors.Wait;Task.Factory.StartNew(()=>{//-----get service Data ---------try{GetUsersData();}catch(Exception e){
_isValid =false;ThrowErrorMessage(e.Message);Mouse.OverrideCursor=Cursors.Null;}}).ContinueWith((task)=>{Mouse.OverrideCursor=null;},System.Threading.CancellationToken.None,TaskContinuationOptions.None,TaskScheduler.FromCurrentSynchronizationContext());
isServiceValid =true;