161 lines
4.4 KiB
C#
161 lines
4.4 KiB
C#
using System;
|
|
using System.ComponentModel;
|
|
using System.Drawing;
|
|
using System.Threading;
|
|
using System.Windows.Forms;
|
|
|
|
namespace LP;
|
|
|
|
public class FormFangLeiJiSuan : Form
|
|
{
|
|
private delegate void delegateFormSetTitle(Form form, string value);
|
|
|
|
public FormDesktop desktop = null;
|
|
|
|
public string mTitle = "";
|
|
|
|
public TaskData mtData = null;
|
|
|
|
private IContainer components = null;
|
|
|
|
private Button buttonTongTiaoJiSuan;
|
|
|
|
private Button buttonNormal;
|
|
|
|
public FormFangLeiJiSuan()
|
|
{
|
|
InitializeComponent();
|
|
if (mtData == null)
|
|
{
|
|
mtData = new TaskData();
|
|
}
|
|
mTitle = "防雷计算";
|
|
}
|
|
|
|
private void FormFangLeiJiSuan_Load(object sender, EventArgs e)
|
|
{
|
|
MyFormSetTitle(this, "");
|
|
}
|
|
|
|
private void FormFangLeiJiSuan_FormClosing(object sender, FormClosingEventArgs e)
|
|
{
|
|
}
|
|
|
|
public void MyInput_TaskData()
|
|
{
|
|
mtData.copyFrom_TaskData(desktop.mTheTaskData);
|
|
}
|
|
|
|
public void MyOutput_TaskData()
|
|
{
|
|
desktop.mTheTaskData.copyFrom_TaskData(mtData);
|
|
}
|
|
|
|
public void Destroy()
|
|
{
|
|
if (mtData != null)
|
|
{
|
|
mtData.Destroy();
|
|
}
|
|
mtData = null;
|
|
mTitle = "";
|
|
}
|
|
|
|
private void buttonNormal_Click(object sender, EventArgs e)
|
|
{
|
|
DialogResult dialogResult = DialogResult.None;
|
|
dialogResult = desktop.mDlg_PuTongJiSuan.ShowDialog(this);
|
|
if (dialogResult == DialogResult.OK)
|
|
{
|
|
Thread thread = new Thread(MyThread_SendTaskData);
|
|
thread.Start();
|
|
}
|
|
}
|
|
|
|
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 buttonTongTiaoJiSuan_Click(object sender, EventArgs e)
|
|
{
|
|
DialogResult dialogResult = DialogResult.None;
|
|
dialogResult = desktop.mDlg_TongTiaoJiSuan.ShowDialog(this);
|
|
if (dialogResult == DialogResult.OK)
|
|
{
|
|
Thread thread = new Thread(MyThread_SendTaskData);
|
|
thread.Start();
|
|
}
|
|
}
|
|
|
|
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.buttonTongTiaoJiSuan = new System.Windows.Forms.Button();
|
|
this.buttonNormal = new System.Windows.Forms.Button();
|
|
base.SuspendLayout();
|
|
this.buttonTongTiaoJiSuan.Font = new System.Drawing.Font("宋体", 12f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
|
|
this.buttonTongTiaoJiSuan.Location = new System.Drawing.Point(168, 26);
|
|
this.buttonTongTiaoJiSuan.Name = "buttonGaiZaoTuiJian";
|
|
this.buttonTongTiaoJiSuan.Size = new System.Drawing.Size(126, 40);
|
|
this.buttonTongTiaoJiSuan.TabIndex = 1;
|
|
this.buttonTongTiaoJiSuan.Text = "同跳计算";
|
|
this.buttonTongTiaoJiSuan.UseVisualStyleBackColor = true;
|
|
this.buttonTongTiaoJiSuan.Click += new System.EventHandler(buttonTongTiaoJiSuan_Click);
|
|
this.buttonNormal.Font = new System.Drawing.Font("宋体", 12f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
|
|
this.buttonNormal.Location = new System.Drawing.Point(25, 26);
|
|
this.buttonNormal.Name = "buttonGaoFengXianYuanYin";
|
|
this.buttonNormal.Size = new System.Drawing.Size(126, 40);
|
|
this.buttonNormal.TabIndex = 0;
|
|
this.buttonNormal.Text = "普通计算";
|
|
this.buttonNormal.UseVisualStyleBackColor = true;
|
|
this.buttonNormal.Click += new System.EventHandler(buttonNormal_Click);
|
|
base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
|
|
base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
base.ClientSize = new System.Drawing.Size(321, 92);
|
|
base.Controls.Add(this.buttonTongTiaoJiSuan);
|
|
base.Controls.Add(this.buttonNormal);
|
|
base.Name = "FormFangLeiJiSuan";
|
|
base.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
|
this.Text = "FormFangLeiJiSuan";
|
|
base.FormClosing += new System.Windows.Forms.FormClosingEventHandler(FormFangLeiJiSuan_FormClosing);
|
|
base.Load += new System.EventHandler(FormFangLeiJiSuan_Load);
|
|
base.ResumeLayout(false);
|
|
}
|
|
}
|