sc 10 months ago
parent
commit
429b5a6601
  1. 4
      View/EquipmentSimulationView.xaml
  2. 24
      View/EquipmentSimulationView.xaml.cs
  3. 21
      ViewModel/MainWindowViewModel.cs

4
View/EquipmentSimulationView.xaml

@ -14,5 +14,9 @@
<Image Width="300" Height="300" gif:ImageBehavior.AnimatedSource="/Lmage/10001.gif" <Image Width="300" Height="300" gif:ImageBehavior.AnimatedSource="/Lmage/10001.gif"
gif:ImageBehavior.RepeatBehavior="Forever" HorizontalAlignment="Left" Canvas.Left="20" Canvas.Top="180"/> gif:ImageBehavior.RepeatBehavior="Forever" HorizontalAlignment="Left" Canvas.Left="20" Canvas.Top="180"/>
</Canvas> </Canvas>
<TextBlock x:Name="M_T" HorizontalAlignment="Left" Height="30" Margin="260,180,0,0" TextWrapping="Wrap" Text="C" TextAlignment="Right"
VerticalAlignment="Top" Width="100" FontSize="20" Background="White" Padding="5,0,5,0"/>
<TextBlock x:Name="M_L" HorizontalAlignment="Left" Height="30" Margin="260,340,0,0" TextWrapping="Wrap" Text="L" TextAlignment="Right"
VerticalAlignment="Top" Width="100" FontSize="20" Background="White" Padding="5,0,5,0"/>
</Grid> </Grid>
</UserControl> </UserControl>

24
View/EquipmentSimulationView.xaml.cs

@ -1,4 +1,5 @@
using System; using DyeingComputer.ViewModel;
using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
@ -12,6 +13,8 @@ using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using System.Windows.Threading;
using static System.Net.WebRequestMethods;
namespace DyeingComputer.View namespace DyeingComputer.View
{ {
@ -23,6 +26,25 @@ namespace DyeingComputer.View
public EquipmentSimulationView() public EquipmentSimulationView()
{ {
InitializeComponent(); 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();
}
} }
} }

21
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 + "\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 + " | " + Resources.Nozzle + Resources.Pressure + " : " + string.Format("{0:###.#}", Convert.ToDouble(Selet_dtm("1043"))) + "Bar";
SYSlog = SYSlog + "\n-------------------------------------------------------"; SYSlog = SYSlog + "\n-------------------------------------------------------";
if (S16 == 0) 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.ClothWheel + "M/min"; // 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"))); 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 >= 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"))); 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 >= 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 >= 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"))); 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-------------------------------------------------------"; SYSlog = SYSlog + "\n-------------------------------------------------------";
if (SM01 == 1) if (SM01 == 1)
{ {

Loading…
Cancel
Save