12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- using DevExpress.XtraEditors;
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.IO;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace XdCxRhDW.DataEmulation
- {
- public partial class Form1 : DevExpress.XtraEditors.XtraForm
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void btnOpenDir_Click(object sender, EventArgs e)
- {
- System.Diagnostics.Process.Start("explorer.exe", ".\\");
- }
- private async void btnBuilder_ClickAsync(object sender, EventArgs e)
- {
- string file1 = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, txtFile1.Text);
- string file2 = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, txtFile2.Text);
- if (!long.TryParse(txtFsHz.Text, out long fsHz))
- {
- XtraMessageBox.Show("采样率非数字!");
- return;
- }
- if (!double.TryParse(txtSigLen.Text, out double sigTimeLen))
- {
- XtraMessageBox.Show("信号时长非数字!");
- return;
- }
- if (!double.TryParse(txtDto.Text, out double dt))
- {
- XtraMessageBox.Show("时差非数字!");
- return;
- }
- if (!double.TryParse(txtDfo.Text, out double df))
- {
- XtraMessageBox.Show("频差非数字!");
- return;
- }
- if (!double.TryParse(txtSnr1.Text, out double snr1))
- {
- XtraMessageBox.Show("文件1信噪比非数字!");
- return;
- }
- if (!double.TryParse(txtSnr2.Text, out double snr2))
- {
- XtraMessageBox.Show("文件2信噪比非数字!");
- return;
- }
- if (fsHz <= 0 || fsHz > 100000000)
- {
- XtraMessageBox.Show("采样率范围(0,100000000]!");
- return;
- }
- if (sigTimeLen <= 0 || sigTimeLen > 120)
- {
- XtraMessageBox.Show("信号时长范围(0,120]!");
- return;
- }
- btnBuilder.Enabled = false;
- await Task.Run(() =>
- {
- DataEmulationHelper.GenSignalsWithDtDf(file1, file2, fsHz, (int)(sigTimeLen * 1000), dt / 1e6, df, (int)snr1, (int)snr2);
- });
- btnBuilder.Enabled = true;
- }
- }
- }
|