/// <summary> /// 监听自检 /// </summary> public BITE结果类型 CheckListen() { try { while (Interlocked.Read(ref _NumberForInterLock) == 0) { Thread.Sleep(5); } Interlocked.Decrement(ref _NumberForInterLock); _CreateUdpClient(Function_Module.GetConfig("本机IP"), Convert.ToInt32(Function_Module.GetConfig("本机端口"))); _UdpClient.Close(); Interlocked.Increment(ref _NumberForInterLock); return(BITE结果类型.正常); } catch (Exception) { if (_UdpClient != null) { _UdpClient.Close(); } Interlocked.Increment(ref _NumberForInterLock); return(BITE结果类型.断开连接); } }
public void SwitchControl(仪表选择 control) { while (Interlocked.Read(ref _NumberForInterLock) == 0) { Thread.Sleep(5); } Interlocked.Decrement(ref _NumberForInterLock); _CreateUdpClient(Function_Module.GetConfig("本机IP"), Convert.ToInt32(Function_Module.GetConfig("本机端口"))); byte[] sendBytes = GetSwitchControl(control); try { _UdpClient.Send(sendBytes, sendBytes.Length, _RemoteIP, _RemotePort); _UdpClient.Close(); Interlocked.Increment(ref _NumberForInterLock); } catch (Exception) { if (_UdpClient != null) { _UdpClient.Close(); } Interlocked.Increment(ref _NumberForInterLock); } }
public SettingsModule() { InitializeComponent(); _Settings_NetWork = new Settings矢网_高级选项(); textEdit_矢网地址.Text = Function_Module.GetConfig("矢网地址"); }
public Settings矢网_高级选项() { InitializeComponent(); textEdit_窗口1.Text = Function_Module.GetConfig("窗口1"); textEdit_窗口2.Text = Function_Module.GetConfig("窗口2"); textEdit_窗口3.Text = Function_Module.GetConfig("窗口3"); textEdit_窗口4.Text = Function_Module.GetConfig("窗口4"); }
public string Test建立连接() { try { _NetWork.VisaOpen(); return("连接成功"); } catch (Exception) { return("矢网连接失败,地址:" + Function_Module.GetConfig("矢网地址") + ",请尝试重新连接"); } }
public DataModule() { InitializeComponent(); comboBoxEdit_类型选择.Properties.Items.AddRange(Function_Module.GetConfig("类型选择").Split(';')); comboBoxEdit_类型选择.SelectedIndex = 0; textEdit_矢网地址.Text = Function_Module.GetConfig("矢网地址"); textEdit_保存路径.Text = Function_Module.GetConfig("保存路径"); Test数据采集 = new Test数据采集(NetWork); //连接测试 string res = Test数据采集.Test建立连接(); if (res != "连接成功") { MessageBox.Show(res); } }
public BITE结果类型 BITEControl() { while (Interlocked.Read(ref _NumberForInterLock) == 0) { Thread.Sleep(5); } Interlocked.Decrement(ref _NumberForInterLock); _CreateUdpClient(Function_Module.GetConfig("本机IP"), Convert.ToInt32(Function_Module.GetConfig("本机端口"))); byte[] sendBytes = GetBITEControl(); byte[] recvBytes = new byte[6]; try { _UdpClient.Send(sendBytes, sendBytes.Length, _RemoteIP, _RemotePort); _UdpClient.Client.ReceiveTimeout = 3000; if (_UdpClient.Client.Receive(recvBytes) > 0) { _UdpClient.Close(); Interlocked.Increment(ref _NumberForInterLock); return((BITE结果类型)recvBytes[2]); } else { _UdpClient.Close(); Interlocked.Increment(ref _NumberForInterLock); return(BITE结果类型.断开连接); } } catch (Exception) { if (_UdpClient != null) { _UdpClient.Close(); } Interlocked.Increment(ref _NumberForInterLock); return(BITE结果类型.断开连接); } }
public bool DriverPowerControl(驱动功放 power) { while (Interlocked.Read(ref _NumberForInterLock) == 0) { Thread.Sleep(5); } Interlocked.Decrement(ref _NumberForInterLock); _CreateUdpClient(Function_Module.GetConfig("本机IP"), Convert.ToInt32(Function_Module.GetConfig("本机端口"))); byte[] sendBytes = GetDriverPowerControl(power); byte[] recvBytes = new byte[6]; try { _UdpClient.Send(sendBytes, sendBytes.Length, _RemoteIP, _RemotePort); _UdpClient.Client.ReceiveTimeout = 3000; if (_UdpClient.Client.Receive(recvBytes) > 0) { _UdpClient.Close(); Interlocked.Increment(ref _NumberForInterLock); return(true); } else { _UdpClient.Close(); Interlocked.Increment(ref _NumberForInterLock); return(false); } } catch (Exception ex) { if (_UdpClient != null) { _UdpClient.Close(); } Console.WriteLine(ex.Message); Interlocked.Increment(ref _NumberForInterLock); return(false); } }
public ucStartTest2(DataModule datamodule) { InitializeComponent(); _DataModule = datamodule; if (Function_Module.GetConfig("模式") == "DEBUG") { for (decimal i = 0; i < 16; i++) { List延时.Add(i + "λ"); } //延时 for (decimal i = 0; i < 32; i = i + 0.5m) { List衰减.Add(i + "dB"); } //移相选择项目初始化 for (int i = 0; i < 64; i++) { List移相.Add(i * 5.625 + "°"); } repositoryItemComboBox_延时.Items.AddRange(List延时); repositoryItemComboBox_衰减.Items.AddRange(List衰减); repositoryItemComboBox_移相.Items.AddRange(List移相); comboBoxEdit_延时.Properties.Items.AddRange(List延时); comboBoxEdit_移相.Properties.Items.AddRange(List移相); comboBoxEdit_衰减.Properties.Items.AddRange(List衰减); comboBoxEdit_延时.SelectedIndex = 0; comboBoxEdit_移相.SelectedIndex = 0; comboBoxEdit_衰减.SelectedIndex = 0; //加载数据模型 for (int i = 1; i <= 16; i++) { ListTestModel.Add(new TestModel2() { 通道号 = i.ToString(), }); if (i % 2 == 0) { List子阵Model.Add(new Test子阵Model() { 延时 = "0λ", 子阵开关 = false, }); } } } else { List延时.AddRange(Function_Module.GetConfig("延迟").Split(';')); List移相.AddRange(Function_Module.GetConfig("移相").Split(';')); List衰减.AddRange(Function_Module.GetConfig("衰减").Split(';')); repositoryItemComboBox_延时.Items.AddRange(List延时); repositoryItemComboBox_衰减.Items.AddRange(List衰减); repositoryItemComboBox_移相.Items.AddRange(List移相); comboBoxEdit_延时.Properties.Items.AddRange(List延时); comboBoxEdit_移相.Properties.Items.AddRange(List移相); comboBoxEdit_衰减.Properties.Items.AddRange(List衰减); comboBoxEdit_延时.SelectedIndex = 0; comboBoxEdit_移相.SelectedIndex = 0; comboBoxEdit_衰减.SelectedIndex = 0; //加载数据模型 for (int i = 1; i <= 16; i++) { ListTestModel.Add(new TestModel2() { 通道号 = i.ToString(), }); if (i % 2 == 0) { List子阵Model.Add(new Test子阵Model() { 延时 = "0λ", 子阵开关 = false, }); } } } gridControl1.DataSource = ListTestModel; gridControl2.DataSource = List子阵Model; }
public ControlModule() { _RemoteIP = Function_Module.GetConfig("控制模块IP"); _RemotePort = Convert.ToInt32(Function_Module.GetConfig("控制模块端口")); }