dispatcherObject.CheckAccess
/// <summary>
/// The dispatcher object.
/// </summary>
private readonly DispatcherObject _dispatcherObject;
#region Constructor
public [Constructor]()
{
_dispatcherObject = Application.Current;
}
#endregion
void [XXXFunction]()
{
if (!_dispatcherObject.CheckAccess())
{
_dispatcherObject.Dispatcher.Invoke(new Action(XXXFunction));
return;
//maybe all main thread.
}