811 lines
23 KiB
C#
811 lines
23 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Threading;
|
|
using System.Windows.Forms;
|
|
|
|
namespace LP;
|
|
|
|
public class Form_GaoFengXianYuanYin : Form
|
|
{
|
|
private delegate void delegateFormSetTitle(Form form, string value);
|
|
|
|
private delegate void delegateComboBoxItemsClear(ComboBox comboBox);
|
|
|
|
private delegate void delegateComboBoxAdd(ComboBox comboBox, string value);
|
|
|
|
private delegate void delegateComboBoxSetSelectedIndex(ComboBox comboBox, int value);
|
|
|
|
private delegate void delegateListBoxItemsClear(ListBox listBox);
|
|
|
|
private delegate void delegateListBoxAdd(ListBox listBox, string value);
|
|
|
|
private delegate void delegateListBoxSetSelectedIndex(ListBox listBox, int value);
|
|
|
|
private delegate void delegateTextBoxSetText(TextBox textBox, string value);
|
|
|
|
private delegate void delegateTextBoxSetTextVisible(TextBox textBox, string value);
|
|
|
|
private delegate void delegateButtonEnabled(Button button, bool value);
|
|
|
|
private delegate void delegateFormHide(Form form);
|
|
|
|
public FormDesktop desktop = null;
|
|
|
|
private bool mAfterInit = false;
|
|
|
|
public bool mBusy = false;
|
|
|
|
public string mTitle = "";
|
|
|
|
public XianLuData mXianLuData = null;
|
|
|
|
public bool Busy_ComboBox_TaskName_PuTongJiSuan = false;
|
|
|
|
public int mIndex_ListXianLuData = -1;
|
|
|
|
public int mIndexControl_TaskName_PuTongJiSuan = -1;
|
|
|
|
private string mTaskName_PuTongJiSuan = "";
|
|
|
|
public TaskData mTaskData = null;
|
|
|
|
private float initWidth = 0f;
|
|
|
|
private float initHeight = 0f;
|
|
|
|
public DataGridView mDGView = null;
|
|
|
|
public DataSet mDS = null;
|
|
|
|
public string mMainKeyColumnName = "任务号";
|
|
|
|
private List<string> mList_SBH = null;
|
|
|
|
private int mIndex_ListDetails = -1;
|
|
|
|
private IContainer components = null;
|
|
|
|
private DataGridView dataGridView_GanTa;
|
|
|
|
private Button buttonCancel;
|
|
|
|
private Button buttonOK;
|
|
|
|
private Label label4;
|
|
|
|
private TextBox textBoxShowInfor;
|
|
|
|
private ComboBox comboBox_TaskName_PuTongJiSuan;
|
|
|
|
public Form_GaoFengXianYuanYin()
|
|
{
|
|
InitializeComponent();
|
|
mTitle = "高风险原因分析";
|
|
if (mDS == null)
|
|
{
|
|
mDS = new DataSet();
|
|
}
|
|
if (mList_SBH == null)
|
|
{
|
|
mList_SBH = new List<string>();
|
|
}
|
|
mList_SBH.Clear();
|
|
}
|
|
|
|
private void Form_GaoFengXianYuanYin_Load(object sender, EventArgs e)
|
|
{
|
|
mAfterInit = false;
|
|
MyFormSetTitle(this, "");
|
|
base.DialogResult = DialogResult.None;
|
|
if (mDGView == null)
|
|
{
|
|
mDGView = dataGridView_GanTa;
|
|
}
|
|
mDGView.Columns.Clear();
|
|
mDGView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells;
|
|
initWidth = base.Width;
|
|
initHeight = base.Height;
|
|
setTag(this);
|
|
MyInit_ComboBox_TaskName_PuTongJiSuan();
|
|
textBoxShowInfor.Text = "";
|
|
mBusy = false;
|
|
mAfterInit = true;
|
|
}
|
|
|
|
private void Form_GaoFengXianYuanYin_FormClosing(object sender, FormClosingEventArgs e)
|
|
{
|
|
}
|
|
|
|
private void MyInit_ComboBox_TaskName_PuTongJiSuan()
|
|
{
|
|
try
|
|
{
|
|
string text = "";
|
|
TaskDetail taskDetail = null;
|
|
MyComboBoxItemsClear(comboBox_TaskName_PuTongJiSuan);
|
|
for (int i = 0; i < desktop.mTask.mListDetails.Count; i++)
|
|
{
|
|
taskDetail = desktop.mTask.mListDetails[i];
|
|
if (taskDetail != null && taskDetail.mTaskData != null && (taskDetail.mTaskData.mTypeCode_Task == 1 || taskDetail.mTaskData.mTypeCode_Task == 4))
|
|
{
|
|
text = taskDetail.mTaskData.mName_Task;
|
|
if (!string.IsNullOrEmpty(text))
|
|
{
|
|
MyComboBoxAdd(comboBox_TaskName_PuTongJiSuan, text);
|
|
}
|
|
}
|
|
}
|
|
if (mIndexControl_TaskName_PuTongJiSuan < 0 || mIndexControl_TaskName_PuTongJiSuan >= comboBox_TaskName_PuTongJiSuan.Items.Count)
|
|
{
|
|
mIndexControl_TaskName_PuTongJiSuan = 0;
|
|
}
|
|
if (mIndexControl_TaskName_PuTongJiSuan >= 0 && mIndexControl_TaskName_PuTongJiSuan < comboBox_TaskName_PuTongJiSuan.Items.Count)
|
|
{
|
|
MyComboBoxSetSelectedIndex(comboBox_TaskName_PuTongJiSuan, mIndexControl_TaskName_PuTongJiSuan);
|
|
mTaskName_PuTongJiSuan = comboBox_TaskName_PuTongJiSuan.SelectedItem.ToString().Trim();
|
|
for (int j = 0; j < desktop.mTask.mListDetails.Count; j++)
|
|
{
|
|
taskDetail = desktop.mTask.mListDetails[j];
|
|
if (taskDetail == null || taskDetail.mTaskData == null)
|
|
{
|
|
continue;
|
|
}
|
|
text = taskDetail.mTaskData.mName_Task;
|
|
if (!text.Equals(mTaskName_PuTongJiSuan))
|
|
{
|
|
continue;
|
|
}
|
|
for (int k = 0; k < desktop.mXL.mListXianLuData.Count; k++)
|
|
{
|
|
if (taskDetail.mXianLuID_Detail == desktop.mXL.mListXianLuData[k].mID_XianLu)
|
|
{
|
|
mIndex_ListXianLuData = k;
|
|
mXianLuData = desktop.mXL.mListXianLuData[k];
|
|
break;
|
|
}
|
|
}
|
|
mIndex_ListDetails = j;
|
|
mTaskData = taskDetail.mTaskData;
|
|
GetDataSet();
|
|
MyQuery_refreshDGV();
|
|
break;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
mTaskName_PuTongJiSuan = "";
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MyLog.AddLog("Form_GaoFengXianYuanYin.cs MyInit_ListBox_TaskName_PuTongJiSuan() Exception=" + ex.Message);
|
|
}
|
|
}
|
|
|
|
public void Destroy()
|
|
{
|
|
if (mDS != null)
|
|
{
|
|
mDS.Clear();
|
|
mDS = null;
|
|
}
|
|
if (mList_SBH != null)
|
|
{
|
|
mList_SBH.Clear();
|
|
mList_SBH = null;
|
|
}
|
|
}
|
|
|
|
private bool ActionIsBusy()
|
|
{
|
|
return mBusy;
|
|
}
|
|
|
|
private void ActionSetBusy()
|
|
{
|
|
mBusy = true;
|
|
}
|
|
|
|
private void ActionClearBusy()
|
|
{
|
|
mBusy = false;
|
|
}
|
|
|
|
private void setTag(Control cons)
|
|
{
|
|
foreach (Control control in cons.Controls)
|
|
{
|
|
control.Tag = control.Width + ":" + control.Height + ":" + control.Left + ":" + control.Top + ":" + control.Font.Size;
|
|
if (control.Controls.Count > 0)
|
|
{
|
|
setTag(control);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void setControls(float scaleX, float scaleY, Control cons)
|
|
{
|
|
foreach (Control control in cons.Controls)
|
|
{
|
|
string[] array = control.Tag.ToString().Split(':');
|
|
float num = Convert.ToSingle(array[0]) * scaleX;
|
|
control.Width = (int)num;
|
|
num = Convert.ToSingle(array[1]) * scaleY;
|
|
if (control is ListBox)
|
|
{
|
|
num = Convert.ToSingle(array[1]) * 1f;
|
|
}
|
|
control.Height = (int)num;
|
|
num = Convert.ToSingle(array[2]) * scaleX;
|
|
control.Left = (int)num;
|
|
num = Convert.ToSingle(array[3]) * scaleY;
|
|
control.Top = (int)num;
|
|
float emSize = Convert.ToSingle(array[4]) * Math.Min(scaleX, scaleY);
|
|
control.Font = new Font(control.Font.Name, emSize, control.Font.Style, control.Font.Unit);
|
|
if (control.Controls.Count > 0)
|
|
{
|
|
setControls(scaleX, scaleY, control);
|
|
}
|
|
}
|
|
}
|
|
|
|
private void Form_GaoFengXianYuanYin_Resize(object sender, EventArgs e)
|
|
{
|
|
float scaleX = (float)base.Width / initWidth;
|
|
float scaleY = (float)base.Height / initHeight;
|
|
setControls(scaleX, scaleY, this);
|
|
}
|
|
|
|
private void GetDataSet()
|
|
{
|
|
try
|
|
{
|
|
if (mIndex_ListDetails < 0 || mIndex_ListDetails >= desktop.mTask.mListDetails.Count)
|
|
{
|
|
return;
|
|
}
|
|
if (mList_SBH == null)
|
|
{
|
|
mList_SBH = new List<string>();
|
|
}
|
|
mList_SBH.Clear();
|
|
if (mDS == null)
|
|
{
|
|
mDS = new DataSet();
|
|
}
|
|
if (mDS.Tables.Count == 0)
|
|
{
|
|
mDS.Tables.Add(new DataTable());
|
|
}
|
|
if (mDS.Tables[0].Rows.Count > 0)
|
|
{
|
|
mDS.Tables[0].Rows.Clear();
|
|
}
|
|
if (mDS.Tables[0].Columns.Count > 0)
|
|
{
|
|
mDS.Tables[0].Columns.Clear();
|
|
}
|
|
mDS.Tables[0].Columns.Add("任务号");
|
|
mDS.Tables[0].Columns.Add("杆塔号");
|
|
mDS.Tables[0].Columns.Add("杆塔模型");
|
|
mDS.Tables[0].Columns.Add("雷击风险等级");
|
|
mDS.Tables[0].Columns.Add("绝缘子串长度mm");
|
|
mDS.Tables[0].Columns.Add("绝缘子串长度档次");
|
|
mDS.Tables[0].Columns.Add("接地电阻Ω");
|
|
mDS.Tables[0].Columns.Add("接地电阻档次");
|
|
mDS.Tables[0].Columns.Add("高度档次");
|
|
mDS.Tables[0].Columns.Add("地面倾角");
|
|
mDS.Tables[0].Columns.Add("地面倾角档次");
|
|
mDS.Tables[0].Columns.Add("保护角档次");
|
|
mDS.Tables[0].Columns.Add("地理坐标°");
|
|
mDS.Tables[0].Columns.Add("档距");
|
|
mDS.Tables[0].Columns.Add("海拔高度m");
|
|
mDS.Tables[0].Columns.Add("地形");
|
|
mDS.Tables[0].Columns.Add("地闪密度 次/(km^2*年)");
|
|
mDS.Tables[0].Columns.Add("雷电流");
|
|
List<TaskData> list = null;
|
|
List<TGanTaData> list2 = null;
|
|
string text = "";
|
|
int num = 0;
|
|
CanShuFenJi canShuFenJi = null;
|
|
for (int i = 0; i < desktop.mTask.mListDetails.Count; i++)
|
|
{
|
|
if (i != mIndex_ListDetails)
|
|
{
|
|
continue;
|
|
}
|
|
list = desktop.mTask.mListDetails[i].mTaskGroup.mListExTaskData;
|
|
if (list == null)
|
|
{
|
|
continue;
|
|
}
|
|
for (int j = 0; j < list.Count; j++)
|
|
{
|
|
if (list[j] == null || list[j].mTGanTas == null || list[j].mTGanTas.mListTGanTaData == null)
|
|
{
|
|
continue;
|
|
}
|
|
list2 = list[j].mTGanTas.mListTGanTaData;
|
|
if (list2 == null)
|
|
{
|
|
continue;
|
|
}
|
|
for (int k = 0; k < list2.Count; k++)
|
|
{
|
|
if (list2[k].mFXDJ_GanTa <= 2)
|
|
{
|
|
continue;
|
|
}
|
|
text = desktop.mFunc.MyCanShu_1_HuaFenDangJi(list2, k, mXianLuData, _firstTry: true);
|
|
if (!text.Equals("OK"))
|
|
{
|
|
MyLog.AddLog("Form_GaoFengXianYuanYin.cs GetDataSet() sret=" + text);
|
|
continue;
|
|
}
|
|
num = desktop.mAll_CanShuFenJi.MyFind(list2[k].m_ID_CanShuFenJi);
|
|
if (num >= 0 && num < desktop.mAll_CanShuFenJi.mList_CanShuFenJi_all.Count)
|
|
{
|
|
canShuFenJi = desktop.mAll_CanShuFenJi.mList_CanShuFenJi_all[num];
|
|
DataRow dataRow = mDS.Tables[0].NewRow();
|
|
for (int l = 0; l < mDS.Tables[0].Columns.Count; l++)
|
|
{
|
|
dataRow[l] = "";
|
|
}
|
|
dataRow[0] = $"{list[j].mID_ExTask}";
|
|
dataRow[1] = list2[k].mID_GanTa ?? "";
|
|
dataRow[2] = list2[k].mModel_GanTa ?? "";
|
|
dataRow[3] = $"{list2[k].mFXDJ_GanTa}";
|
|
dataRow[4] = $"{canShuFenJi.mNew_JYZCD}";
|
|
dataRow[5] = $"{canShuFenJi.mFenJi_JYZCD}";
|
|
dataRow[6] = $"{canShuFenJi.mNew_JDDZ}";
|
|
dataRow[7] = $"{canShuFenJi.mFenJi_JDDZ}";
|
|
dataRow[8] = $"{canShuFenJi.mFJ_BLXGD}";
|
|
dataRow[9] = $"{list2[k].mDMQJ1_GanTa},{list2[k].mDMQJ2_GanTa}";
|
|
dataRow[10] = $"{canShuFenJi.mFJ_DMQJ}";
|
|
dataRow[11] = $"{canShuFenJi.mFJ_BaoHuJiao}";
|
|
dataRow[12] = $"{list2[k].mJingDu_GanTa}|{list2[k].mWeiDu_GanTa}";
|
|
dataRow[13] = $"{list2[k].mXiaoHao_GanTa},{list2[k].mDaHao_GanTa}";
|
|
dataRow[14] = $"{list2[k].mHaiBa_GanTa}";
|
|
dataRow[15] = list2[k].mDiXing_GanTa ?? "";
|
|
dataRow[16] = $"{list2[k].mDSMD_GanTa}";
|
|
dataRow[17] = $"{list2[k].mCurrent_a_GanTa},{list2[k].mCurrent_b_GanTa}";
|
|
mDS.Tables[0].Rows.Add(dataRow);
|
|
mList_SBH.Add($"{list2[k].mTaskIDstring}|{list2[k].mIndex__GanTa}");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (mDS.Tables[0].Rows.Count == 0)
|
|
{
|
|
if (mAfterInit)
|
|
{
|
|
MyFormSetTitle(this, "“" + desktop.mTask.mListDetails[mIndex_ListDetails].mTaskData.mName_Task + "”所有杆塔的雷击风险等级都小于3");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MyFormSetTitle(this, $" 共{mDS.Tables[0].Rows.Count}条");
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MyLog.AddLog("Form_GaoFengXianYuanYin.cs GetDataSet() Exception=" + ex.Message);
|
|
}
|
|
}
|
|
|
|
private void MyQuery_refreshDGV()
|
|
{
|
|
try
|
|
{
|
|
if (mDGView != null && mDGView.Columns.Count > 0)
|
|
{
|
|
if (mDGView.Columns.Contains("包含"))
|
|
{
|
|
mDGView.Columns.Remove("包含");
|
|
}
|
|
if (mDGView.Columns.Contains("关联数目"))
|
|
{
|
|
mDGView.Columns.Remove("关联数目");
|
|
}
|
|
}
|
|
mDGView.DataSource = null;
|
|
if (mDS != null && mDS.Tables.Count != 0)
|
|
{
|
|
DataTable dataTable = mDS.Tables[0];
|
|
mDGView.DataSource = dataTable.DefaultView;
|
|
if (mDGView.Columns.Contains(mMainKeyColumnName))
|
|
{
|
|
mDGView.Columns[mMainKeyColumnName].ReadOnly = true;
|
|
}
|
|
else
|
|
{
|
|
mDGView.Columns[0].ReadOnly = true;
|
|
}
|
|
if (dataTable.Rows.Count != 0 && !mAfterInit)
|
|
{
|
|
}
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MyLog.AddLog("Form_GaoFengXianYuanYin.cs MyQuery_refreshDGV() Exception=" + ex.Message);
|
|
}
|
|
}
|
|
|
|
private void comboBox_TaskName_PuTongJiSuan_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (ActionIsBusy())
|
|
{
|
|
return;
|
|
}
|
|
ActionSetBusy();
|
|
try
|
|
{
|
|
if (!mAfterInit)
|
|
{
|
|
ActionClearBusy();
|
|
return;
|
|
}
|
|
MyFormSetTitle(this, "正在更新...");
|
|
textBoxShowInfor.Text = "";
|
|
TaskDetail taskDetail = null;
|
|
int selectedIndex = ((ComboBox)sender).SelectedIndex;
|
|
mIndexControl_TaskName_PuTongJiSuan = selectedIndex;
|
|
mTaskName_PuTongJiSuan = ((ComboBox)sender).SelectedItem.ToString().Trim();
|
|
string text = "";
|
|
for (int i = 0; i < desktop.mTask.mListDetails.Count; i++)
|
|
{
|
|
taskDetail = desktop.mTask.mListDetails[i];
|
|
if (taskDetail == null || taskDetail.mTaskData == null)
|
|
{
|
|
continue;
|
|
}
|
|
text = taskDetail.mTaskData.mName_Task;
|
|
if (!text.Equals(mTaskName_PuTongJiSuan))
|
|
{
|
|
continue;
|
|
}
|
|
for (int j = 0; j < desktop.mXL.mListXianLuData.Count; j++)
|
|
{
|
|
if (taskDetail.mXianLuID_Detail == desktop.mXL.mListXianLuData[j].mID_XianLu)
|
|
{
|
|
mIndex_ListXianLuData = j;
|
|
mXianLuData = desktop.mXL.mListXianLuData[j];
|
|
break;
|
|
}
|
|
}
|
|
mIndex_ListDetails = i;
|
|
mTaskData = taskDetail.mTaskData;
|
|
GetDataSet();
|
|
MyQuery_refreshDGV();
|
|
break;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MyLog.AddLog("Form_GaoFengXianYuanYin.cs comboBox_TaskName_PuTongJiSuan_SelectedIndexChanged() Exception=" + ex.Message);
|
|
}
|
|
ActionClearBusy();
|
|
}
|
|
|
|
private void buttonOK_Click(object sender, EventArgs e)
|
|
{
|
|
}
|
|
|
|
private void buttonCancel_Click(object sender, EventArgs e)
|
|
{
|
|
if (ActionIsBusy())
|
|
{
|
|
return;
|
|
}
|
|
ActionSetBusy();
|
|
try
|
|
{
|
|
MyFormSetTitle(this, "");
|
|
MyButtonEnabled(buttonCancel, value: false);
|
|
Thread thread = new Thread(MyCancel);
|
|
thread.Start();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MyLog.AddLog("Form_GaoFengXianYuanYin.cs buttonCancel_Click() Exception=" + ex.Message);
|
|
ActionClearBusy();
|
|
}
|
|
}
|
|
|
|
private void MyCancel()
|
|
{
|
|
try
|
|
{
|
|
MyFormSetTitle(this, "取消—");
|
|
MyFormSetTitle(this, "取消———");
|
|
ActionClearBusy();
|
|
MyButtonEnabled(buttonCancel, value: true);
|
|
base.DialogResult = DialogResult.Cancel;
|
|
MyFormHide(this);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MyLog.AddLog("Form_GaoFengXianYuanYin.cs MyCancel() Exception=" + ex.Message);
|
|
}
|
|
ActionClearBusy();
|
|
}
|
|
|
|
private void dataGridView_GanTa_CellClick(object sender, DataGridViewCellEventArgs e)
|
|
{
|
|
int num = -1;
|
|
int num2 = -1;
|
|
int num3 = -1;
|
|
int[] array = new int[5] { 5, 7, 8, 10, 11 };
|
|
string[] array2 = new string[5] { "绝缘子串长度档次", "接地电阻档次", "高度档次", "地面倾角档次", "保护角档次" };
|
|
num = e.RowIndex;
|
|
num2 = e.ColumnIndex;
|
|
for (num3 = 0; num3 < array.Length && array[num3] != num2; num3++)
|
|
{
|
|
}
|
|
if (num < 0 || num >= dataGridView_GanTa.RowCount || num3 >= array.Length)
|
|
{
|
|
MyTextBoxSetTextVisible(textBoxShowInfor, "");
|
|
return;
|
|
}
|
|
string arg = dataGridView_GanTa.Rows[num].Cells[3].Value.ToString().Trim();
|
|
int num4 = -1;
|
|
try
|
|
{
|
|
num4 = Convert.ToInt32(dataGridView_GanTa.Rows[num].Cells[num2].Value.ToString().Trim());
|
|
}
|
|
catch (Exception)
|
|
{
|
|
num4 = 100;
|
|
}
|
|
if (num4 >= 1 && num4 <= 2)
|
|
{
|
|
MyTextBoxSetTextVisible(textBoxShowInfor, $"高风险原因:{array2[num3]}={num4},导致雷击风险等级={arg}");
|
|
}
|
|
else
|
|
{
|
|
MyTextBoxSetTextVisible(textBoxShowInfor, "");
|
|
}
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
|
|
public void MyComboBoxItemsClear(ComboBox comboBox)
|
|
{
|
|
if (comboBox.InvokeRequired)
|
|
{
|
|
delegateComboBoxItemsClear method = MyComboBoxItemsClear;
|
|
comboBox.Invoke(method, comboBox);
|
|
}
|
|
else
|
|
{
|
|
comboBox.Items.Clear();
|
|
}
|
|
}
|
|
|
|
public void MyComboBoxAdd(ComboBox comboBox, string value)
|
|
{
|
|
if (comboBox.InvokeRequired)
|
|
{
|
|
delegateComboBoxAdd method = MyComboBoxAdd;
|
|
comboBox.Invoke(method, comboBox, value);
|
|
}
|
|
else if (!string.IsNullOrEmpty(value))
|
|
{
|
|
comboBox.Items.Add(value);
|
|
}
|
|
}
|
|
|
|
public void MyComboBoxSetSelectedIndex(ComboBox comboBox, int value)
|
|
{
|
|
if (comboBox.InvokeRequired)
|
|
{
|
|
delegateComboBoxSetSelectedIndex method = MyComboBoxSetSelectedIndex;
|
|
comboBox.Invoke(method, comboBox, value);
|
|
}
|
|
else if (value >= 0 && value < comboBox.Items.Count)
|
|
{
|
|
comboBox.SelectedIndex = value;
|
|
}
|
|
}
|
|
|
|
public void MyListBoxItemsClear(ListBox listBox)
|
|
{
|
|
if (listBox.InvokeRequired)
|
|
{
|
|
delegateListBoxItemsClear method = MyListBoxItemsClear;
|
|
listBox.Invoke(method, listBox);
|
|
}
|
|
else
|
|
{
|
|
listBox.Items.Clear();
|
|
}
|
|
}
|
|
|
|
public void MyListBoxAdd(ListBox listBox, string value)
|
|
{
|
|
if (listBox.InvokeRequired)
|
|
{
|
|
delegateListBoxAdd method = MyListBoxAdd;
|
|
listBox.Invoke(method, listBox, value);
|
|
}
|
|
else if (!string.IsNullOrEmpty(value))
|
|
{
|
|
listBox.Items.Add(value);
|
|
}
|
|
}
|
|
|
|
public void MyListBoxSetSelectedIndex(ListBox listBox, int value)
|
|
{
|
|
if (listBox.InvokeRequired)
|
|
{
|
|
delegateListBoxSetSelectedIndex method = MyListBoxSetSelectedIndex;
|
|
listBox.Invoke(method, listBox, value);
|
|
}
|
|
else if (value >= 0 && value < listBox.Items.Count)
|
|
{
|
|
listBox.SelectedIndex = value;
|
|
}
|
|
}
|
|
|
|
public void MyTextBoxSetText(TextBox textBox, string value)
|
|
{
|
|
if (textBox.InvokeRequired)
|
|
{
|
|
delegateTextBoxSetText method = MyTextBoxSetText;
|
|
textBox.Invoke(method, textBox, value);
|
|
}
|
|
else
|
|
{
|
|
textBox.Text = value;
|
|
}
|
|
}
|
|
|
|
public void MyTextBoxSetTextVisible(TextBox textBox, string value)
|
|
{
|
|
if (textBox.InvokeRequired)
|
|
{
|
|
delegateTextBoxSetTextVisible method = MyTextBoxSetTextVisible;
|
|
textBox.Invoke(method, textBox, value);
|
|
}
|
|
else
|
|
{
|
|
textBox.Text = value;
|
|
textBox.Visible = !string.IsNullOrEmpty(value);
|
|
}
|
|
}
|
|
|
|
public void MyButtonEnabled(Button button, bool value)
|
|
{
|
|
if (button.InvokeRequired)
|
|
{
|
|
delegateButtonEnabled method = MyButtonEnabled;
|
|
button.Invoke(method, button, value);
|
|
}
|
|
else
|
|
{
|
|
button.Enabled = value;
|
|
}
|
|
}
|
|
|
|
public void MyFormHide(Form form)
|
|
{
|
|
try
|
|
{
|
|
if (form.InvokeRequired)
|
|
{
|
|
delegateFormHide method = MyFormHide;
|
|
form.Invoke(method, form);
|
|
}
|
|
else
|
|
{
|
|
form.Hide();
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
}
|
|
}
|
|
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
if (disposing && components != null)
|
|
{
|
|
components.Dispose();
|
|
}
|
|
base.Dispose(disposing);
|
|
}
|
|
|
|
private void InitializeComponent()
|
|
{
|
|
this.dataGridView_GanTa = new System.Windows.Forms.DataGridView();
|
|
this.buttonCancel = new System.Windows.Forms.Button();
|
|
this.buttonOK = new System.Windows.Forms.Button();
|
|
this.label4 = new System.Windows.Forms.Label();
|
|
this.textBoxShowInfor = new System.Windows.Forms.TextBox();
|
|
this.comboBox_TaskName_PuTongJiSuan = new System.Windows.Forms.ComboBox();
|
|
((System.ComponentModel.ISupportInitialize)this.dataGridView_GanTa).BeginInit();
|
|
base.SuspendLayout();
|
|
this.dataGridView_GanTa.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
|
|
this.dataGridView_GanTa.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
|
this.dataGridView_GanTa.Location = new System.Drawing.Point(28, 61);
|
|
this.dataGridView_GanTa.Name = "dataGridView_GanTa";
|
|
this.dataGridView_GanTa.RowTemplate.Height = 23;
|
|
this.dataGridView_GanTa.Size = new System.Drawing.Size(865, 451);
|
|
this.dataGridView_GanTa.TabIndex = 80;
|
|
this.dataGridView_GanTa.CellClick += new System.Windows.Forms.DataGridViewCellEventHandler(dataGridView_GanTa_CellClick);
|
|
this.buttonCancel.Location = new System.Drawing.Point(486, 518);
|
|
this.buttonCancel.Name = "buttonCancel";
|
|
this.buttonCancel.Size = new System.Drawing.Size(86, 28);
|
|
this.buttonCancel.TabIndex = 82;
|
|
this.buttonCancel.Text = "取消";
|
|
this.buttonCancel.UseVisualStyleBackColor = true;
|
|
this.buttonCancel.Click += new System.EventHandler(buttonCancel_Click);
|
|
this.buttonOK.Location = new System.Drawing.Point(270, 518);
|
|
this.buttonOK.Name = "buttonOK";
|
|
this.buttonOK.Size = new System.Drawing.Size(86, 28);
|
|
this.buttonOK.TabIndex = 81;
|
|
this.buttonOK.Text = "确定";
|
|
this.buttonOK.UseVisualStyleBackColor = true;
|
|
this.buttonOK.Click += new System.EventHandler(buttonOK_Click);
|
|
this.comboBox_TaskName_PuTongJiSuan.Font = new System.Drawing.Font("宋体", 12f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
|
|
this.comboBox_TaskName_PuTongJiSuan.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
|
this.comboBox_TaskName_PuTongJiSuan.FormattingEnabled = true;
|
|
this.comboBox_TaskName_PuTongJiSuan.Location = new System.Drawing.Point(28, 35);
|
|
this.comboBox_TaskName_PuTongJiSuan.Name = "comboBox_TaskName_PuTongJiSuan";
|
|
this.comboBox_TaskName_PuTongJiSuan.Size = new System.Drawing.Size(430, 20);
|
|
this.comboBox_TaskName_PuTongJiSuan.TabIndex = 79;
|
|
this.comboBox_TaskName_PuTongJiSuan.SelectedIndexChanged += new System.EventHandler(comboBox_TaskName_PuTongJiSuan_SelectedIndexChanged);
|
|
this.label4.AutoSize = true;
|
|
this.label4.Font = new System.Drawing.Font("宋体", 10.5f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
|
|
this.label4.Location = new System.Drawing.Point(26, 9);
|
|
this.label4.Name = "label4";
|
|
this.label4.Size = new System.Drawing.Size(119, 14);
|
|
this.label4.TabIndex = 83;
|
|
this.label4.Text = "已完成的普通任务";
|
|
this.textBoxShowInfor.Font = new System.Drawing.Font("宋体", 12f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 134);
|
|
this.textBoxShowInfor.Location = new System.Drawing.Point(474, 12);
|
|
this.textBoxShowInfor.Name = "textBoxShowInfor";
|
|
this.textBoxShowInfor.ReadOnly = true;
|
|
this.textBoxShowInfor.Size = new System.Drawing.Size(418, 26);
|
|
this.textBoxShowInfor.TabIndex = 84;
|
|
base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 12f);
|
|
base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
|
base.ClientSize = new System.Drawing.Size(917, 559);
|
|
base.Controls.Add(this.comboBox_TaskName_PuTongJiSuan);
|
|
base.Controls.Add(this.textBoxShowInfor);
|
|
base.Controls.Add(this.dataGridView_GanTa);
|
|
base.Controls.Add(this.buttonCancel);
|
|
base.Controls.Add(this.buttonOK);
|
|
base.Controls.Add(this.label4);
|
|
base.Name = "Form_GaoFengXianYuanYin";
|
|
base.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
|
this.Text = "Form_GaoFengXianYuanYin";
|
|
base.FormClosing += new System.Windows.Forms.FormClosingEventHandler(Form_GaoFengXianYuanYin_FormClosing);
|
|
base.Load += new System.EventHandler(Form_GaoFengXianYuanYin_Load);
|
|
base.Resize += new System.EventHandler(Form_GaoFengXianYuanYin_Resize);
|
|
((System.ComponentModel.ISupportInitialize)this.dataGridView_GanTa).EndInit();
|
|
base.ResumeLayout(false);
|
|
base.PerformLayout();
|
|
}
|
|
}
|