123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- 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 (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(() =>
- {
- try
- {
- DataEmulationHelper.GenSignalsWithDtDf(file1, file2, fsHz, (int)(sigTimeLen * 1000), dt / 1e6, df);
- }
- catch (Exception ex)
- {
- }
- });
- btnBuilder.Enabled = true;
- }
- }
- }
|