private void OnDelDevice(object sender, EventArgs e) { AbstractTreeNode node = _treeView.SelectedNode as AbstractTreeNode; if (node != null) { string path = node.Path; bool ret = _mainWindow.PageManager.CloseRightPage(path); int childCount = node.Nodes.Count; if (ret) { _treeView.SelectedNode = node.PrevNode; node.Remove(); } else if (childCount == 0 && !(node is TreeLocalHost)) { node.Remove(); } //登出设备 string[] pathParts = path.Split('_'); if (pathParts.Length > 1) { AbstractBus bus = App.Instance.FlightBusManager.GetBus(pathParts[1]); if (pathParts.Length > 2) { bus.Logout(pathParts[2]); } } } }
public static void GetBusAndDevice(string name, out AbstractBus bus, out AbstractDevice device) { string[] pathParts = name.Split('_'); string busName = pathParts[1]; string deviceName = pathParts[2]; bus = App.Instance.FlightBusManager.GetBus(busName); device = (AbstractDevice)bus.GetItem(deviceName); }
//界面以boardType,boardNo,channelType,channelCount来标识唯一性。 //core中bus,device等也应该包含这个几个属性,用它来标识唯一性 public static AbstractDevice GetSeletecedDevice(string boardName, string deviceName) { //获取当前选择的Bus AbstractBus bus = App.Instance.FlightBusManager.GetBus(boardName); //获取当前选择Device AbstractDevice selectedDevice = null; if (bus != null) { selectedDevice = (AbstractDevice)bus.GetItem(deviceName); } return(selectedDevice); }