private void ShowDeviceScreen(PosDeviceTag tag) { if (tag != null && tag.posCommon != null) { // Show the Device panel if (tag.screen == null) tag.screen = DeviceScreenBase.CreateDeviceScreen(tag.posCommon, GetDeviceDisplayName(tag.DeviceInfo), this); if (tag.screen != null && !DevicePanel.Controls.Contains(tag.screen)) { DevicePanel.SuspendLayout(); DevicePanel.Controls.Clear(); DevicePanel.Controls.Add(tag.screen); DevicePanel.ResumeLayout(false); currentDevice = tag; } } else if (DevicePanel.Controls.Count > 0) { DevicePanel.Controls.Clear(); } }
private void DeviceTree_AfterSelect(object sender, TreeViewEventArgs e) { if (e.Node != null && e.Node.Tag is PosDeviceTag) currentDevice = (PosDeviceTag)e.Node.Tag; else currentDevice = null; ShowDeviceScreen(currentDevice); SetButtonState(); }