|
|
@ -33,11 +33,28 @@ namespace DyeingComputer.View |
|
|
|
/// </summary>
|
|
|
|
public partial class TechnologicalProcessView : UserControl |
|
|
|
{ |
|
|
|
public event PropertyChangedEventHandler PropertyChanged; |
|
|
|
protected virtual void OnPropertyChanged(string propertyName) |
|
|
|
{ |
|
|
|
if (PropertyChanged != null) |
|
|
|
PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); |
|
|
|
} |
|
|
|
public void RaisePropertyChanged(string propertyName) |
|
|
|
{ |
|
|
|
if (PropertyChanged != null) |
|
|
|
{ |
|
|
|
if (propertyName != null) |
|
|
|
{ |
|
|
|
PropertyChanged.Invoke(this, new PropertyChangedEventArgs(propertyName)); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public TechnologicalProcessView() |
|
|
|
{ |
|
|
|
InitializeComponent(); |
|
|
|
//Grid.DataContext = new MainWindowViewModel();
|
|
|
|
FocusManager.SetFocusedElement(Grid, Grid); |
|
|
|
// FocusManager.SetFocusedElement(Grid, Grid);
|
|
|
|
// if (workName != null)
|
|
|
|
// {
|
|
|
|
// TechnologicalProcess_Import();
|
|
|
@ -45,7 +62,11 @@ namespace DyeingComputer.View |
|
|
|
// else
|
|
|
|
// {
|
|
|
|
TechnologicalProcess_sql(); |
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
|
|
|
// ProgramgroupView_edit.IsEnabled = false;
|
|
|
|
// ProgramgroupView_del.IsEnabled = false;
|
|
|
|
// ProgramgroupView_Insert.IsEnabled = false;
|
|
|
|
} |
|
|
|
|
|
|
|
public static object workName; |
|
|
@ -108,11 +129,11 @@ namespace DyeingComputer.View |
|
|
|
// Grid.DataContext = new MainWindowViewModel();
|
|
|
|
if (workName != null) |
|
|
|
{ |
|
|
|
Grid.SelectedIndex = 0; |
|
|
|
GridSTEP.SelectedIndex = 0; |
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
if (MainWindowViewModel.WORK_RUN != 0) Grid.SelectedIndex = MainWindowViewModel.RUN_STEPID - 1;//设定图表显示
|
|
|
|
if (MainWindowViewModel.WORK_RUN != 0) GridSTEP.SelectedIndex = MainWindowViewModel.RUN_STEPID - 1;//设定图表显示
|
|
|
|
} |
|
|
|
CountDown(); |
|
|
|
} |
|
|
@ -166,7 +187,7 @@ namespace DyeingComputer.View |
|
|
|
dr.EndEdit(); |
|
|
|
|
|
|
|
dt_TP = sql.Tables[0]; |
|
|
|
Grid.SelectedIndex = -1; |
|
|
|
GridSTEP.SelectedIndex = -1; |
|
|
|
|
|
|
|
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
|
|
|
SQLiteHelpers.Open(); //打开数据库
|
|
|
@ -208,7 +229,7 @@ namespace DyeingComputer.View |
|
|
|
dt_TP.Rows.RemoveAt(d - 1); |
|
|
|
|
|
|
|
Dat(); |
|
|
|
Grid.SelectedIndex = -1; |
|
|
|
GridSTEP.SelectedIndex = -1; |
|
|
|
|
|
|
|
SQLiteHelpers = new SQLiteHelper(DBAddress); //数据库连接路径
|
|
|
|
SQLiteHelpers.Open(); //打开数据库
|
|
|
@ -274,8 +295,17 @@ namespace DyeingComputer.View |
|
|
|
private void Receipt_Click(object sender, RoutedEventArgs e) |
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private void ProgramgroupView_run_Click(object sender, RoutedEventArgs e)//运行/暂停
|
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private void ProgramgroupView_stop_Click(object sender, RoutedEventArgs e)//结束工艺
|
|
|
|
{ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
private void ParameterSet_Click(object sender, RoutedEventArgs e) |
|
|
|
{ |
|
|
@ -284,20 +314,24 @@ namespace DyeingComputer.View |
|
|
|
|
|
|
|
private void Grid_SelectionChanged(object sender, SelectionChangedEventArgs e) |
|
|
|
{ |
|
|
|
if (MainWindowViewModel.WORK_RUN == 2) Grid.SelectedIndex = MainWindowViewModel.RUN_STEPID - 1;//设定图表显示
|
|
|
|
int rownum = Grid.SelectedIndex;//获取鼠标选中行并定义变量
|
|
|
|
if (MainWindowViewModel.WORK_RUN == 2) GridSTEP.SelectedIndex = MainWindowViewModel.RUN_STEPID - 1;//设定图表显示
|
|
|
|
int rownum = GridSTEP.SelectedIndex;//获取鼠标选中行并定义变量
|
|
|
|
if (rownum != -1)//判断鼠标定位是否有效
|
|
|
|
{ |
|
|
|
ID = (Grid.Columns[2].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第0列,
|
|
|
|
Numder = (Grid.Columns[3].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第1列,
|
|
|
|
P1 = (Grid.Columns[6].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第6列,
|
|
|
|
P2 = (Grid.Columns[7].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第7列,
|
|
|
|
P3 = (Grid.Columns[8].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第8列,
|
|
|
|
P4 = (Grid.Columns[9].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第9列,
|
|
|
|
P5 = (Grid.Columns[10].GetCellContent(Grid.Items[rownum]) as TextBlock).Text;//定位第10列,
|
|
|
|
ID = (GridSTEP.Columns[2].GetCellContent(GridSTEP.Items[rownum]) as TextBlock).Text;//定位第0列,
|
|
|
|
Numder = (GridSTEP.Columns[3].GetCellContent(GridSTEP.Items[rownum]) as TextBlock).Text;//定位第1列,
|
|
|
|
P1 = (GridSTEP.Columns[6].GetCellContent(GridSTEP.Items[rownum]) as TextBlock).Text;//定位第6列,
|
|
|
|
P2 = (GridSTEP.Columns[7].GetCellContent(GridSTEP.Items[rownum]) as TextBlock).Text;//定位第7列,
|
|
|
|
P3 = (GridSTEP.Columns[8].GetCellContent(GridSTEP.Items[rownum]) as TextBlock).Text;//定位第8列,
|
|
|
|
P4 = (GridSTEP.Columns[9].GetCellContent(GridSTEP.Items[rownum]) as TextBlock).Text;//定位第9列,
|
|
|
|
P5 = (GridSTEP.Columns[10].GetCellContent(GridSTEP.Items[rownum]) as TextBlock).Text;//定位第10列,
|
|
|
|
|
|
|
|
ProgramgroupView_edit.IsEnabled = true; |
|
|
|
ProgramgroupView_del.IsEnabled = true; |
|
|
|
ProgramgroupView_Insert.IsEnabled = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public void CountDown() |
|
|
|
{ |
|
|
|
DispatcherTimer timer1s = new DispatcherTimer//初始化循环,每1秒调用一次Tick
|
|
|
@ -309,7 +343,7 @@ namespace DyeingComputer.View |
|
|
|
} |
|
|
|
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
|
|
|
|
{ |
|
|
|
if (MainWindowViewModel.WORK_RUN == 2) Grid.SelectedIndex = MainWindowViewModel.RUN_STEPID - 1;//设定图表显示
|
|
|
|
if (MainWindowViewModel.WORK_RUN == 2) GridSTEP.SelectedIndex = MainWindowViewModel.RUN_STEPID - 1;//设定图表显示
|
|
|
|
if (sql != null) |
|
|
|
{ |
|
|
|
dt_TP= sql.Tables[0]; |
|
|
|