/// <summary> /// Update screen information /// </summary> public void RefreshStatus() { SwitchboardCommandControl ctrl = null; // Show theme information bbtnThemesManage.Caption = (OTCContext.Project.Theme == null ? "[No theme]" : OTCContext.Project.Theme.Name); bbtnThemesManage.Glyph = (OTCContext.Project.Theme == null ? Control.Properties.Resources.ICO_THEME_UNSELECTED_16 : Otc.Utils.Icons.Theme16); // Show system information bbtnSystemsManage.Caption = (OTCContext.Project.DigitalSystem == null ? "[No system]" : OTCContext.Project.DigitalSystem.Name); bbtnSystemsManage.Glyph = (OTCContext.Project.DigitalSystem == null ? Control.Properties.Resources.ICO_SYSTEM_DISCONNECT_16 : DigitalSystem.SmallIcon); // Update system controls cmdSystemSettings.Enabled = (OTCContext.Project.DigitalSystem != null); rpgControl.Enabled = !(OTCContext.Project.DigitalSystem == null || OTCContext.Project.DigitalSystem.Status != SystemStatus.Connected); cmdSystemConnect.Enabled = (OTCContext.Project.DigitalSystem != null && OTCContext.Project.DigitalSystem.Status != SystemStatus.Connected); cmdSystemDisconnect.Enabled = !cmdSystemConnect.Enabled; // Update the switchboard status foreach (XtraTabPage page in tabPanels.TabPages) { ctrl = page.Controls[0] as SwitchboardCommandControl; if (ctrl != null) { ctrl.Enabled = rpgControl.Enabled; page.Cursor = (ctrl.Enabled ? Cursors.Default : Cursors.No); } } }
private void SpcPanel_SensorManuallyActivated(object sender, CellClickEventArgs e, bool status) { SwitchboardCommandControl panel = sender as SwitchboardCommandControl; if (panel == null) { return; } // Force the sensor to changing its status panel.SetSensorStatus(e.Coordinates, status); }
private void ViewAddCommandPanel(Switchboard panel, XtraTabControl tabControl, XtraTabPage tabPage, SwitchboardCommandControl.BlockAssignmentChangedEventHandler blockAssignmentChangedEvent) { XtraTabPage tabPanel; tabControl.SuspendLayout(); // Generate the grid SwitchboardCommandControl spcPanel = new SwitchboardCommandControl(panel); spcPanel.Dock = System.Windows.Forms.DockStyle.Fill; spcPanel.Location = new System.Drawing.Point(5, 5); spcPanel.Name = "grdPanel" + panel.ID; spcPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; // Subscribe required events spcPanel.BlockAssignmentChanged += blockAssignmentChangedEvent; // Generate the tab page if (tabPage == null) { tabPanel = new XtraTabPage(); // tabPanel.Controls.Add(grdPanel); tabPanel.Name = "tabPanel" + panel.ID; tabPanel.Padding = new System.Windows.Forms.Padding(5); tabPanel.Text = panel.Name; tabPanel.Image = Switchboard.SmallIcon; tabPanel.Tag = panel; tabPanel.Controls.Add(spcPanel); } else { // Clear all page contents tabPage.Controls.Clear(); tabPanel = tabPage; } tabControl.TabPages.Add(tabPanel); // Select the new panel tabControl.SelectedTabPage = tabPanel; tabControl.ResumeLayout(false); }