public void SetState(DashboardState state) { DashboardState = state; // Create WidgetContainers one by one from DashbaordState and add them to the CellsContainer for (int containerIter = 0; containerIter < state.WidgetContainerStates.Count; containerIter++) { // Create a new WidgetContainer IWidgetContainer widgetContainer; IWidgetContainerState containerState = state.WidgetContainerStates[containerIter]; if (containerState is WidgetFrameState) { widgetContainer = new WidgetFrame(); } else { widgetContainer = new WidgetFrame(); } // Set the WidgetContainerState widgetContainer.SetState(state.WidgetContainerStates[containerIter]); // Add the WidgetContainer to the Dashboard LayoutManager.AddDashboardWidgetToContainer(CellsContainer, widgetContainer, Changed); } UpdateDashboardAutoFetchState(); ApplyDashboardSettings(); }
public void AddNewDataWidget() { WidgetFrame widgetFrame = new WidgetFrame { Position = LayoutManager.GetNewWidgetPositon(CellsContainer) }; widgetFrame.SetWidget(new DataExportWidget()); LayoutManager.AddDashboardWidgetToContainer(CellsContainer, widgetFrame, Changed); }