Beispiel #1
0
        //单击更改时执行此方法
        public static bool ReceiverUpdateMenu(TreeNode currentNode)
        {
            //bool b = false;
            string rxFilePath = MainWindow.projectRealPath + "\\" + MainWindow.onlyProjectName + ".rx";
            //保存Tr文件中的字符串
            string rxFileStrTemp = FileOperation.ReadFile(rxFilePath);
            string indStr        = null;

            switch (currentNode.Parent.Text)
            {
            case "点状分布":
                indStr = SetupContent.pointReceiverOfRxStr0;
                break;

            case "区域分布":
                indStr = SetupContent.gridReceiverOfRxStr0;
                break;
            }

            //将接收机在rx文件中的位置保护起来
            int initialReceiverBlockSite = rxFileStrTemp.IndexOf(indStr + " " + currentNode.Text + "\r\n");
            //rx文件中原来接收机的编号也要保存下来
            string initReceiverNum = GetReceiverNumLine(indStr, currentNode.Text, rxFileStrTemp);
            //保存info文件中的所有字符串
            string receiverNodeInfoTemp = FileOperation.ReadFile(MainWindow.nodeInfoFullPath);
            //保存接收机在info文件中的位置信息
            int initialReceiverNodeSite = receiverNodeInfoTemp.IndexOf(indStr + " " + currentNode.Text + "\r\n");
            //保存waveinfo文件中有关接收机的信息
            string receiverParStrTemp = FileOperation.ReadFile(MainWindow.waveinfoFilePath);

            NewReceiverWindow newReceiverWin = new NewReceiverWindow();

            //将接收机原来的参数信息装载到窗口中
            if (!ReceiverDataRecoverOfProjectTreeView.RecoverReceiverParOfWin(currentNode, receiverParStrTemp, newReceiverWin))
            {
                MessageBox.Show("程序内部发生错误!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                FileOperation.RecoverOldRevision(rxFileStrTemp, rxFilePath, receiverParStrTemp, receiverNodeInfoTemp);
                return(false);
            }
            //ReceiverDataRecoverOfProjectTreeView.RecoverReceiverParOfWin(currentNode, receiverParStrTemp, newReceiverWin);
            //在单击确定按钮之前应将需更改的接收机的信息从各个文件中删除
            if (!(ReceiverDelOfRxAndInfoFile(currentNode) && ReceiverDelOfWaveInfo(currentNode) && ReceiverUpdateOfSetup()))
            {
                MessageBox.Show("程序内部发生错误!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                FileOperation.RecoverOldRevision(rxFileStrTemp, rxFilePath, receiverParStrTemp, receiverNodeInfoTemp);
                return(false);
            }

            MainWindow.creatSuccMesDisp = false;
            MainWindow.newFuncSign      = false;
            newReceiverWin.Text         = "更改接收机";
            newReceiverWin.ShowDialog();
            switch (newReceiverWin.DialogResult)
            {
            case DialogResult.OK:
                if (MainWindow.IsReturnMidwayInNewProcess)
                {
                    //FileOperation.WriteFile(rxFileStrTemp, rxFilePath, false);
                    //FileOperation.WriteFile(receiverParStrTemp, MainWindow.waveinfoFilePath, false);
                    //FileOperation.WriteFile(receiverNodeInfoTemp, MainWindow.nodeInfoFullPath, false);
                    FileOperation.RecoverOldRevision(rxFileStrTemp, rxFilePath, receiverParStrTemp, receiverNodeInfoTemp);
                    MainWindow.IsReturnMidwayInNewProcess = false;
                    return(false);
                }
                if (!rxStrRecoverInitReceiverNum(currentNode, initReceiverNum, initialReceiverBlockSite, initialReceiverNodeSite))
                {
                    if (currentNode.Parent.Text.Equals("点状分布"))
                    {
                        MainWindow.staticTreeView.Nodes[0].Nodes[0].Nodes[4].Nodes[0].LastNode.Remove();
                    }
                    else
                    {
                        MainWindow.staticTreeView.Nodes[0].Nodes[0].Nodes[4].Nodes[1].LastNode.Remove();
                    }


                    MessageBox.Show("程序内部发生错误,更改操作失败!", "错误", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    FileOperation.RecoverOldRevision(rxFileStrTemp, rxFilePath, receiverParStrTemp, receiverNodeInfoTemp);
                    //FileOperation.WriteFile(rxFileStrTemp, rxFilePath, false);
                    //FileOperation.WriteFile(receiverParStrTemp, MainWindow.waveinfoFilePath, false);
                    //FileOperation.WriteFile(receiverNodeInfoTemp, MainWindow.nodeInfoFullPath, false);
                    return(false);
                }
                switch (currentNode.Parent.Text)
                {
                case "点状分布":
                    MainWindow.staticTreeView.SelectedNode.Text = MainWindow.staticTreeView.Nodes[0].Nodes[0].Nodes[4].Nodes[0].LastNode.Text;
                    MainWindow.staticTreeView.Nodes[0].Nodes[0].Nodes[4].Nodes[0].LastNode.Remove();
                    break;

                case "区域分布":
                    MainWindow.staticTreeView.SelectedNode.Text = MainWindow.staticTreeView.Nodes[0].Nodes[0].Nodes[4].Nodes[1].LastNode.Text;
                    MainWindow.staticTreeView.Nodes[0].Nodes[0].Nodes[4].Nodes[1].LastNode.Remove();
                    break;
                }
                return(true);

            //break;
            default:
                FileOperation.RecoverOldRevision(rxFileStrTemp, rxFilePath, receiverParStrTemp, receiverNodeInfoTemp);
                //FileOperation.WriteFile(rxFileStrTemp, rxFilePath, false);

                //FileOperation.WriteFile(receiverParStrTemp, MainWindow.waveinfoFilePath, false);
                //FileOperation.WriteFile(receiverNodeInfoTemp, MainWindow.nodeInfoFullPath, false);
                return(false);
                //break;
            }
            //b = true;
            //return b;
        }
Beispiel #2
0
 private void receiver_toolStripButton5_Click(object sender, EventArgs e)
 {
     f11 = OpenNewForm <NewReceiverWindow>(f11);
 }
Beispiel #3
0
        //将接收机原来的参数信息加载到窗口中
        public static bool RecoverReceiverParOfWin(TreeNode currentNode, string allReceiverInfoStr, NewReceiverWindow newReceiverWin)
        {
            bool b = false;

            try
            {
                string   transmitterBlockStr = GetBlockOfReceiver(currentNode, allReceiverInfoStr);
                char[]   sep     = { '\r', '\r', '\r', '\r', '\r', '\r', '\r', '\r', '\r' };
                string[] partStr = transmitterBlockStr.Split(sep);
                newReceiverWin.newReceiverName_textBox2.Text = currentNode.Text;
                newReceiverWin.newRceiverType_comboBox1.Text = partStr[1].Trim('\n');

                newReceiverWin.newReceiverReferencePlane_comboBox2.Text = partStr[2].Trim('\n');
                newReceiverWin.newReceiverAntennaName_comboBox3.Text    = partStr[3].Trim('\n');
                //newAntennaWin.newdipolepolarization_comboBox3.SelectedItem = partStr[4].Trim('\n');
                newReceiverWin.newReceiverAntennaHeight_textBox1.Text     = partStr[4].Trim('\n');
                newReceiverWin.newReceiverSpace_textBox1.Text             = partStr[5].Trim('\n');
                newReceiverWin.newReceiverAntennaRotationX_textBox4.Text  = partStr[6].Trim('\n');
                newReceiverWin.newReceiverAntennaRotationY_textBox6.Text  = partStr[7].Trim('\n');
                newReceiverWin.newReceiverAntennaRotationXZ_textBox5.Text = partStr[8].Trim('\n');
                //if (currentNode.Parent.Text.Equals("区域分布"))
                //{
                //    newReceiverWin.newReceiverSpace_textBox1.Text = partStr[8].Trim('\n');
                //}

                b = true;
            }
            catch (Exception e)
            {
                LogFileManager.ObjLog.fatal(e.Message, e);
            }
            return(b);
        }