internal void SetPad(PropertyPad pad)
        {
            propertyPad = pad;

            if (propertyPad != null)
            {
                if (lastPadProvider != null)
                {
                    object[] provs = GetProvidersForObject(lastComponent, lastPadProvider.GetProvider());
                    if (provs.Length > 0)
                    {
                        propertyPad.PropertyGrid.SetCurrentObject(lastComponent, provs);
                    }
                    else
                    {
                        propertyPad.BlankPad();
                    }

                    propertyPad.PropertyGrid.Changed += OnPropertyGridChanged;
                }
                else if (lastCustomProvider != null)
                {
                    propertyPad.UseCustomWidget(lastCustomProvider.GetCustomPropertyWidget());
                }
            }
        }
        public void SetPadContent(IPropertyPadProvider provider, object commandRouteOrigin)
        {
            if (provider != null)
            {
                // If there was a custom provider, reset it now
                DisposeCustomPropertyPadProvider();

                object comp = provider.GetActiveComponent();
                if (lastPadProvider != null && comp == lastComponent)
                {
                    return;
                }

                DisposePropertyPadProvider();

                lastPadProvider = provider;
                lastComponent   = comp;

                if (propertyPad == null)
                {
                    return;
                }

                object[] provs = GetProvidersForObject(comp, provider.GetProvider());
                if (provs.Length > 0)
                {
                    propertyPad.SetCurrentObject(comp, provs);

                    if (propertyPad is PropertyPad propPad)
                    {
                        propPad.CommandRouteOrigin = commandRouteOrigin;
                    }
                }
                else
                {
                    propertyPad.BlankPad();
                }

                if (provider is IPropertyPadCustomizer customizer && propertyPad is PropertyPad ppad)
                {
                    customizer.Customize(ppad.PadWindow, ppad.PropertyGrid);
                }

                propertyPad.PropertyGridChanged += OnPropertyGridChanged;
            }
            else
            {
                ReSetPad();
            }
        }
        internal void SetPad(IPropertyPad pad)
        {
            propertyPad = pad;

            if (propertyPad != null)
            {
                if (lastPadProvider != null)
                {
                    object[] provs = GetProvidersForObject(lastComponent, lastPadProvider.GetProvider());
                    if (provs.Length > 0)
                    {
                        propertyPad.SetCurrentObject(lastComponent, provs);
                    }
                    else
                    {
                        propertyPad.BlankPad();
                    }

                    if (lastPadProvider is IPropertyPadCustomizer customizer && pad is PropertyPad ppad)
                    {
                        customizer.Customize(ppad.PadWindow, ppad.PropertyGrid);
                    }
                    propertyPad.PropertyGridChanged += OnPropertyGridChanged;
                }
                else if (lastCustomProvider != null)
                {
                    if (propertyPad is PropertyPad ppad)
                    {
                        try {
                            var currentCustomWidget = lastCustomProvider.GetCustomPropertyWidget();
                            if (currentCustomWidget != null)
                            {
                                ppad.UseCustomWidget(currentCustomWidget);
                                if (lastCustomProvider is IPropertyPadCustomizer customizer)
                                {
                                    customizer.Customize(ppad.PadWindow, null);
                                }
                            }
                        } catch (Exception ex) {
                            LoggingService.LogInternalError($"There was an error trying to GetCustomPropertyWidget from '{lastCustomProvider.GetType ()}' provider", ex);
                            ReSetPad();
                        }
                    }
                }
            }
        }
        public void SetPadContent(IPropertyPadProvider provider)
        {
            if (provider != null)
            {
                // If there was a custom provider, reset it now
                DisposeCustomPropertyPadProvider();

                object comp = provider.GetActiveComponent();
                if (lastPadProvider != null && comp == lastComponent)
                {
                    return;
                }

                DisposePropertyPadProvider();

                lastPadProvider = provider;
                lastComponent   = comp;

                if (propertyPad == null)
                {
                    return;
                }

                object[] provs = GetProvidersForObject(comp, provider.GetProvider());
                if (provs.Length > 0)
                {
                    propertyPad.PropertyGrid.SetCurrentObject(comp, provs);
                }
                else
                {
                    propertyPad.BlankPad();
                }

                propertyPad.PropertyGrid.Changed += OnPropertyGridChanged;
            }
            else
            {
                ReSetPad();
            }
        }
		public void SetPadContent (IPropertyPadProvider provider)
		{
			if (provider != null) {
				// If there was a custom provider, reset it now
				DisposeCustomPropertyPadProvider ();
				
				object comp = provider.GetActiveComponent ();
				if (lastPadProvider != null && comp == lastComponent)
					return;

				DisposePropertyPadProvider ();
				
				lastPadProvider = provider;
				lastComponent = comp;
				
				if (propertyPad == null)
					return;
					
				object[] provs = GetProvidersForObject (comp, provider.GetProvider ());
				if (provs.Length > 0)
					propertyPad.PropertyGrid.SetCurrentObject (comp, provs);
				else
					propertyPad.BlankPad ();
				
				propertyPad.PropertyGrid.Changed += OnPropertyGridChanged;
			}
			else {
				ReSetPad ();
			}
		}