static void HandleStatusChanged(FrameworkElement element)
        {
            var layer = AdornerLayer.GetAdornerLayer(element);

            Debug.WriteLineIf(layer == null, "BusyStatusManager: cannot find any AdornerLayer on the given element.");

            if (layer != null)
            {
                var content = GetContent(element);
                var status  = GetStatus(element);
                var enableMultiThreadingHost = GetEnableMultiThreadingHost(element);

                switch (status)
                {
                case BusyStatus.Idle:

                    element.IsEnabled = true;

                    var adorners = layer.GetAdorners(element);
                    Debug.WriteLineIf(adorners == null, "BusyStatusManager: cannot find any Adorner on the given element.");

                    if (adorners != null)
                    {
                        if (enableMultiThreadingHost)
                        {
                            var la = adorners.OfType <MultiThreadingBusyAdorner>().FirstOrDefault();
                            if (la != null)
                            {
                                la.Teardown();
                                layer.Remove(la);
                            }
                        }
                        else
                        {
                            var la = adorners.OfType <BusyAdorner>().FirstOrDefault();
                            if (la != null)
                            {
                                layer.Remove(la);
                            }
                        }
                    }

                    break;

                case BusyStatus.Busy:

                    element.IsEnabled = false;
                    if (enableMultiThreadingHost)
                    {
                        //var style = GetBusyStyle( element );
                        var ba = new MultiThreadingBusyAdorner(element, content);

                        layer.Add(ba);
                        ba.Setup();
                    }
                    else if (content != null)
                    {
                        var ba = new BusyAdorner(element, content);
                        layer.Add(ba);
                    }

                    break;

                default:
                    throw new NotSupportedException();
                }
            }
        }
		static void HandleStatusChanged( FrameworkElement element )
		{
			var layer = AdornerLayer.GetAdornerLayer( element );
			Debug.WriteLineIf( layer == null, "BusyStatusManager: cannot find any AdornerLayer on the given element." );

			if ( layer != null )
			{
				var content = GetContent( element );
				var status = GetStatus( element );
				var enableMultiThreadingHost = GetEnableMultiThreadingHost( element );

				switch ( status )
				{
					case BusyStatus.Idle:

						element.IsEnabled = true;

						var adorners = layer.GetAdorners( element );
						Debug.WriteLineIf( adorners == null, "BusyStatusManager: cannot find any Adorner on the given element." );

						if ( adorners != null )
						{
							if ( enableMultiThreadingHost )
							{
								var la = adorners.OfType<MultiThreadingBusyAdorner>().FirstOrDefault();
								if ( la != null )
								{
									la.Teardown();
									layer.Remove( la );
								}
							}
							else
							{
								var la = adorners.OfType<BusyAdorner>().FirstOrDefault();
								if ( la != null )
								{
									layer.Remove( la );
								}
							}
						}

						break;

					case BusyStatus.Busy:

						element.IsEnabled = false;
						if ( enableMultiThreadingHost )
						{
							//var style = GetBusyStyle( element );
							var ba = new MultiThreadingBusyAdorner( element, content );

							layer.Add( ba );
							ba.Setup();
						}
						else if ( content != null )
						{
							var ba = new BusyAdorner( element, content );
							layer.Add( ba );
						}

						break;

					default:
						throw new NotSupportedException();
				}
			}
		}