public static object UIThreadGetValue(this DependencyObject me, DependencyProperty dependencyProperty)
{
//if (_log.IsDebugEnabled) { _log.DebugFormat("Starting {0}", MethodBase.GetCurrentMethod().ToString()); }
object retVal = null;
if (me != null)
{
//#if false
if (Application.Current.Dispatcher != System.Windows.Threading.Dispatcher.CurrentDispatcher)
{
retVal = Application.Current.Dispatcher.Invoke(
new Func<DependencyProperty, object>(me.GetValue), dependencyProperty);
}
else
{
//#endif
retVal = me.GetValue(dependencyProperty);
//#if false
}
//#endif
}
else
{
retVal = null;
}
//if (_log.IsDebugEnabled) { _log.DebugFormat("Ending {0}", MethodBase.GetCurrentMethod().ToString()); }
return retVal;
}