This commit is contained in:
sc committed 2024-10-02 22:48:05 +08:00
commit 39cfa44d60
3 files changed
+165 -116

No files matched your search

+20 -5
View File
@@ -18,6 +18,7 @@ using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Threading;
using static DyeingComputer.UserClass.SqliteHelper;
using static DyeingComputer.Windows.ViewStep;
@@ -97,7 +98,7 @@ namespace DyeingComputer.View
private void UserControl_Loaded(object sender, RoutedEventArgs e)
{
// FocusManager.SetFocusedElement(Grid, Grid);
// Grid.DataContext = new MainWindowViewModel();
// Grid.DataContext = new MainWindowViewModel();
if (workName != null)
{
Grid.SelectedIndex = 0;
@@ -106,6 +107,7 @@ namespace DyeingComputer.View
{
if (MainWindowViewModel.WORK_RUN != 0) Grid.SelectedIndex = MainWindowViewModel.RUN_STEPID - 1;//设定图表显示
}
CountDown();
}
private void UserControl_KeyDown(object sender, KeyEventArgs e) //键盘监控
@@ -118,7 +120,7 @@ namespace DyeingComputer.View
{
MainWindowViewModel.RUN_DATATABLE = sql.Tables[0];//缓存表
MainWindowViewModel.RUN_STEPID = Convert.ToInt16(ID);//插入步骤号
MainWindowViewModel.STEP_START(Numder, Convert.ToDouble(P1), Convert.ToDouble(P2), Convert.ToDouble(P3), Convert.ToDouble(P4), Convert.ToDouble(P5));
MainWindowViewModel.STEP_START(Numder, Convert.ToDouble(P1), Convert.ToDouble(P2), Convert.ToDouble(P3), Convert.ToDouble(P4), Convert.ToDouble(P5));
}
}
}
@@ -128,13 +130,13 @@ namespace DyeingComputer.View
{
if (string.IsNullOrEmpty(Numder)) { Numder = null; P1 = "0"; P2 = "0"; P3 = "0"; P4 = "0"; P5 = "0"; }
if (ID == null) ID = sql.Tables[0].Rows.Count.ToString();
ViewStep viewstop = new ViewStep(Numder,P1,P2,P3,P4,P5);
ViewStep viewstop = new ViewStep(Numder, P1, P2, P3, P4, P5);
viewstop.data = ID;
viewstop.AddressUpdated += new ViewStep.AddressUpdateHandler(Address_ButtonClicked);
viewstop.ShowDialog();
}
private void Address_ButtonClicked(object sender, AddressUpdateEventArgs e)//编辑返回结果
{
{
int n = StrToInt.To16Convert10(ID);
DataRow dr = sql.Tables[0].Rows[n - 1];
@@ -230,7 +232,7 @@ namespace DyeingComputer.View
string P1 = "0", P2 = "0", P3 = "0", P4 = "0", P5 = "0";
private void Grid_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (MainWindowViewModel.WORK_RUN ==2) Grid.SelectedIndex = MainWindowViewModel.RUN_STEPID - 1;//设定图表显示
if (MainWindowViewModel.WORK_RUN == 2) Grid.SelectedIndex = MainWindowViewModel.RUN_STEPID - 1;//设定图表显示
int rownum = Grid.SelectedIndex;//获取鼠标选中行并定义变量
if (rownum != -1)//判断鼠标定位是否有效
{
@@ -244,5 +246,18 @@ namespace DyeingComputer.View
}
}
public void CountDown()
{
DispatcherTimer timer1s = new DispatcherTimer//初始化循环,每1秒调用一次Tick
{
Interval = TimeSpan.FromSeconds(1)//秒
};
timer1s.Tick += Tick_Event_1S;
timer1s.Start();
}
void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S
{
if (MainWindowViewModel.WORK_RUN == 2) Grid.SelectedIndex = MainWindowViewModel.RUN_STEPID - 1;//设定图表显示
}
}
}