程序页面选择异常问题
This commit is contained in:
commit
a0ac4e094c
2 files changed
+120
-21
No files matched your search
+120
-19
@@ -25,6 +25,7 @@ using System.Windows.Media.Imaging;
|
|||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
|
using TouchSocket.Core;
|
||||||
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
|
||||||
using static SunlightCentralizedControlManagement_SCCM_.WindowsView.ViewStep;
|
using static SunlightCentralizedControlManagement_SCCM_.WindowsView.ViewStep;
|
||||||
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||||
@@ -135,7 +136,47 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
StepTime = (Grid_step.Columns[16].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//
|
StepTime = (Grid_step.Columns[16].GetCellContent(Grid_step.Items[rownum]) as TextBlock).Text;//
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
|
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
|
||||||
if (ID == null) ID = Step.Rows.Count.ToString();
|
if (string.IsNullOrEmpty(ID))
|
||||||
|
{
|
||||||
|
DataRow dr = Step.NewRow();//添加表数据
|
||||||
|
dr["ProgramID"] = ProgramID;
|
||||||
|
dr["Program"] = ProgramNAME;
|
||||||
|
dr["Parameter1"] = 0;
|
||||||
|
dr["Parameter2"] = 0;
|
||||||
|
dr["Parameter3"] = 0;
|
||||||
|
dr["Parameter4"] = 0;
|
||||||
|
dr["Parameter5"] = 0;
|
||||||
|
dr["Parameter6"] = 0;
|
||||||
|
dr["Parameter7"] = 0;
|
||||||
|
dr["Parameter8"] = 0;
|
||||||
|
dr["Parameter9"] = 0;
|
||||||
|
dr["Parameter10"] = 0;
|
||||||
|
dr["Parameter1_S1"] = 0;
|
||||||
|
dr["Parameter2_S1"] = 0;
|
||||||
|
dr["Parameter3_S1"] = 0;
|
||||||
|
dr["Parameter4_S1"] = 0;
|
||||||
|
dr["Parameter5_S1"] = 0;
|
||||||
|
dr["Parameter1_S2"] = 0;
|
||||||
|
dr["Parameter2_S2"] = 0;
|
||||||
|
dr["Parameter3_S2"] = 0;
|
||||||
|
dr["Parameter4_S2"] = 0;
|
||||||
|
dr["Parameter5_S2"] = 0;
|
||||||
|
dr["Parameter1_S3"] = 0;
|
||||||
|
dr["Parameter2_S3"] = 0;
|
||||||
|
dr["Parameter3_S3"] = 0;
|
||||||
|
dr["Parameter4_S3"] = 0;
|
||||||
|
dr["Parameter5_S3"] = 0;
|
||||||
|
dr["StepName_S1"] = " ";
|
||||||
|
dr["StepName_S2"] = " ";
|
||||||
|
dr["StepName_S3"] = " ";
|
||||||
|
dr["StepID_S1"] = "000";
|
||||||
|
dr["StepID_S2"] = "000";
|
||||||
|
dr["StepID_S3"] = "000";
|
||||||
|
Step.Rows.InsertAt(dr, Step.Rows.Count);
|
||||||
|
Dat(Step);
|
||||||
|
ID = (Step.Rows.Count).ToString();
|
||||||
|
}
|
||||||
|
|
||||||
ViewStep viewstop = new ViewStep(Numder, Step.Select("STEP = " + ID).First());
|
ViewStep viewstop = new ViewStep(Numder, Step.Select("STEP = " + ID).First());
|
||||||
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
|
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
|
||||||
viewstop.data = ID;
|
viewstop.data = ID;
|
||||||
@@ -154,7 +195,46 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
Insert.IsEnabled = false;
|
Insert.IsEnabled = false;
|
||||||
Delete.IsEnabled = false;
|
Delete.IsEnabled = false;
|
||||||
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
|
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
|
||||||
if (ID == null) ID = Step.Rows.Count.ToString();
|
if (string.IsNullOrEmpty(ID))
|
||||||
|
{
|
||||||
|
DataRow dr = Step.NewRow();//添加表数据
|
||||||
|
dr["ProgramID"] = ProgramID;
|
||||||
|
dr["Program"] = ProgramNAME;
|
||||||
|
dr["Parameter1"] = 0;
|
||||||
|
dr["Parameter2"] = 0;
|
||||||
|
dr["Parameter3"] = 0;
|
||||||
|
dr["Parameter4"] = 0;
|
||||||
|
dr["Parameter5"] = 0;
|
||||||
|
dr["Parameter6"] = 0;
|
||||||
|
dr["Parameter7"] = 0;
|
||||||
|
dr["Parameter8"] = 0;
|
||||||
|
dr["Parameter9"] = 0;
|
||||||
|
dr["Parameter10"] = 0;
|
||||||
|
dr["Parameter1_S1"] = 0;
|
||||||
|
dr["Parameter2_S1"] = 0;
|
||||||
|
dr["Parameter3_S1"] = 0;
|
||||||
|
dr["Parameter4_S1"] = 0;
|
||||||
|
dr["Parameter5_S1"] = 0;
|
||||||
|
dr["Parameter1_S2"] = 0;
|
||||||
|
dr["Parameter2_S2"] = 0;
|
||||||
|
dr["Parameter3_S2"] = 0;
|
||||||
|
dr["Parameter4_S2"] = 0;
|
||||||
|
dr["Parameter5_S2"] = 0;
|
||||||
|
dr["Parameter1_S3"] = 0;
|
||||||
|
dr["Parameter2_S3"] = 0;
|
||||||
|
dr["Parameter3_S3"] = 0;
|
||||||
|
dr["Parameter4_S3"] = 0;
|
||||||
|
dr["Parameter5_S3"] = 0;
|
||||||
|
dr["StepName_S1"] = " ";
|
||||||
|
dr["StepName_S2"] = " ";
|
||||||
|
dr["StepName_S3"] = " ";
|
||||||
|
dr["StepID_S1"] = "000";
|
||||||
|
dr["StepID_S2"] = "000";
|
||||||
|
dr["StepID_S3"] = "000";
|
||||||
|
Step.Rows.InsertAt(dr, Step.Rows.Count);
|
||||||
|
Dat(Step);
|
||||||
|
ID = Step.Rows.Count.ToString();
|
||||||
|
}
|
||||||
ViewStep viewstop = new ViewStep(Numder, Step.Select("STEP = " + ID).First());
|
ViewStep viewstop = new ViewStep(Numder, Step.Select("STEP = " + ID).First());
|
||||||
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
|
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
|
||||||
viewstop.data = ID;
|
viewstop.data = ID;
|
||||||
@@ -163,16 +243,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//编辑返回结果
|
private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//编辑返回结果
|
||||||
{
|
{
|
||||||
int i = Step.Rows.Count;
|
int i = Step.Rows.Count;
|
||||||
int n = StrToInt.To16Convert10(ID);
|
int n = Convert.ToInt16(ID);
|
||||||
if (i == n)
|
|
||||||
{
|
|
||||||
DataRow dr_ = Step.NewRow();//添加表数据
|
|
||||||
dr_["ProgramID"] = ProgramID;
|
|
||||||
dr_["Program"] = ProgramNAME;
|
|
||||||
Step.Rows.Add(dr_);
|
|
||||||
Dat(Step);
|
|
||||||
ID = (n + 1).ToString();
|
|
||||||
}
|
|
||||||
int steptime = 0;//时间秒
|
int steptime = 0;//时间秒
|
||||||
string[] time_D = { "001", "013", "015", "017", "065" };
|
string[] time_D = { "001", "013", "015", "017", "065" };
|
||||||
string[] time_J = { "031", "093" };
|
string[] time_J = { "031", "093" };
|
||||||
@@ -249,6 +321,37 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
DataRow dr = Step.NewRow();//添加表数据
|
DataRow dr = Step.NewRow();//添加表数据
|
||||||
dr["ProgramID"] = ProgramID;
|
dr["ProgramID"] = ProgramID;
|
||||||
dr["Program"] = ProgramNAME;
|
dr["Program"] = ProgramNAME;
|
||||||
|
dr["Parameter1"] = 0;
|
||||||
|
dr["Parameter2"] = 0;
|
||||||
|
dr["Parameter3"] = 0;
|
||||||
|
dr["Parameter4"] = 0;
|
||||||
|
dr["Parameter5"] = 0;
|
||||||
|
dr["Parameter6"] = 0;
|
||||||
|
dr["Parameter7"] = 0;
|
||||||
|
dr["Parameter8"] = 0;
|
||||||
|
dr["Parameter9"] = 0;
|
||||||
|
dr["Parameter10"] = 0;
|
||||||
|
dr["Parameter1_S1"] = 0;
|
||||||
|
dr["Parameter2_S1"] = 0;
|
||||||
|
dr["Parameter3_S1"] = 0;
|
||||||
|
dr["Parameter4_S1"] = 0;
|
||||||
|
dr["Parameter5_S1"] = 0;
|
||||||
|
dr["Parameter1_S2"] = 0;
|
||||||
|
dr["Parameter2_S2"] = 0;
|
||||||
|
dr["Parameter3_S2"] = 0;
|
||||||
|
dr["Parameter4_S2"] = 0;
|
||||||
|
dr["Parameter5_S2"] = 0;
|
||||||
|
dr["Parameter1_S3"] = 0;
|
||||||
|
dr["Parameter2_S3"] = 0;
|
||||||
|
dr["Parameter3_S3"] = 0;
|
||||||
|
dr["Parameter4_S3"] = 0;
|
||||||
|
dr["Parameter5_S3"] = 0;
|
||||||
|
dr["StepName_S1"] = " ";
|
||||||
|
dr["StepName_S2"] = " ";
|
||||||
|
dr["StepName_S3"] = " ";
|
||||||
|
dr["StepID_S1"] = "000";
|
||||||
|
dr["StepID_S2"] = "000";
|
||||||
|
dr["StepID_S3"] = "000";
|
||||||
Step.Rows.InsertAt(dr, d - 1);
|
Step.Rows.InsertAt(dr, d - 1);
|
||||||
ID = null;
|
ID = null;
|
||||||
|
|
||||||
@@ -267,7 +370,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
data_t = Step.Clone();
|
data_t = Step.Clone();
|
||||||
|
|
||||||
int a = Step.Rows.Count;
|
int a = Step.Rows.Count;
|
||||||
for (int i = 0; i < a - 1; i++)
|
for (int i = 0; i < a ; i++)
|
||||||
{
|
{
|
||||||
data_t.Clear();//清空
|
data_t.Clear();//清空
|
||||||
|
|
||||||
@@ -299,13 +402,11 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
|||||||
Insert.IsEnabled = false;
|
Insert.IsEnabled = false;
|
||||||
Delete.IsEnabled = false;
|
Delete.IsEnabled = false;
|
||||||
|
|
||||||
int d = 0;
|
|
||||||
int a = Step.Rows.Count;
|
int a = Step.Rows.Count;
|
||||||
|
int rownum = Grid_step.SelectedIndex;
|
||||||
if (ID != null) { d = Convert.ToInt32(ID); } else { return; }
|
if (rownum >= 0 && rownum<a)
|
||||||
if (a != d)//如果删除不是最后一行执行
|
{
|
||||||
{
|
Step.Rows.RemoveAt(rownum);
|
||||||
Step.Rows.RemoveAt(d - 1);
|
|
||||||
Dat(Step);
|
Dat(Step);
|
||||||
Grid_step.ItemsSource = Step.DefaultView; //转换显示计划表
|
Grid_step.ItemsSource = Step.DefaultView; //转换显示计划表
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -500,8 +500,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.WindowsView
|
|||||||
}
|
}
|
||||||
private void NO_Click(object sender, RoutedEventArgs e)//关闭
|
private void NO_Click(object sender, RoutedEventArgs e)//关闭
|
||||||
{
|
{
|
||||||
var args = new AddressUpdateEventArgs(data, "", "", "", dat_D);
|
|
||||||
AddressUpdated(this, args);
|
|
||||||
this.Close(); //关闭窗口
|
this.Close(); //关闭窗口
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user