public void ConnectComponentValid(UIComponentBase component) { var type = component.GetType(); var attributes = default(IEnumerable <UIComponentDependencyAttribute>); if (type.HasCustomAttributes <UIComponentDependencyAttribute>(false, out attributes)) { foreach (var attribute in attributes) { var element = this.Configuration.GetElement <BooleanConfigurationElement>( attribute.Section, attribute.Element ); if (element == null) { continue; } element.ConnectValue(value => component.IsComponentValid = this.IsComponentValid(type)); } } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { if (this.ContentControl.Content is FrameworkElement element) { UIDisposer.Dispose(element); } var configuration = value as UIComponentConfiguration; if (configuration == null || string.IsNullOrEmpty(configuration.Component)) { return(this.CreateSelector()); } var component = default(UIComponentBase); var control = Factory.CreateControl(configuration, out component); if (control == null) { //If a plugin was uninstalled the control will be null. return(this.CreateSelector()); } this.Content = component; return(control); }
public static void SetContent(UIComponentContainer source, UIComponentBase value) { source.SetValue(ContentProperty, value); }
public static void SetIsComponentEnabled(UIComponentBase source, bool value) { source.SetValue(IsComponentEnabledProperty, value); }
public static bool GetIsComponentEnabled(UIComponentBase source) { return((bool)source.GetValue(IsComponentEnabledProperty)); }
public FrameworkElement CreateControl(UIComponentConfiguration configuration, out UIComponentBase component) { var type = this.GetComponentType(configuration.Component); if (type == null || type == LayoutManager.PLACEHOLDER) { //A plugin was uninstalled. component = null; return(null); } component = ComponentActivator.Instance.Activate <UIComponentBase>(type); if (component is IUIComponentPanel panel) { panel.Component = configuration; } //Some components expect to be hosted in a Grid (Artwork..) //We might as well add a Rectangle to make the entire thing hit testable. var grid = new Grid(); grid.Children.Add(new Rectangle() { Fill = Brushes.Transparent }); grid.Children.Add(component); return(grid); }