添加语言设置

This commit is contained in:
sc committed 2024-09-16 16:45:12 +08:00
commit a15058af34
11 files changed
+275 -70

No files matched your search

+5 -2
View File
@@ -8,7 +8,10 @@
mc:Ignorable="d"
d:DesignHeight="630" d:DesignWidth="1280" VerticalAlignment="Top">
<Grid>
<ComboBox HorizontalAlignment="Left" Height="30" Margin="190,10,0,0" x:Name="comboBoxCOM" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxCOM_SelectionChanged" FontSize="20" IsEditable="True" IsReadOnly="True"/>
<TextBlock HorizontalAlignment="Left" Height="30" Margin="90,10,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Port}" VerticalAlignment="Top" Width="80" FontSize="25"/>
<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"/>
</Grid>
</UserControl>
+9
View File
@@ -27,6 +27,10 @@ namespace DyeingComputer.View
string[] ports = System.IO.Ports.SerialPort.GetPortNames();
comboBoxCOM.ItemsSource = ports;
comboBoxCOM.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) + "DyeingComputer.ini");
@@ -35,5 +39,10 @@ namespace DyeingComputer.View
{
Configini.IniWritevalue("SYS","COM",comboBoxCOM.SelectedValue.ToString());
}
private void comboBoxLanguage_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
Configini.IniWritevalue("SYS", "Language", comboBoxLanguage.SelectedValue.ToString());
}
}
}