Пример #1
0
        /// <summary>
        /// 发送指令
        /// </summary>
        private void SendCommands()
        {
            (_Module as ucStartTest2).gridView1.CloseEditor();
            (_Module as ucStartTest2).gridView2.CloseEditor();

            SerialPort.SerialPort_Send(CommandAnalyzier.Writer((_Module as ucStartTest2).ListTestModel, (_Module as ucStartTest2).List子阵Model));

            //构造路径
            _DataModule.AddPath((_Module as ucStartTest2).repositoryItemComboBox_移相.Items.IndexOf((_Module as ucStartTest2).ListTestModel[Convert.ToInt32(_DataModule.textEdit_采集通道.Text) - 1].移相).ToString());
            if (Convert.ToInt32(_DataModule.textEdit_采集通道.Text) <= 4)
            {
                _DataModule.AddPath((_Module as ucStartTest2).repositoryItemComboBox_延时.Items.IndexOf((_Module as ucStartTest2).List子阵Model[(Convert.ToInt32(_DataModule.textEdit_采集通道.Text) - 1)].延时).ToString());
            }
            else if (Convert.ToInt32(_DataModule.textEdit_采集通道.Text) >= 9 && Convert.ToInt32(_DataModule.textEdit_采集通道.Text) <= 12)
            {
                _DataModule.AddPath((_Module as ucStartTest2).repositoryItemComboBox_延时.Items.IndexOf((_Module as ucStartTest2).List子阵Model[(Convert.ToInt32(_DataModule.textEdit_采集通道.Text) - 5)].延时).ToString());
            }
            _DataModule.AddPath((_Module as ucStartTest2).repositoryItemComboBox_衰减.Items.IndexOf((_Module as ucStartTest2).ListTestModel[Convert.ToInt32(_DataModule.textEdit_采集通道.Text) - 1].衰减).ToString());

            if (_DataModule.toggleSwitch_开关.IsOn)
            {
                Thread.Sleep(Convert.ToInt32(_DataModule.textEdit_采集延时.Text));
                if (!_DataModule.SaveS2p(_DataModule.GetPath()))
                {
                    AppendTexxt("提示:", "数据采集失败,检查矢网连接");
                }
                Thread.Sleep(Convert.ToInt32(_DataModule.textEdit_采集延时.Text));
            }
        }