private void AddBoardItem_Click(object sender, RoutedEventArgs e) { var sbi = new SelectBoardItemDialog(BoardType == BoardType.InputA ? ProjectHelper.Project.ItemXmlInfo.InputBoardGroup : ProjectHelper.Project.ItemXmlInfo.OutputBoardGroup, false); if (sbi.ShowDialog() == true) { var boardItem = sbi.SelectedBoardItem; var deviceNumber = sbi.SelectedBoard.DeviceNumber; var number = boardItem.Number; string portName; if (ProjectHelper.FindPortName(ProjectHelper.Project, BoardType, deviceNumber, out portName)) { string serviceAddressMark; if (ProjectHelper.FindServiceAddressMark(ProjectHelper.Project, BoardType, deviceNumber, out serviceAddressMark)) { _boardParamInfos.Add(new BoardParamInfo { DeviceNumber = deviceNumber, Number = number, BoardType = BoardType, ServiceAddressMark = serviceAddressMark, PortName = portName }); } else { MessageBox.Show("请先设置工业版通讯地址。"); } } else { MessageBox.Show("请先设置工业版串口号。"); } } }