Beispiel #1
0
 public static void ListWidgets()
 {
     foreach (var item in Modules)
     {
         Widgets.AddRange(item.Widgets);
     }
 }
        private void RestoreWorkspaceLayout(WorkspaceLayout layout)
        {
            if (null == View)
            {
                return;
            }

            View.WidgetDockManager.RestoreLayoutFromStream(new MemoryStream(layout.DockingLayout));

            var instances = new List <IWidget>();

            foreach (var widget in layout.Widgets)
            {
                var widgetInstance = Dashboard.CreateWidget(Type.GetType(widget.Type), widget.ViewModelId).Result;
                if (null == widgetInstance)
                {
                    throw new MissingWidgetException(widget.Type);
                }
                widgetInstance.ParentName       = widget.ParentName;
                widgetInstance.GridsLayout      = widget.GridsLayout;
                widgetInstance.PivotGridsLayout = widget.PivotGridsLayout;
                widgetInstance.DockId           = widget.DockId;
                instances.Add(widgetInstance);
            }

            Widgets.AddRange(instances, false);

            VisualTreeWalker <LayoutPanel> .Execute(View, FillPanel, instances);

            RestoreFloatingWidgets();
        }