Merge branch 'master' of http://www.scserverddns.top:13000/sc/DyeingComputer
This commit is contained in:
commit
f094a2fb6e
4 files changed
+106
-49
No files matched your search
@@ -6,12 +6,14 @@
|
||||
xmlns:local="clr-namespace:DyeingComputer.View"
|
||||
xmlns:lang="clr-namespace:DyeingComputer.Properties"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="630" d:DesignWidth="1280" VerticalAlignment="Top">
|
||||
d:DesignHeight="500" d:DesignWidth="800">
|
||||
<Grid>
|
||||
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,10,0,0" x:Name="comboBoxCOM" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxCOM_SelectionChanged" FontSize="20" IsEditable="True" IsReadOnly="True"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,10,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Port}" VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,50,0,0" x:Name="comboBoxLanguage" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxLanguage_SelectionChanged" FontSize="20" IsEditable="True" IsReadOnly="True"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,50,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Language}" VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBlock Name="RX" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Bottom" Height="30" Width="100" Margin="5,0,0,0"/>
|
||||
<TextBlock Name="TX" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Bottom" Height="30" Width="100" Margin="200,0,0,0"/>
|
||||
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using DyeingComputer.ViewModel;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -12,6 +13,7 @@ using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Navigation;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace DyeingComputer.View
|
||||
{
|
||||
@@ -23,12 +25,13 @@ namespace DyeingComputer.View
|
||||
public EngineerSetView()
|
||||
{
|
||||
InitializeComponent();
|
||||
CountDown();
|
||||
// 获取所有可用串口端口,并添加到comboBoxCOM
|
||||
string[] ports = System.IO.Ports.SerialPort.GetPortNames();
|
||||
comboBoxCOM.ItemsSource = ports;
|
||||
comboBoxCOM.Text = Configini.IniReadvalue("SYS", "COM");
|
||||
|
||||
string[] Language = {"en-US","zh-CN","zh -TW" };
|
||||
string[] Language = { "en-US", "zh-CN", "zh -TW" };
|
||||
comboBoxLanguage.ItemsSource = Language;
|
||||
comboBoxLanguage.Text = Configini.IniReadvalue("SYS", "Language");
|
||||
}
|
||||
@@ -37,12 +40,29 @@ namespace DyeingComputer.View
|
||||
|
||||
private void comboBoxCOM_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
Configini.IniWritevalue("SYS","COM",comboBoxCOM.SelectedValue.ToString());
|
||||
Configini.IniWritevalue("SYS", "COM", comboBoxCOM.SelectedValue.ToString());
|
||||
}
|
||||
|
||||
private void comboBoxLanguage_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
Configini.IniWritevalue("SYS", "Language", comboBoxLanguage.SelectedValue.ToString());
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
RX.Text = MainWindowViewModel.RX.ToString();
|
||||
TX.Text = MainWindowViewModel.TX.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user