public AddTransmitterWindow() { InitializeComponent(); transLib = new TransmitterLib(); client = new ServiceReference1.Service1Client(); addTransimtter = new ServiceReference1.Transmitter(); if (File.Exists(MainWindow.nodeInfoFullPath)) { //向窗口中添加经纬度信息 addTransmitterLongitude_textBox2.Text = MainWindow.longitudeStr; addTransmitterLatitude_textBox3.Text = MainWindow.latitudeStr; string waveNamesOfCombox = FileOperation.ReadFile(MainWindow.nodeInfoFullPath); addTransmitterWaveformName_comboBox1.Items.Clear(); ArrayList waveNamesArr = new ArrayList(); //向工程树中添加波形节点 waveNamesArr = ProjectTreeMatchString.MatchStr(waveNamesOfCombox, SetupContent.waveIndeStr, SetupContent.waveIndeStr.Length); foreach (string s in waveNamesArr) { addTransmitterWaveformName_comboBox1.Items.Add(s); } } }
public NewTransmitterWindow() { InitializeComponent(); if (MainWindow.mProjectFullName == null) { return; } if (File.Exists(MainWindow.nodeInfoFullPath)) { antennaNamesOfCombox = FileOperation.ReadFile(MainWindow.nodeInfoFullPath); } if (MainWindow.nodeInfoFullPath != null) { newTransmitterLongitude_textBox1.Text = MainWindow.longitudeStr; newTransmitterLatitude_textBox3.Text = MainWindow.latitudeStr; ArrayList antennaNamesArr = new ArrayList(); //向工程树中添加波形节点 antennaNamesArr = ProjectTreeMatchString.MatchStr(antennaNamesOfCombox, SetupContent.antennaIndeStr, SetupContent.antennaIndeStr.Length); foreach (string s in antennaNamesArr) { newTransmitterAntennaName_comboBox3.Items.Add(s); } } }
private void OpenToolStripMenuItem_Click(object sender, EventArgs e) { LogFileManager.ObjLog.info("Begin"); if (mProjectFullName != null) { DialogResult result = MessageBox.Show("您是否要打开一个新的工程?若是则原工程将被关闭。", "提醒", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); if (DialogResult.OK == result) { MainWindow.staticTreeView.Nodes[0].Nodes[0].Remove(); } else { MainWindow.mProjectFullName = null; //王佳修改 MainWindow.setupStr = null; return; } } openProject.Filter = "setup文件(*.setup)|*.setup|所有文件|*.*"; DialogResult dr = openProject.ShowDialog(); if (dr == DialogResult.OK) { //在新建一个工程时,又打开这个工程则什么也不做 否则执行下面的操作 if (mProjectFullName != openProject.FileName) { setupStr = FileOperation.ReadFile(openProject.FileName); //.setup文件的包括路径的名字 mProjectFullName = openProject.FileName; //.setup.info文件的包含路径的名字 nodeInfoFullPath = openProject.FileName + ".info"; transInfoFullPath = openProject.FileName + ".transinfo"; relationOfAntAndWavePath = openProject.FileName + ".match"; waveinfoFilePath = openProject.FileName + ".waveinfo"; //工程的路径 不包括文件 MainWindow.projectRealPath = openProject.FileName.Substring(0, openProject.FileName.LastIndexOf("\\")); staticTreeView.Nodes.Clear(); //从信息文件中找出工程树中工程的名字将其加载到工程树中 string nodeNamesStr = FileOperation.ReadFile(nodeInfoFullPath); string projectNameStr = StringFound.FoundBackStr(SetupContent.projectIndeStr, nodeNamesStr, true); MainWindow.onlyProjectName = projectNameStr; longitudeStr = StringFound.FoundBackStr(SetupContent.longitudeIndeStr, nodeNamesStr, true); latitudeStr = StringFound.FoundBackStr(SetupContent.latitudeIndeStr, nodeNamesStr, true); staticTreeView.Nodes.Add("工程名字"); staticTreeView.Nodes[0].Nodes.Add(projectNameStr); staticTreeView.Nodes[0].Nodes[0].Nodes.Add("地形"); MainWindow.staticTreeView.Nodes[0].Nodes[0].Nodes.Add("波形"); MainWindow.staticTreeView.Nodes[0].Nodes[0].Nodes.Add("天线"); MainWindow.staticTreeView.Nodes[0].Nodes[0].Nodes.Add("辐射源"); MainWindow.staticTreeView.Nodes[0].Nodes[0].Nodes.Add("接收机"); MainWindow.staticTreeView.Nodes[0].Nodes[0].Nodes[4].Nodes.Add("点状分布"); MainWindow.staticTreeView.Nodes[0].Nodes[0].Nodes[4].Nodes.Add("区域分布"); MainWindow.staticTreeView.Nodes[0].Nodes[0].Nodes.Add("仿真结果设定"); ArrayList nodeNamesArr = new ArrayList(); //向工程树中添加波形节点 nodeNamesArr = ProjectTreeMatchString.MatchStr(nodeNamesStr, SetupContent.waveIndeStr, SetupContent.waveIndeStr.Length); foreach (string s in nodeNamesArr) { staticTreeView.Nodes[0].Nodes[0].Nodes[1].Nodes.Add(s); } //向工程树中添加地形节点 nodeNamesArr = ProjectTreeMatchString.MatchStr(nodeNamesStr, SetupContent.terrainIndeStr, SetupContent.terrainIndeStr.Length); foreach (string s in nodeNamesArr) { staticTreeView.Nodes[0].Nodes[0].Nodes[0].Nodes.Add(s); } //向工程树种添加天线结点 nodeNamesArr = ProjectTreeMatchString.MatchStr(nodeNamesStr, SetupContent.antennaIndeStr, SetupContent.antennaIndeStr.Length); foreach (string s in nodeNamesArr) { staticTreeView.Nodes[0].Nodes[0].Nodes[2].Nodes.Add(s); } //向工程树种添加辐射源结点 nodeNamesArr = ProjectTreeMatchString.MatchStr(nodeNamesStr, SetupContent.transmitterIndeStr, SetupContent.transmitterIndeStr.Length); foreach (string s in nodeNamesArr) { staticTreeView.Nodes[0].Nodes[0].Nodes[3].Nodes.Add(s); } //向工程树种添加点状接收机 nodeNamesArr = ProjectTreeMatchString.MatchStr(nodeNamesStr, SetupContent.pointReceiverIndeStr, SetupContent.pointReceiverIndeStr.Length); foreach (string s in nodeNamesArr) { staticTreeView.Nodes[0].Nodes[0].Nodes[4].Nodes[0].Nodes.Add(s); } //向工程树种添加线状接收机 nodeNamesArr = ProjectTreeMatchString.MatchStr(nodeNamesStr, SetupContent.gridReceiverIndeStr, SetupContent.gridReceiverIndeStr.Length); foreach (string s in nodeNamesArr) { staticTreeView.Nodes[0].Nodes[0].Nodes[4].Nodes[1].Nodes.Add(s); } //向工程树中加载结果设定的相应信息 string pathsResultStr = StringFound.FoundBackStr(SetupContent.resultSetIndeStr1, nodeNamesStr, false); //若结果设定中的复选框被选中 if (GetResultSetStr(pathsResultStr)) { //将复选框的状态保存到结果设定窗口中 PathsCheck.Checked = true; //在工程树中加载结果设定结点中加载相应的信息 staticTreeView.Nodes[0].Nodes[0].Nodes[5].Nodes.Add(SetupContent.resultSetOfTreeIndeStr1); } string pathlossResultStr = StringFound.FoundBackStr(SetupContent.resultSetIndeStr2, nodeNamesStr, false); if (GetResultSetStr(pathlossResultStr)) { PathlossCheck.Checked = true; staticTreeView.Nodes[0].Nodes[0].Nodes[5].Nodes.Add(SetupContent.resultSetOfTreeIndeStr2); } string eFieldResultStr = StringFound.FoundBackStr(SetupContent.resultSetIndeStr3, nodeNamesStr, false); if (GetResultSetStr(eFieldResultStr)) { EFieldCheck.Checked = true; staticTreeView.Nodes[0].Nodes[0].Nodes[5].Nodes.Add(SetupContent.resultSetOfTreeIndeStr3); } string eFieldTotalResultStr = StringFound.FoundBackStr(SetupContent.resultSetIndeStr4, nodeNamesStr, false); if (GetResultSetStr(eFieldTotalResultStr)) { EFieldTotalCheck.Checked = true; staticTreeView.Nodes[0].Nodes[0].Nodes[5].Nodes.Add(SetupContent.resultSetOfTreeIndeStr4); } string powerResultStr = StringFound.FoundBackStr(SetupContent.resultSetIndeStr5, nodeNamesStr, false); if (GetResultSetStr(powerResultStr)) { PowerCheck.Checked = true; staticTreeView.Nodes[0].Nodes[0].Nodes[5].Nodes.Add(SetupContent.resultSetOfTreeIndeStr5); } //判断用户是否关闭WI Process pro = null; try { pro = Process.GetProcessById(wiProcessID); } catch (ArgumentException) { //如果ID所对应的WI进程已被关闭,则再重新开启WI Process wiProcess = Process.Start(exePath, openProject.FileName); this.WindowState = FormWindowState.Normal; this.Activate(); MainWindow.wiProcessID = wiProcess.Id; return; } if (pro == null) { //如果WI进程还存在,则先将其关闭再打开重新加载工程 pro.Kill(); } else { Process wiProcess = Process.Start(exePath, openProject.FileName); //Process wiProcess = Process.Start(exePath, openProject.FileName); this.WindowState = FormWindowState.Normal; //this.TopMost = true; this.Activate(); this.WindowState = FormWindowState.Maximized; MainWindow.wiProcessID = wiProcess.Id; } } else { MessageBox.Show("该工程已经打开!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { mProjectFullName = null; } }