页面刷新逻辑修改
This commit is contained in:
commit
46dd51be3d
3 files changed
+42
-47
No files matched your search
+2
-1
@@ -29,8 +29,9 @@ namespace DyeingComputer
|
|||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
SQLiteStrat();
|
SQLiteStrat();
|
||||||
|
|
||||||
container.Content = new TechnologicalProcessView();//默认打开信息页面(TechnologicalProcessView)
|
|
||||||
DataContext = new MainWindowViewModel();//绑定后台
|
DataContext = new MainWindowViewModel();//绑定后台
|
||||||
|
container.Content = new TechnologicalProcessView();//默认打开信息页面(TechnologicalProcessView)
|
||||||
|
MainWindowViewModel.ViewID = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
private SQLiteHelper SQLiteHelpers = null; //定义数据库
|
||||||
|
|||||||
@@ -297,6 +297,12 @@ namespace DyeingComputer.View
|
|||||||
|
|
||||||
// if (sql != null)
|
// if (sql != null)
|
||||||
MainWindowViewModel.dt_TP = sql.Tables[0]; //转换显示计划表
|
MainWindowViewModel.dt_TP = sql.Tables[0]; //转换显示计划表
|
||||||
|
|
||||||
|
|
||||||
|
DataRow newRow;
|
||||||
|
newRow = MainWindowViewModel.dt_TP.NewRow();
|
||||||
|
newRow["StepName"] = "END";
|
||||||
|
MainWindowViewModel.dt_TP.Rows.Add(newRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
private void UserControl_Loaded(object sender, RoutedEventArgs e)
|
||||||
@@ -487,14 +493,31 @@ namespace DyeingComputer.View
|
|||||||
|
|
||||||
private void ProgramgroupView_run_Click(object sender, RoutedEventArgs e)//运行/暂停
|
private void ProgramgroupView_run_Click(object sender, RoutedEventArgs e)//运行/暂停
|
||||||
{
|
{
|
||||||
|
if (MainWindowViewModel.WORK_RUN == 2)
|
||||||
|
{
|
||||||
|
MainWindowViewModel.WORK_RUN = 1;// 运行时停止键为暂停
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MainWindowViewModel.WORK_RUN = 2;// 运行时停止键为
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void ProgramgroupView_stop_Click(object sender, RoutedEventArgs e)//结束工艺
|
private void ProgramgroupView_stop_Click(object sender, RoutedEventArgs e)//结束工艺
|
||||||
{
|
{
|
||||||
|
MessageBoxResult messageBoxResult = System.Windows.MessageBox.Show(Properties.Resources.StopProcess, "800", MessageBoxButton.OKCancel);
|
||||||
|
if (messageBoxResult == MessageBoxResult.OK)
|
||||||
|
{
|
||||||
|
MainWindowViewModel.WORK_RUN = 0;// 运行时停止键为
|
||||||
|
MainWindowViewModel.DIDETime = 0;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
MainWindowViewModel.dt_TP.Rows.Clear();
|
||||||
|
//MainWindowViewModel.dt_TP.BeginLoadData();
|
||||||
|
//MainWindowViewModel.dt_TP.Clear();
|
||||||
|
//MainWindowViewModel.dt_TP.EndLoadData();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Grid_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void Grid_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
|
|||||||
@@ -81,13 +81,6 @@ namespace DyeingComputer.ViewModel
|
|||||||
SQL_data(); //读数据库
|
SQL_data(); //读数据库
|
||||||
UPort(); //启动串口
|
UPort(); //启动串口
|
||||||
CountDown(); //启动循环任务
|
CountDown(); //启动循环任务
|
||||||
dt_a.RowChanged += Dt_a_rowchanged;//添加行更新事件
|
|
||||||
dt_d.RowChanged += Dt_d_rowchanged;
|
|
||||||
dt_m.RowChanged += Dt_m_rowchanged;
|
|
||||||
dt_TP.RowChanged += Dt_tp_rowchanged;
|
|
||||||
dt_TP.RowDeleted += Dt_tp_rowchanged;
|
|
||||||
|
|
||||||
IO_view();
|
|
||||||
|
|
||||||
_ = AsyncTcpServer.Main();
|
_ = AsyncTcpServer.Main();
|
||||||
IsInteractive = false;
|
IsInteractive = false;
|
||||||
@@ -96,38 +89,7 @@ namespace DyeingComputer.ViewModel
|
|||||||
ProgramgroupView_run = new RelayCommand(
|
ProgramgroupView_run = new RelayCommand(
|
||||||
execute:ProgramgroupView_run_ );//开始/暂停事件
|
execute:ProgramgroupView_run_ );//开始/暂停事件
|
||||||
}
|
}
|
||||||
private void Dt_tp_rowchanged(object sender, DataRowChangeEventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
TechnologicalProcess_View = ToObservableCollection<TechnologicalProcess>(dt_TP);
|
|
||||||
}
|
|
||||||
catch (Exception) { }
|
|
||||||
}//工艺步骤表更新事件
|
|
||||||
private void Dt_a_rowchanged(object sender,DataRowChangeEventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((bool)A_view) SYSData_A = ToObservableCollection<DATA_A>(dt_a);
|
|
||||||
}
|
|
||||||
catch (Exception ex) { Name_err = "IO_SYSData_A" + "(" + ex.Message + ")"; }
|
|
||||||
}//aio表更新事件
|
|
||||||
private void Dt_d_rowchanged(object sender, DataRowChangeEventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
if ((bool)D_view) SYSData_D = ToObservableCollection<DATA_D>(dt_d);
|
|
||||||
}
|
|
||||||
catch (Exception ex) { Name_err = "IO_SYSData_D" + "(" + ex.Message + ")"; }
|
|
||||||
}//dio表更新事件
|
|
||||||
private void Dt_m_rowchanged(object sender, DataRowChangeEventArgs e)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
SYSData_M = ToObservableCollection<DATA_M>(dt_m);
|
|
||||||
}
|
|
||||||
catch (Exception ex) { Name_err = "IO_SYSData_M" + "(" + ex.Message + ")"; }
|
|
||||||
}//寄存器表更新事件
|
|
||||||
|
|
||||||
DataTable dt_con = new DataTable();
|
DataTable dt_con = new DataTable();
|
||||||
DataTable dt_sys = new DataTable();
|
DataTable dt_sys = new DataTable();
|
||||||
@@ -357,6 +319,7 @@ namespace DyeingComputer.ViewModel
|
|||||||
|
|
||||||
STEP_RUN();
|
STEP_RUN();
|
||||||
LOG_view();
|
LOG_view();
|
||||||
|
IO_view();
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(Name_err.ToString()))
|
if (!string.IsNullOrEmpty(Name_err.ToString()))
|
||||||
{
|
{
|
||||||
@@ -371,8 +334,9 @@ namespace DyeingComputer.ViewModel
|
|||||||
}
|
}
|
||||||
void Tick_Event_5S()//Tick_Event周期执行事件5S
|
void Tick_Event_5S()//Tick_Event周期执行事件5S
|
||||||
{
|
{
|
||||||
//if(WORK_RUN !=0)
|
if(WORK_RUN !=0) Chart();//写入记录
|
||||||
Chart();//写入记录
|
|
||||||
|
TechnologicalProcess_view();
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(Name_err.ToString()) && ((Selet_dtm("1010") < 1) || (Selet_dtm("1010") > 160)))
|
if (string.IsNullOrEmpty(Name_err.ToString()) && ((Selet_dtm("1010") < 1) || (Selet_dtm("1010") > 160)))
|
||||||
{ Name_err = Resources.Temperature + Resources.Sensor + Resources.Malfunction; } //温度故障提示
|
{ Name_err = Resources.Temperature + Resources.Sensor + Resources.Malfunction; } //温度故障提示
|
||||||
@@ -1737,6 +1701,8 @@ namespace DyeingComputer.ViewModel
|
|||||||
public static object D_view=true;
|
public static object D_view=true;
|
||||||
public static object A_view=true;
|
public static object A_view=true;
|
||||||
public async void IO_view()//IO显示
|
public async void IO_view()//IO显示
|
||||||
|
{
|
||||||
|
if (ViewID == 5)
|
||||||
{
|
{
|
||||||
await Task.Run(() =>
|
await Task.Run(() =>
|
||||||
{
|
{
|
||||||
@@ -1757,13 +1723,18 @@ namespace DyeingComputer.ViewModel
|
|||||||
if ((bool)D_view) SYSData_D = ToObservableCollection<DATA_D>(dt_d);
|
if ((bool)D_view) SYSData_D = ToObservableCollection<DATA_D>(dt_d);
|
||||||
}
|
}
|
||||||
catch (Exception ex) { Name_err = "IO_SYSData_D" + "(" + ex.Message + ")"; }
|
catch (Exception ex) { Name_err = "IO_SYSData_D" + "(" + ex.Message + ")"; }
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void TechnologicalProcess_view()//显示
|
||||||
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
TechnologicalProcess_View = ToObservableCollection<TechnologicalProcess>(dt_TP);
|
if (ViewID == 1) TechnologicalProcess_View = ToObservableCollection<TechnologicalProcess>(dt_TP);
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception) { }
|
catch (Exception) { }
|
||||||
});
|
|
||||||
}
|
}
|
||||||
public static double Selet_dtm(string key)//M寄存器
|
public static double Selet_dtm(string key)//M寄存器
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user