using System; using System.ComponentModel; using System.Drawing; using System.Threading; using System.Windows.Forms; namespace LP; public class FormCanShuJiSuan : Form { private delegate void delegateFormSetTitle(Form form, string value); public FormDesktop desktop = null; public string mTitle = ""; public string mMsg = ""; public TaskData mtData = null; private IContainer components = null; private Button buttonCurrent; private Button buttonDSMD; private Button buttonDMQJ; public FormCanShuJiSuan() { InitializeComponent(); if (mtData == null) { mtData = new TaskData(); } mTitle = "参数计算"; } private void FormCanShuJiSuan_Load(object sender, EventArgs e) { MyFormSetTitle(this, ""); MyInput_TaskData(); } private void FormCanShuJiSuan_FormClosing(object sender, FormClosingEventArgs e) { } public void MyInput_TaskData() { mtData.copyFrom_TaskData(desktop.mTheTaskData); } public void Destroy() { mTitle = ""; if (mtData != null) { mtData.Destroy(); } mtData = null; } private void buttonCurrent_Click(object sender, EventArgs e) { MyFormSetTitle(this, ""); DialogResult dialogResult = DialogResult.None; dialogResult = desktop.mDlg_Current.ShowDialog(this); if (dialogResult == DialogResult.OK && desktop.mXL.mCurrent_a_b_Ready) { MyFormSetTitle(this, $"雷电流a={desktop.mXL.mCurrent_a_All_GanTa} 雷电流b={desktop.mXL.mCurrent_b_All_GanTa}"); } } private void MyThread_SendTaskData() { for (int i = 0; i < 10; i++) { if (desktop.mAddTaskData.mID_Task <= 0) { break; } Thread.Sleep(1000); } desktop.mAddTaskData.copyFrom_TaskData(mtData); desktop.MySendForm_TaskData(desktop, desktop.mAddTaskData); } private void buttonDSMD_Click(object sender, EventArgs e) { MyFormSetTitle(this, ""); DialogResult dialogResult = DialogResult.None; dialogResult = desktop.mDlg_DiShanMiDu.ShowDialog(this); if (dialogResult == DialogResult.OK) { } } private void buttonDMQJ_Click(object sender, EventArgs e) { MyFormSetTitle(this, ""); DialogResult dialogResult = DialogResult.None; dialogResult = desktop.mDlg_DiMainQingJiao.ShowDialog(this); if (dialogResult == DialogResult.OK) { MyFormSetTitle(this, mMsg); } } public void MyFormSetTitle(Form form, string value) { if (form.InvokeRequired) { delegateFormSetTitle method = MyFormSetTitle; form.Invoke(method, form, value); return; } if (string.IsNullOrEmpty(value)) { form.Text = mTitle; } if (!string.IsNullOrEmpty(value)) { form.Text = mTitle + " —— " + value; } } protected override void Dispose(bool disposing) { if (disposing && components != null) { components.Dispose(); } base.Dispose(disposing); } private void InitializeComponent() { this.buttonCurrent = new System.Windows.Forms.Button(); this.buttonDSMD = new System.Windows.Forms.Button(); this.buttonDMQJ = new System.Windows.Forms.Button(); base.SuspendLayout(); this.buttonCurrent.Font = new System.Drawing.Font("宋体", 12f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134); this.buttonCurrent.Location = new System.Drawing.Point(21, 27); this.buttonCurrent.Name = "buttonCurrent"; this.buttonCurrent.Size = new System.Drawing.Size(126, 40); this.buttonCurrent.TabIndex = 0; this.buttonCurrent.Text = "雷电流幅值"; this.buttonCurrent.UseVisualStyleBackColor = true; this.buttonCurrent.Click += new System.EventHandler(buttonCurrent_Click); this.buttonDSMD.Font = new System.Drawing.Font("宋体", 12f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134); this.buttonDSMD.Location = new System.Drawing.Point(164, 27); this.buttonDSMD.Name = "buttonDSMD"; this.buttonDSMD.Size = new System.Drawing.Size(126, 40); this.buttonDSMD.TabIndex = 1; this.buttonDSMD.Text = "地闪密度"; this.buttonDSMD.UseVisualStyleBackColor = true; this.buttonDSMD.Click += new System.EventHandler(buttonDSMD_Click); this.buttonDMQJ.Font = new System.Drawing.Font("宋体", 12f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134); this.buttonDMQJ.Location = new System.Drawing.Point(307, 27); this.buttonDMQJ.Name = "buttonDMQJ"; this.buttonDMQJ.Size = new System.Drawing.Size(126, 40); this.buttonDMQJ.TabIndex = 2; this.buttonDMQJ.Text = "地面倾角"; this.buttonDMQJ.UseVisualStyleBackColor = true; this.buttonDMQJ.Click += new System.EventHandler(buttonDMQJ_Click); base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f); base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; base.ClientSize = new System.Drawing.Size(463, 92); base.Controls.Add(this.buttonDMQJ); base.Controls.Add(this.buttonDSMD); base.Controls.Add(this.buttonCurrent); base.Name = "FormCanShuJiSuan"; base.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.Text = "FormCSJS"; base.FormClosing += new System.Windows.Forms.FormClosingEventHandler(FormCanShuJiSuan_FormClosing); base.Load += new System.EventHandler(FormCanShuJiSuan_Load); base.ResumeLayout(false); } }