8 changed files with 94 additions and 15 deletions
@ -0,0 +1,19 @@ |
|||
<UserControl x:Class="SunlightCentralizedControlManagement_SCCM_.View.EngineerSetView" |
|||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
|||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
|||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
|||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
|||
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.View" |
|||
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties" |
|||
mc:Ignorable="d" |
|||
d:DesignHeight="630" d:DesignWidth="1280" VerticalAlignment="Top"> |
|||
<Grid> |
|||
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,10,0,0" x:Name="comboBoxCOM0" 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="comboBoxCOM1" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxCOM_SelectionChanged" FontSize="20" IsEditable="True" IsReadOnly="True"/> |
|||
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,90,0,0" x:Name="comboBoxCOM2" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxCOM_SelectionChanged" FontSize="20" IsEditable="True" IsReadOnly="True"/> |
|||
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,130,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,130,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Language}" VerticalAlignment="Top" Width="120" FontSize="25"/> |
|||
|
|||
</Grid> |
|||
</UserControl> |
@ -0,0 +1,56 @@ |
|||
using System; |
|||
using System.Collections.Generic; |
|||
using System.Linq; |
|||
using System.Text; |
|||
using System.Threading.Tasks; |
|||
using System.Windows; |
|||
using System.Windows.Controls; |
|||
using System.Windows.Data; |
|||
using System.Windows.Documents; |
|||
using System.Windows.Input; |
|||
using System.Windows.Media; |
|||
using System.Windows.Media.Imaging; |
|||
using System.Windows.Navigation; |
|||
using System.Windows.Shapes; |
|||
|
|||
namespace SunlightCentralizedControlManagement_SCCM_.View |
|||
{ |
|||
/// <summary>
|
|||
/// EngineerSetView.xaml 的交互逻辑
|
|||
/// </summary>
|
|||
public partial class EngineerSetView : UserControl |
|||
{ |
|||
public EngineerSetView() |
|||
{ |
|||
InitializeComponent(); |
|||
// 获取所有可用串口端口,并添加到comboBoxCOM
|
|||
string[] ports = System.IO.Ports.SerialPort.GetPortNames(); |
|||
comboBoxCOM0.ItemsSource = ports; |
|||
comboBoxCOM0.Text = Configini.IniReadvalue("SYS", "COM"); |
|||
|
|||
comboBoxCOM1.ItemsSource = ports; |
|||
comboBoxCOM1.Text = Configini.IniReadvalue("SYS", "COM"); |
|||
|
|||
comboBoxCOM2.ItemsSource = ports; |
|||
comboBoxCOM2.Text = Configini.IniReadvalue("SYS", "COM"); |
|||
|
|||
string[] Language = {"en-US","zh-CN","zh -TW" }; |
|||
comboBoxLanguage.ItemsSource = Language; |
|||
comboBoxLanguage.Text = Configini.IniReadvalue("SYS", "Language"); |
|||
} |
|||
//调用配置文件
|
|||
private UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini"); |
|||
|
|||
private void comboBoxCOM_SelectionChanged(object sender, SelectionChangedEventArgs e) |
|||
{ |
|||
Configini.IniWritevalue("SYS", "COM0", comboBoxCOM0.SelectedValue.ToString()); |
|||
Configini.IniWritevalue("SYS", "COM1", comboBoxCOM1.SelectedValue.ToString()); |
|||
Configini.IniWritevalue("SYS", "COM2", comboBoxCOM2.SelectedValue.ToString()); |
|||
} |
|||
|
|||
private void comboBoxLanguage_SelectionChanged(object sender, SelectionChangedEventArgs e) |
|||
{ |
|||
Configini.IniWritevalue("SYS", "Language", comboBoxLanguage.SelectedValue.ToString()); |
|||
} |
|||
} |
|||
} |
Loading…
Reference in new issue