internal IEnumerable <ILayoutPanelElement> GetInitializedViews() { IEnumerable <string> enabledWidgets = GetEnabledWidgets(); foreach (ExportedType export in ExportedTypeLibrary.GetExports(typeof(IUIWidget)).Where(j => enabledWidgets.Contains(j.Attribute.Alias))) { IUIWidget widget = export.CreateInstance <IUIWidget>(); string widgetName = widget.GetType().Name; Logger.Instance.LogFormat(LogType.Trace, this, Properties.Resources.BeginInitialization, widgetName); try { if (!widget.Initialize()) { Logger.Instance.LogFormat(LogType.Warning, this, Properties.Resources.InitializationFailure, widgetName); continue; } LayoutAnchorablePane pane = CreatePaneFromWidget(widget); _panelElements.Add(pane); Widgets.Add(widget); Logger.Instance.LogFormat(LogType.Trace, this, Properties.Resources.InitializationSuccess, widgetName); } catch (Exception ex) { Logger.Instance.LogFormat(LogType.Error, this, Properties.Resources.InitializationError, widgetName); Logger.Instance.LogException(this, ex); } } return(_panelElements); }
private static LayoutAnchorablePane CreatePaneFromWidget(IUIWidget widget) { LayoutAnchorable anchorable = new LayoutAnchorable(); anchorable.Content = widget.UIElement; anchorable.ContentId = widget.ContentGuid; anchorable.Title = widget.Title; anchorable.CanClose = false; anchorable.CanHide = false; LayoutAnchorablePane pane = new LayoutAnchorablePane(anchorable); return(pane); }
private static IUIWidget CreateVerticalWidget(IUIWidget widget) { var vert = widget.Clone(); vert.Name = "vert" + widget.Name; //NOXLATE vert.Label = string.Empty; return vert; }
private static LayoutAnchorablePane CreatePaneFromWidget(IUIWidget widget) { LayoutAnchorable anchorable = new LayoutAnchorable(); anchorable.Content = widget.UIElement; anchorable.ContentId = widget.ContentGuid; anchorable.Title = widget.Title; anchorable.CanClose = false; anchorable.CanHide = false; LayoutAnchorablePane pane = new LayoutAnchorablePane(anchorable); return pane; }