BigRedButtonOfDeath.WPF.Extensions.UIThreadSetValue C# (CSharp) Method

UIThreadSetValue() private method

private UIThreadSetValue ( this me, DependencyProperty dependencyProperty, object value ) : void
me this
dependencyProperty System.Windows.DependencyProperty
value object
return void
        public static void UIThreadSetValue(this DependencyObject me, DependencyProperty dependencyProperty, object value)
        {
            //if (_log.IsDebugEnabled) { _log.DebugFormat("Starting {0}", MethodBase.GetCurrentMethod().ToString()); }
            if (me != null)
            {
                //#if false

                if (Application.Current.Dispatcher != System.Windows.Threading.Dispatcher.CurrentDispatcher)
                {
                    if (!Application.Current.Dispatcher.HasShutdownFinished
                        && !Application.Current.Dispatcher.HasShutdownStarted)
                    {
                        Application.Current.Dispatcher.Invoke(
                            new Action<DependencyProperty, object>(me.SetValue), dependencyProperty, value);
                    }
                }
                else
                {
                    //if (_log.IsInfoEnabled && dp != null)
                    //{
                    //#endif
                    //    _log.InfoFormat("Setting {0}.{1} to value {2}", me.GetType().ToString(), dp.GetType().ToString(), value);

                    //}
                    me.SetValue(dependencyProperty, value);
                    //#if false    
                }
                //#endif

            }
            //if (_log.IsDebugEnabled) { _log.DebugFormat("Ending {0}", MethodBase.GetCurrentMethod().ToString()); }
        }
        static public BitmapSource ToBitmapSource(this System.Drawing.Bitmap bitmap)