private void ShowDashboard(DashboardBase dab, bool visible) { if (dab == null) { return; } Control ctrl = GetDashboardControl(dab); if (ctrl != null) { ctrl.Visible = visible; if (!Controls.Contains(ctrl)) { Controls.Add(ctrl); ctrl.Dock = DockStyle.Fill; } if (visible) { ctrl.BringToFront(); } } var cnt = ctrl as ContentFrame; if (cnt != null) { cnt.IsContentVisible = visible; } }
private void cbxDashboardType_SelectedIndexChanged(object sender, EventArgs e) { DashboardBase maxdash = m_dashboards.MaxKey(d => d.Priority); DashboardBase current = null; if (cbxDashboardType.SelectedIndex >= 0) { current = m_dashboards[cbxDashboardType.SelectedIndex]; } if (current == m_shownDashboard) { return; } ShowDashboard(m_shownDashboard, false); ShowDashboard(current, true); m_shownDashboard = current; toolStripDashboard.Visible = m_shownDashboard is DockPanelDashboard; UpdateRevertMenu(); //btnOpen.Visible = btnMore.Visible = m_shownDashboard is DockPanelDashboard && CustomDashboardsFeature.Allowed; //if (m_shownDashboard is DockPanelDashboard) //{ // var frm = ((DockPanelDashboard)m_shownDashboard).DesignFrame; // btnMore.Checked = frm != null && frm == _GetDashboardControl(m_shownDashboard); // //((DockPanelDashboard)m_shownDashboard).EnableDesign(btnDesign.Checked); //} if (m_shownDashboard != null && !m_machineChangeDashboard) { m_userWantToSee[maxdash] = m_shownDashboard; } SendSelectedObject(); toolStrip1.Visible = m_shownDashboard.Caps.ShowNodeToolbar; }
private Control _GetDashboardControl(DashboardBase dab) { if (!m_dashboardControls.ContainsKey(dab) || m_dashboardControls[dab].IsDisposed) { return(null); } return(m_dashboardControls[dab]); }
private void UpdateDashboardList() { if (!IsContentVisible) { return; } UpdateTitleBar(); m_dashboards.Clear(); cbxDashboardType.Items.Clear(); cbxDashboardType.Items.Add(VersionInfo.ProgramTitle); m_dashboards.Add(m_infoDashboard); if (m_selectedObject != null && m_selectedObject.GetAllWidgets().Count > 0) { cbxDashboardType.Items.Add(Texts.Get("s_tabs")); m_dashboards.Add(m_tabbedDashboard); } if (m_selectedObject != null) { var appobj = m_selectedObject.GetPrimaryAppObject(); if (appobj != null) { AppObject aclone; if (appobj.SupportSerialize) { aclone = appobj.CloneUsingXml(); aclone.ConnPack = ConnPack; } else { aclone = appobj; } foreach (var item in DashboardManager.Instance.GetDashboards(aclone)) { m_dashboards.Add(item); cbxDashboardType.Items.Add(item); } } } DashboardBase maxdash = m_dashboards.MaxKey(d => d.Priority); if (m_userWantToSee.ContainsKey(maxdash)) { maxdash = m_userWantToSee[maxdash]; } m_machineChangeDashboard = true; cbxDashboardType.SelectedIndex = m_dashboards.IndexOf(maxdash); m_machineChangeDashboard = false; }
private Control GetDashboardControl(DashboardBase dab) { if (!m_dashboardControls.ContainsKey(dab) || m_dashboardControls[dab].IsDisposed) { var pars = new DashboardInstanceParams { LayoutName = ".summary" }; var ctrl = dab.CreateControl(pars); var cc = ctrl as IConnectionPackHolder; if (cc != null) { cc.ConnPack = ConnPack; } var das = ctrl as DashboardFrame; if (das != null) { das.HideToolbar = true; das.ChangedWidgetSet += das_ChangedWidgetSet; } m_dashboardControls[dab] = ctrl; } return(m_dashboardControls[dab]); }