清理无用代码
This commit is contained in:
@@ -3,15 +3,9 @@ using JinYuan.Models;
|
||||
using MiniExcelLibs;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml.Schema;
|
||||
|
||||
namespace LargeSquareOne
|
||||
{
|
||||
@@ -62,7 +56,7 @@ namespace LargeSquareOne
|
||||
|
||||
return new List<Group>();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -112,10 +106,10 @@ namespace LargeSquareOne
|
||||
/// <param name="e"></param>
|
||||
private void btn_Add_Click(object sender, EventArgs e)
|
||||
{
|
||||
string groupName =this.txt_GroupName.Text.Trim();
|
||||
if (groupName.Length==0)
|
||||
string groupName = this.txt_GroupName.Text.Trim();
|
||||
if (groupName.Length == 0)
|
||||
{
|
||||
new FrmMsgBoxOutWithAck(2,"通信组名称不能为空!", "添加通信组").Show();
|
||||
new FrmMsgBoxOutWithAck(2, "通信组名称不能为空!", "添加通信组").Show();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -127,28 +121,28 @@ namespace LargeSquareOne
|
||||
|
||||
TotalGroups.Add(new Group()
|
||||
{
|
||||
GroupName=this.txt_GroupName.Text,
|
||||
Start=this.txtStart.Text,
|
||||
GroupName = this.txt_GroupName.Text,
|
||||
Start = this.txtStart.Text,
|
||||
Length = Convert.ToUInt16(this.num_Length.Value),
|
||||
IsTiggerRead = this.ckb_IsTiggerRead.Checked ?true : false,
|
||||
IsFeedbackPlc= this.chk_IsFeedbackPlc.Checked ? true : false,
|
||||
IsTiggerRead = this.ckb_IsTiggerRead.Checked ? true : false,
|
||||
IsFeedbackPlc = this.chk_IsFeedbackPlc.Checked ? true : false,
|
||||
IsActive = this.ckb_IsEnable.Checked ? true : false,
|
||||
Remark =this.txt_Remark.Text.Trim()
|
||||
Remark = this.txt_Remark.Text.Trim()
|
||||
});
|
||||
|
||||
try
|
||||
{
|
||||
MiniExcel.SaveAs(groupPath, TotalGroups, overwriteFile: true);
|
||||
new FrmMsgBoxOutWithAck(1,"添加通信组成功", "添加通信组").Show();
|
||||
new FrmMsgBoxOutWithAck(1, "添加通信组成功", "添加通信组").Show();
|
||||
|
||||
//刷新数据
|
||||
RefreshGroup();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
new FrmMsgBoxOutWithAck(3,"添加通信组失败:"+ex.Message, "添加通信组").Show();
|
||||
new FrmMsgBoxOutWithAck(3, "添加通信组失败:" + ex.Message, "添加通信组").Show();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -159,7 +153,7 @@ namespace LargeSquareOne
|
||||
private void btn_Delete_Click(object sender, EventArgs e)
|
||||
{
|
||||
string groupName = this.txt_GroupName.Text.Trim();
|
||||
|
||||
|
||||
if (IsGroupNameExits(groupName))
|
||||
{
|
||||
new FrmMsgBoxOutWithAck(2, "通信组名称不存在!", "删除通信组").Show();
|
||||
@@ -196,11 +190,11 @@ namespace LargeSquareOne
|
||||
return;
|
||||
}
|
||||
|
||||
var group =TotalGroups.Find(c=>c.GroupName == groupName);
|
||||
var group = TotalGroups.Find(c => c.GroupName == groupName);
|
||||
|
||||
group.Start = this.txtStart.Text;
|
||||
group.Length = Convert.ToUInt16(this.num_Length.Value);
|
||||
group.IsTiggerRead = this.ckb_IsTiggerRead.Checked ? true: false;
|
||||
group.IsTiggerRead = this.ckb_IsTiggerRead.Checked ? true : false;
|
||||
group.IsFeedbackPlc = this.chk_IsFeedbackPlc.Checked ? true : false;
|
||||
group.IsActive = this.ckb_IsEnable.Checked ? true : false;
|
||||
group.Remark = this.txt_Remark.Text.Trim();
|
||||
@@ -247,14 +241,15 @@ namespace LargeSquareOne
|
||||
/// <param name="e"></param>
|
||||
private void dgv_Main_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)
|
||||
{
|
||||
if (e.ColumnIndex >= 0&&e.RowIndex>=0)
|
||||
if (e.ColumnIndex >= 0 && e.RowIndex >= 0)
|
||||
{
|
||||
object value = this.dgv_Main.Rows[e.RowIndex].Cells[e.ColumnIndex].Value;
|
||||
|
||||
if (value == null||value.ToString().Length==0)
|
||||
{
|
||||
e.Value = "---";
|
||||
};
|
||||
if (value == null || value.ToString().Length == 0)
|
||||
{
|
||||
e.Value = "---";
|
||||
}
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -266,7 +261,7 @@ namespace LargeSquareOne
|
||||
/// <param name="e"></param>
|
||||
private void dgv_Main_CellClick(object sender, DataGridViewCellEventArgs e)
|
||||
{
|
||||
if (e.RowIndex>=0)
|
||||
if (e.RowIndex >= 0)
|
||||
{
|
||||
UpdateGroup(TotalGroups[e.RowIndex]);
|
||||
}
|
||||
@@ -274,7 +269,7 @@ namespace LargeSquareOne
|
||||
|
||||
private void UpdateGroup(Group group)
|
||||
{
|
||||
if (group!=null)
|
||||
if (group != null)
|
||||
{
|
||||
this.txt_GroupName.Text = group.GroupName;
|
||||
this.txtStart.Text = group.Start;
|
||||
@@ -282,7 +277,7 @@ namespace LargeSquareOne
|
||||
this.ckb_IsTiggerRead.Checked = group.IsTiggerRead;
|
||||
this.chk_IsFeedbackPlc.Checked = group.IsFeedbackPlc;
|
||||
this.ckb_IsEnable.Checked = group.IsActive;
|
||||
this.txt_Remark.Text = group.Remark;
|
||||
this.txt_Remark.Text = group.Remark;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user