Click here to Skip to main content
15,885,278 members
Home / Discussions / C#
   

C#

 
AnswerRe: Exchange Web Services (EWS) Pin
MWRivera25-Mar-10 6:50
MWRivera25-Mar-10 6:50 
AnswerRe: Exchange Web Services (EWS) Pin
Ravi Bhavnani25-Mar-10 7:06
professionalRavi Bhavnani25-Mar-10 7:06 
GeneralRe: Exchange Web Services (EWS) Pin
MWRivera29-Mar-10 5:09
MWRivera29-Mar-10 5:09 
GeneralRe: Exchange Web Services (EWS) Pin
Travis Citrine2-Jul-15 17:56
Travis Citrine2-Jul-15 17:56 
QuestionExceptions across invoke Pin
richasea25-Mar-10 4:23
richasea25-Mar-10 4:23 
AnswerRe: Exceptions across invoke Pin
ricmil4225-Mar-10 4:50
ricmil4225-Mar-10 4:50 
GeneralRe: Exceptions across invoke Pin
richasea25-Mar-10 5:40
richasea25-Mar-10 5:40 
GeneralRe: Exceptions across invoke Pin
Keith Barrow25-Mar-10 6:17
professionalKeith Barrow25-Mar-10 6:17 
At the top level, you can subscribe to AppDomain.CurrentDomain.UnhandledException, otherwise you pretty much have to catch the exception on the thread it was raised on AFAIK.

You can pass the exception by raising an event that takes an Exception as a parameter, then doing the updates to the UI via the subscribing method (remembering to do this on the Dispatcher Thread):

C#
Action<Exception> ExceptionRaised;

public void SetProperty(String Path, String Value)
{
  if (!this.Dispatcher.CheckAccess())
  {
    Exception exception = null;
    this.Dispatcher.Invoke((Action<String, String>)((path, val) => 
  { 

    try 
    {
      SetProperty(path, val); // throws an exception
    }
    catch (System.Exception e)
    {
      exception = e;
     }
  }), Path, Value, exception);
  }


public Constructor
{
  ExceptionRaised += UpdateStatus;
}

void UpdateStatus(Exception exception)
{
  if(exception == null)
    return;
  if (Thread.Current != Dispatcher.Current.Thread)
  {
    // Not in the UI thread, so call on dispatcher thread
    this.Dispatcher.Invoke(new Action<string>(UpdateStatus), new object[]{exception});
    return;
  }
  // Must be on the UI thread if we've got this far

  MessageBox.Show(exception.Message);

}

Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.
Pete o'Hanlon: If it wasn't insulting tools, I'd say you were dumber than a bag of spanners.

Questionproblem accessing a control from a thread (the callback is in another user defined class) Pin
George Nistor25-Mar-10 2:57
George Nistor25-Mar-10 2:57 
AnswerRe: problem accessing a control from a thread (the callback is in another user defined class) Pin
Covean25-Mar-10 3:33
Covean25-Mar-10 3:33 
GeneralRe: problem accessing a control from a thread (the callback is in another user defined class) Pin
George Nistor25-Mar-10 3:45
George Nistor25-Mar-10 3:45 
GeneralRe: problem accessing a control from a thread (the callback is in another user defined class) Pin
Covean25-Mar-10 3:59
Covean25-Mar-10 3:59 
QuestionHow to get values after dictionary sorting by values with linq Pin
igalep13225-Mar-10 1:42
igalep13225-Mar-10 1:42 
AnswerRe: How to get values after dictionary sorting by values with linq Pin
Not Active25-Mar-10 1:46
mentorNot Active25-Mar-10 1:46 
GeneralRe: How to get values after dictionary sorting by values with linq Pin
igalep13225-Mar-10 1:56
igalep13225-Mar-10 1:56 
GeneralRe: How to get values after dictionary sorting by values with linq Pin
igalep13225-Mar-10 2:06
igalep13225-Mar-10 2:06 
AnswerRe: How to get values after dictionary sorting by values with linq Pin
Keith Barrow25-Mar-10 2:02
professionalKeith Barrow25-Mar-10 2:02 
GeneralRe: How to get values after dictionary sorting by values with linq Pin
igalep13225-Mar-10 2:07
igalep13225-Mar-10 2:07 
GeneralRe: How to get values after dictionary sorting by values with linq Pin
igalep13225-Mar-10 5:04
igalep13225-Mar-10 5:04 
GeneralRe: How to get values after dictionary sorting by values with linq Pin
Keith Barrow25-Mar-10 5:25
professionalKeith Barrow25-Mar-10 5:25 
GeneralRe: How to get values after dictionary sorting by values with linq Pin
igalep13225-Mar-10 14:27
igalep13225-Mar-10 14:27 
AnswerRe: How to get values after dictionary sorting by values with linq Pin
lukaszbl25-Mar-10 2:04
lukaszbl25-Mar-10 2:04 
QuestionDelegates - What is the use of it? Pin
Praveen Raghuvanshi25-Mar-10 1:19
professionalPraveen Raghuvanshi25-Mar-10 1:19 
AnswerRe: Delegates - What is the use of it? Pin
harold aptroot25-Mar-10 1:38
harold aptroot25-Mar-10 1:38 
AnswerRe: Delegates - What is the use of it? [modified] Pin
Keith Barrow25-Mar-10 1:39
professionalKeith Barrow25-Mar-10 1:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.