diff --git a/View/EquipmentSimulationView.xaml b/View/EquipmentSimulationView.xaml index cbe756c..f23758d 100644 --- a/View/EquipmentSimulationView.xaml +++ b/View/EquipmentSimulationView.xaml @@ -14,5 +14,9 @@ + + diff --git a/View/EquipmentSimulationView.xaml.cs b/View/EquipmentSimulationView.xaml.cs index df96769..806f7af 100644 --- a/View/EquipmentSimulationView.xaml.cs +++ b/View/EquipmentSimulationView.xaml.cs @@ -1,4 +1,5 @@ -using System; +using DyeingComputer.ViewModel; +using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -12,6 +13,8 @@ using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; +using System.Windows.Threading; +using static System.Net.WebRequestMethods; namespace DyeingComputer.View { @@ -23,6 +26,25 @@ namespace DyeingComputer.View public EquipmentSimulationView() { InitializeComponent(); + CountDown(); } + + + void Tick_Event_1S(object sender, EventArgs e)//Tick_Event周期执行事件1S + { + M_T.Text = string.Format(" {0:###.#}", Convert.ToDouble(MainWindowViewModel.Selet_dtm("1010"))) + "°C"; + M_L.Text = string.Format("{0:D4}", Convert.ToInt16(MainWindowViewModel.Selet_dtm("1015"))) + "L"; + + } + + public void CountDown() + { + DispatcherTimer timer1s = new DispatcherTimer//初始化循环,每1秒调用一次Tick + { + Interval = TimeSpan.FromSeconds(1)//秒 + }; + timer1s.Tick += Tick_Event_1S; + timer1s.Start(); + } } } diff --git a/ViewModel/MainWindowViewModel.cs b/ViewModel/MainWindowViewModel.cs index 5eecbbf..3abfd2a 100644 --- a/ViewModel/MainWindowViewModel.cs +++ b/ViewModel/MainWindowViewModel.cs @@ -1514,9 +1514,12 @@ namespace DyeingComputer.ViewModel SYSlog = SYSlog + "\n" + Resources.MasterCylinder + Resources.Pressure + " : " + string.Format("{0:###.#}", Convert.ToDouble(Selet_dtm("1042"))) + "Bar"; SYSlog = SYSlog + " | " + Resources.Nozzle + Resources.Pressure + " : " + string.Format("{0:###.#}", Convert.ToDouble(Selet_dtm("1043"))) + "Bar"; SYSlog = SYSlog + "\n-------------------------------------------------------"; - if (S16 == 0) - { - SYSlog = SYSlog + "\n" + Resources.ClothWheel + "M/min"; + SYSlog = SYSlog + "\n" + Resources.DifferentialPressure + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1044"))) + "%"; + SYSlog = SYSlog + "\n" + Resources.Blower + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1021"))) + "%"; + // SYSlog = SYSlog + "\n" + Resources.GuidingWheel + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1046"))) + "M/min"; + SYSlog = SYSlog + "\n" + Resources.Nozzle + Resources.Flowmeter + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1045"))) + "L/min"; + + SYSlog = SYSlog + "\n" + Resources.ClothWheel + "M/min"; SYSlog = SYSlog + "\n" + "1 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1022"))); if (MT18 >= 2) SYSlog = SYSlog + " | " + "2 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1023"))); if (MT18 >= 3) SYSlog = SYSlog + " | " + "3 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1024"))); @@ -1538,16 +1541,8 @@ namespace DyeingComputer.ViewModel if (MT18 >= 8) SYSlog = SYSlog + " | " + "8 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1039"))); if (MT18 >= 9) SYSlog = SYSlog + " | " + "9 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1040"))); if (MT18 >= 10) SYSlog = SYSlog + "\n" + "10 : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1041"))); - }//溢流/o型 - else if (S16 == 1) //气流 - { - SYSlog = SYSlog + "\n" + Resources.DifferentialPressure + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1044"))) + "%"; - SYSlog = SYSlog + "\n" + Resources.Blower + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1021"))) + "%"; - SYSlog = SYSlog + "\n" + Resources.GuidingWheel + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1046"))) + "M/min"; - SYSlog = SYSlog + "\n" + Resources.Nozzle + Resources.Flowmeter + " : " + string.Format("{0:D3}", Convert.ToInt16(Selet_dtm("1045"))) + "L/min"; - } - else if (S16 == 2) //桶纱 - { } + + SYSlog = SYSlog + "\n-------------------------------------------------------"; if (SM01 == 1) {