Add initial multi language support

pull/7/head
LeapwardKoex 2024-04-24 21:40:10 +12:00
parent 0a79a71f82
commit 851d83ca51
10 changed files with 719 additions and 29 deletions

View File

@ -22,6 +22,9 @@
<setting name="FirstOpen" serializeAs="String">
<value>True</value>
</setting>
<setting name="UserLanguage" serializeAs="String">
<value />
</setting>
</WpfMaiTouchEmulator.Properties.Settings>
</userSettings>
</configuration>

View File

@ -3,38 +3,44 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WpfMaiTouchEmulator"
mc:Ignorable="d"
Closing="MainWindow_Closing"
Title="MainWindow" Height="282" Width="800">
<Grid Background="Transparent">
<Button x:Name="ConnectToPortButton" Content="Connect to port" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Click="ConnectToPortButton_Click" Width="105"/>
Title="MainWindow" Height="360" Width="500" ResizeMode="NoResize" WindowStartupLocation="CenterScreen">
<Grid Background="Transparent" Height="317" VerticalAlignment="Top" >
<Button x:Name="ConnectToPortButton" Content="{Binding LbConnectToPort}" HorizontalAlignment="Left" Margin="10,95,0,0" VerticalAlignment="Top" Click="ConnectToPortButton_Click" />
<TextBox x:Name="RecievedLogBox"
IsReadOnly="True"
HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto"
AcceptsReturn="True"
AcceptsTab="True"
TextWrapping="Wrap" Margin="376,34,278,9" />
TextWrapping="Wrap" Margin="376,34,0,219" HorizontalAlignment="Left" Width="88" />
<TextBox x:Name="SentLogBox"
IsReadOnly="True"
HorizontalScrollBarVisibility="Disabled"
VerticalScrollBarVisibility="Auto"
AcceptsReturn="True"
AcceptsTab="True"
TextWrapping="Wrap" Margin="552,34,102,9" />
<Label x:Name="label" Content="Recieved" HorizontalAlignment="Left" Margin="376,8,0,0" VerticalAlignment="Top" Width="88"/>
<Label x:Name="label_Copy" Content="Sent" HorizontalAlignment="Left" Margin="552,8,0,0" VerticalAlignment="Top" Width="88"/>
<Label x:Name="label_Copy1" Content="Button State" HorizontalAlignment="Left" Margin="698,8,0,0" VerticalAlignment="Top" Width="88"/>
<Label x:Name="buttonStateValue" Content="0" HorizontalAlignment="Left" Margin="698,34,0,0" VerticalAlignment="Top" RenderTransformOrigin="3.566,1.468" FontSize="10"/>
<CheckBox x:Name="debugMode" Content="Debug mode" HorizontalAlignment="Left" Margin="10,39,0,0" VerticalAlignment="Top" IsChecked="{Binding Path=IsDebugEnabled}" Click="debugMode_Click" Cursor="" Focusable="False" ToolTip="Show the touchpad with translucency and show inputs highlighted"/>
<CheckBox x:Name="automaticTouchPanelPositioning" HorizontalAlignment="Left" Margin="10,59,0,0" VerticalAlignment="Top" Height="17" Width="224" Content="Automatic sensor window positioning" IsChecked="{Binding Path=IsAutomaticPositioningEnabled}" Click="automaticTouchPanelPositioning_Click" ToolTip="Try and automatically move the touch sensor window into the correct position on top of Sinma.exe"/>
<CheckBox x:Name="automaticPortConnecting" HorizontalAlignment="Left" Margin="10,81,0,0" VerticalAlignment="Top" Height="17" Width="224" Content="Automatic port connecting" IsChecked="{Binding Path=IsAutomaticPortConnectingEnabled}" Click="automaticPortConnecting_Click" ToolTip="Try to automatically connect to COM23 to send touchsensor updates on app start"/>
<Label x:Name="label1" Content="Connection state" HorizontalAlignment="Left" Margin="238,8,0,0" VerticalAlignment="Top"/>
<Label x:Name="connectionStateLabel" Content="Not connected" HorizontalAlignment="Left" Margin="238,31,0,0" VerticalAlignment="Top" FontSize="10"/>
<CheckBox x:Name="exitWithSinmai" HorizontalAlignment="Left" Margin="10,103,0,0" VerticalAlignment="Top" Height="17" Width="224" Content="Exit when Sinmai exits" IsChecked="{Binding IsExitWithSinmaiEnabled}" Click="exitWithSinmai_Click" ToolTip="Try and detect when Sinmai.exe exits and exit this app alongside it"/>
<Button x:Name="buttonInstallComPort" Content="Install com port" HorizontalAlignment="Left" Margin="10,147,0,0" VerticalAlignment="Top" Click="buttonInstallComPort_Click"/>
<Button x:Name="buttonUninstallComPorts" Content="Uninstall com port" HorizontalAlignment="Left" Margin="10,172,0,0" VerticalAlignment="Top" Click="buttonUninstallComPorts_Click"/>
<Button x:Name="buttonListComPorts" Content="List installed com ports" HorizontalAlignment="Left" Margin="10,197,0,0" VerticalAlignment="Top" Click="buttonListComPorts_Click"/>
TextWrapping="Wrap" Margin="376,121,0,129" HorizontalAlignment="Left" Width="88" />
<Label x:Name="label" Content="{Binding LbRecievedData}" d:Content="Recieved Data" HorizontalAlignment="Left" Margin="376,8,0,0" VerticalAlignment="Top" Width="88"/>
<Label x:Name="label_Copy" Content="{Binding LbSentData}" d:Content="Sent Data" HorizontalAlignment="Left" Margin="376,95,0,0" VerticalAlignment="Top" Width="88"/>
<Label x:Name="label_Copy1" Content="{Binding LbButtonState}" d:Content="Button state" HorizontalAlignment="Left" Margin="238,56,0,0" VerticalAlignment="Top" Width="88"/>
<Label x:Name="buttonStateValue" Content="0" HorizontalAlignment="Left" Margin="238,82,0,0" VerticalAlignment="Top" RenderTransformOrigin="3.566,1.468" FontSize="10"/>
<CheckBox x:Name="debugMode" Content="{Binding LbDebugMode}" d:Content="Debug mode" HorizontalAlignment="Left" Margin="10,213,0,0" VerticalAlignment="Top" IsChecked="{Binding Path=IsDebugEnabled}" Click="debugMode_Click" Cursor="" Focusable="False" ToolTip="Show the touchpad with translucency and show inputs highlighted" Width="224"/>
<CheckBox x:Name="automaticTouchPanelPositioning" d:Content="Automatic touch panel positioning" HorizontalAlignment="Left" Margin="10,233,0,0" VerticalAlignment="Top" Height="17" Width="224" Content="{Binding LbAutoSensorPositioning}" IsChecked="{Binding Path=IsAutomaticPositioningEnabled}" Click="automaticTouchPanelPositioning_Click" ToolTip="Try and automatically move the touch sensor window into the correct position on top of Sinma.exe"/>
<CheckBox x:Name="automaticPortConnecting" d:Content="Automatic port connecting" HorizontalAlignment="Left" Margin="10,255,0,0" VerticalAlignment="Top" Height="17" Width="224" Content="{Binding LbAutoPortConnecting}" IsChecked="{Binding Path=IsAutomaticPortConnectingEnabled}" Click="automaticPortConnecting_Click" ToolTip="Try to automatically connect to COM23 to send touchsensor updates on app start"/>
<Label x:Name="label1" Content="{Binding LbConnectionState}" d:Content="Connection state" HorizontalAlignment="Left" Margin="238,8,0,0" VerticalAlignment="Top"/>
<Label x:Name="connectionStateLabel" Content="{Binding LbConnectionStateNotConnected}" d:Content="Not connected" HorizontalAlignment="Left" Margin="238,31,0,0" VerticalAlignment="Top" FontSize="10"/>
<CheckBox x:Name="exitWithSinmai" Content="{Binding LbExitWithSinmai}" d:Content="Exit with Sinmai" HorizontalAlignment="Left" Margin="10,277,0,0" VerticalAlignment="Top" Height="17" Width="224" IsChecked="{Binding IsExitWithSinmaiEnabled}" Click="exitWithSinmai_Click" ToolTip="Try and detect when Sinmai.exe exits and exit this app alongside it"/>
<Button x:Name="buttonInstallComPort" Content="{Binding LbInstallComPort}" d:Content="Install COM port" HorizontalAlignment="Left" Margin="10,9,0,0" VerticalAlignment="Top" Click="buttonInstallComPort_Click" Width="126"/>
<Button x:Name="buttonUninstallComPorts" Content="{Binding LbUninstallComPort}" d:Content="Uninstall COM port" HorizontalAlignment="Left" Margin="10,34,0,0" VerticalAlignment="Top" Click="buttonUninstallComPorts_Click" Width="126"/>
<Button x:Name="buttonListComPorts" Content="{Binding LbListComPorts}" d:Content="List installed COM ports" HorizontalAlignment="Left" Margin="10,59,0,0" VerticalAlignment="Top" Click="buttonListComPorts_Click"/>
<Separator HorizontalAlignment="Left" Margin="10,84,0,0" VerticalAlignment="Top" Height="6" Width="126"/>
<ComboBox x:Name="languageSelector" HorizontalAlignment="Left" Margin="10,186,0,0" VerticalAlignment="Top" Width="149" ItemsSource="{Binding SupportedLanguages}"
DisplayMemberPath="NativeName"
SelectedItem="{Binding SelectedLanguage, Mode=TwoWay}"/>
<Label x:Name="lagnuageLabel" Content="{Binding LbLanguageDropdown}" d:Content="Language" HorizontalAlignment="Left" Margin="10,155,0,0" VerticalAlignment="Top" Width="126"/>
</Grid>

View File

@ -6,13 +6,21 @@ namespace WpfMaiTouchEmulator;
public partial class MainWindow : Window
{
private readonly MaiTouchSensorButtonStateManager buttonState;
private MaiTouchComConnector connector;
private readonly MaiTouchComConnector connector;
private readonly VirtualComPortManager comPortManager;
private TouchPanel _touchPanel;
public MainWindow()
{
InitializeComponent();
DataContext = new MainWindowViewModel()
{
IsDebugEnabled = Properties.Settings.Default.IsDebugEnabled,
IsAutomaticPortConnectingEnabled = Properties.Settings.Default.IsAutomaticPortConnectingEnabled,
IsAutomaticPositioningEnabled = Properties.Settings.Default.IsAutomaticPositioningEnabled,
IsExitWithSinmaiEnabled = Properties.Settings.Default.IsExitWithSinmaiEnabled,
};
Title = "Mai Touch Emulator";
buttonState = new MaiTouchSensorButtonStateManager(buttonStateValue);
connector = new MaiTouchComConnector(buttonState);
@ -53,6 +61,7 @@ public partial class MainWindow : Window
Properties.Settings.Default.Save();
}
Loaded += (s, e) => {
Logger.Info("Main window loaded, creating touch panel");
_touchPanel = new TouchPanel();
@ -60,15 +69,9 @@ public partial class MainWindow : Window
_touchPanel.onRelease = (value) => { buttonState.ReleaseButton(value); };
_touchPanel.Show();
_touchPanel.Owner = this;
DataContext = new MainWindowViewModel()
{
IsDebugEnabled = Properties.Settings.Default.IsDebugEnabled,
IsAutomaticPortConnectingEnabled = Properties.Settings.Default.IsAutomaticPortConnectingEnabled,
IsAutomaticPositioningEnabled = Properties.Settings.Default.IsAutomaticPositioningEnabled,
IsExitWithSinmaiEnabled = Properties.Settings.Default.IsExitWithSinmaiEnabled
};
var dataContext = (MainWindowViewModel)DataContext;
_touchPanel.SetDebugMode(dataContext.IsDebugEnabled);
if (Properties.Settings.Default.IsAutomaticPositioningEnabled)
{
@ -81,7 +84,7 @@ public partial class MainWindow : Window
};
}
private async void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
private async void MainWindow_Closing(object? sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel = true;
await connector.Disconnect();
@ -90,7 +93,7 @@ public partial class MainWindow : Window
childWindow.Close();
}
Closing -= MainWindow_Closing;
Close();
e.Cancel = false;
}
private async void ExitWithSinmaiLoop()

View File

@ -1,14 +1,107 @@
using System.ComponentModel;
using System.Globalization;
using System.Resources;
using System.Runtime.CompilerServices;
namespace WpfMaiTouchEmulator;
internal class MainWindowViewModel : INotifyPropertyChanged
public class MainWindowViewModel : INotifyPropertyChanged
{
// Language
public string LbAutoPortConnecting
{
get; set;
}
public string LbAutoSensorPositioning
{
get; set;
}
public string LbButtonState
{
get; set;
}
public string LbConnectionState
{
get; set;
}
public string LbConnectionStateNotConnected
{
get; set;
}
public string LbConnectToPort
{
get; set;
}
public string LbDebugMode
{
get; set;
}
public string LbExitWithSinmai
{
get; set;
}
public string LbInstallComPort
{
get; set;
}
public string LbLanguageDropdown
{
get; set;
}
public string LbListComPorts
{
get; set;
}
public string LbReceivedData
{
get; set;
}
public string LbRecievedData
{
get;
private set;
}
public string LbSentData
{
get; set;
}
public string LbUninstallComPort
{
get; set;
}
private bool _isAutomaticPortConnectingEnabled;
private bool _isDebugEnabled;
private bool _isAutomaticPositioningEnabled;
private bool _isExitWithSinmaiEnabled;
private CultureInfo _selectedLanguage;
private readonly ResourceManager resourceManager;
private readonly CultureInfo cultureInfo;
public List<CultureInfo> SupportedLanguages
{
get;
} =
[
new CultureInfo("en-US"), // English
new CultureInfo("zh-CN") // Chinese (Simplified)
];
public MainWindowViewModel()
{
resourceManager = new ResourceManager("WpfMaiTouchEmulator.Properties.Resources", typeof(MainWindowViewModel).Assembly);
LoadLanguageSettings();
}
private void LoadLanguageSettings()
{
var savedLang = Properties.Settings.Default.UserLanguage;
var culture = string.IsNullOrEmpty(savedLang) ? CultureInfo.CurrentCulture : new CultureInfo(savedLang);
SelectedLanguage = SupportedLanguages.Contains(culture) ? culture : SupportedLanguages[0];
}
public bool IsDebugEnabled
{
@ -50,6 +143,51 @@ internal class MainWindowViewModel : INotifyPropertyChanged
}
}
public CultureInfo SelectedLanguage
{
get => _selectedLanguage;
set
{
if (_selectedLanguage != value)
{
_selectedLanguage = value;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(SelectedLanguage)));
ChangeLanguage(value);
}
}
}
private void ChangeLanguage(CultureInfo culture)
{
Properties.Settings.Default.UserLanguage = culture.Name;
Properties.Settings.Default.Save();
Thread.CurrentThread.CurrentUICulture = culture;
ResourceManager rm = new ResourceManager(typeof(Resources.Strings));
UpdateLocalizedResources(rm);
}
private void UpdateLocalizedResources(ResourceManager resourceManager)
{
LbAutoPortConnecting = resourceManager.GetString("lbAutoPortConnecting");
LbAutoSensorPositioning = resourceManager.GetString("lbAutoSensorPositioning");
LbButtonState = resourceManager.GetString("lbButtonState");
LbConnectionState = resourceManager.GetString("lbConnectionState");
LbConnectionStateNotConnected = resourceManager.GetString("lbConnectionStateNotConnected");
LbConnectToPort = resourceManager.GetString("lbConnectToPort");
LbDebugMode = resourceManager.GetString("lbDebugMode");
LbExitWithSinmai = resourceManager.GetString("lbExitWithSinmai");
LbInstallComPort = resourceManager.GetString("lbInstallComPort");
LbLanguageDropdown = resourceManager.GetString("lbLanguageDropdown");
LbListComPorts = resourceManager.GetString("lbListComPorts");
LbReceivedData = resourceManager.GetString("lbReceivedData");
LbRecievedData = resourceManager.GetString("lbRecievedData");
LbSentData = resourceManager.GetString("lbSentData");
LbUninstallComPort = resourceManager.GetString("lbUninstallComPort");
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(null));
}
public event PropertyChangedEventHandler? PropertyChanged;
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)

View File

@ -82,5 +82,17 @@ namespace WpfMaiTouchEmulator.Properties {
this["FirstOpen"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string UserLanguage {
get {
return ((string)(this["UserLanguage"]));
}
set {
this["UserLanguage"] = value;
}
}
}
}

View File

@ -17,5 +17,8 @@
<Setting Name="FirstOpen" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="UserLanguage" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
</Settings>
</SettingsFile>

189
Resources/Strings.Designer.cs generated 100644
View File

@ -0,0 +1,189 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace WpfMaiTouchEmulator.Resources {
using System;
/// <summary>
/// A strongly-typed resource class, for looking up localized strings, etc.
/// </summary>
// This class was auto-generated by the StronglyTypedResourceBuilder
// class via a tool like ResGen or Visual Studio.
// To add or remove a member, edit your .ResX file then rerun ResGen
// with the /str option, or rebuild your VS project.
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Strings {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Strings() {
}
/// <summary>
/// Returns the cached ResourceManager instance used by this class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("WpfMaiTouchEmulator.Resources.Strings", typeof(Strings).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// Overrides the current thread's CurrentUICulture property for all
/// resource lookups using this strongly typed resource class.
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set {
resourceCulture = value;
}
}
/// <summary>
/// Looks up a localized string similar to Automatic port connecting.
/// </summary>
internal static string lbAutoPortConnecting {
get {
return ResourceManager.GetString("lbAutoPortConnecting", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Automatic sensor window positioning.
/// </summary>
internal static string lbAutoSensorPositioning {
get {
return ResourceManager.GetString("lbAutoSensorPositioning", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Button State.
/// </summary>
internal static string lbButtonState {
get {
return ResourceManager.GetString("lbButtonState", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Connection state.
/// </summary>
internal static string lbConnectionState {
get {
return ResourceManager.GetString("lbConnectionState", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Not connected.
/// </summary>
internal static string lbConnectionStateNotConnected {
get {
return ResourceManager.GetString("lbConnectionStateNotConnected", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Connect to port.
/// </summary>
internal static string lbConnectToPort {
get {
return ResourceManager.GetString("lbConnectToPort", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Debug mode.
/// </summary>
internal static string lbDebugMode {
get {
return ResourceManager.GetString("lbDebugMode", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Exit when Sinmai exits.
/// </summary>
internal static string lbExitWithSinmai {
get {
return ResourceManager.GetString("lbExitWithSinmai", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Install com port.
/// </summary>
internal static string lbInstallComPort {
get {
return ResourceManager.GetString("lbInstallComPort", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Language.
/// </summary>
internal static string lbLanguageDropdown {
get {
return ResourceManager.GetString("lbLanguageDropdown", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to List installed com ports.
/// </summary>
internal static string lbListComPorts {
get {
return ResourceManager.GetString("lbListComPorts", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Recieved.
/// </summary>
internal static string lbRecievedData {
get {
return ResourceManager.GetString("lbRecievedData", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Sent.
/// </summary>
internal static string lbSentData {
get {
return ResourceManager.GetString("lbSentData", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Uninstall com port.
/// </summary>
internal static string lbUninstallComPort {
get {
return ResourceManager.GetString("lbUninstallComPort", resourceCulture);
}
}
}
}

View File

@ -0,0 +1,162 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="lbAutoPortConnecting" xml:space="preserve">
<value>Automatic port connecting</value>
</data>
<data name="lbAutoSensorPositioning" xml:space="preserve">
<value>Automatic sensor window positioning</value>
</data>
<data name="lbButtonState" xml:space="preserve">
<value>Button State</value>
</data>
<data name="lbConnectionState" xml:space="preserve">
<value>Connection state</value>
</data>
<data name="lbConnectionStateNotConnected" xml:space="preserve">
<value>Not connected</value>
</data>
<data name="lbConnectToPort" xml:space="preserve">
<value>Connect to port</value>
</data>
<data name="lbDebugMode" xml:space="preserve">
<value>Debug mode</value>
</data>
<data name="lbExitWithSinmai" xml:space="preserve">
<value>Exit when Sinmai exits</value>
</data>
<data name="lbInstallComPort" xml:space="preserve">
<value>Install com port</value>
</data>
<data name="lbLanguageDropdown" xml:space="preserve">
<value>Language</value>
</data>
<data name="lbListComPorts" xml:space="preserve">
<value>List installed com ports</value>
</data>
<data name="lbRecievedData" xml:space="preserve">
<value>Recieved</value>
</data>
<data name="lbSentData" xml:space="preserve">
<value>Sent</value>
</data>
<data name="lbUninstallComPort" xml:space="preserve">
<value>Uninstall com port</value>
</data>
</root>

View File

@ -0,0 +1,162 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="lbAutoPortConnecting" xml:space="preserve">
<value>自动端口连接</value>
</data>
<data name="lbAutoSensorPositioning" xml:space="preserve">
<value>自动传感器窗口定位</value>
</data>
<data name="lbButtonState" xml:space="preserve">
<value>按钮状态</value>
</data>
<data name="lbConnectionState" xml:space="preserve">
<value>连接状态</value>
</data>
<data name="lbConnectionStateNotConnected" xml:space="preserve">
<value>未连接</value>
</data>
<data name="lbConnectToPort" xml:space="preserve">
<value>连接到端口</value>
</data>
<data name="lbDebugMode" xml:space="preserve">
<value>调试模式</value>
</data>
<data name="lbExitWithSinmai" xml:space="preserve">
<value>随Sinmai退出</value>
</data>
<data name="lbInstallComPort" xml:space="preserve">
<value>安装串行端口</value>
</data>
<data name="lbLanguageDropdown" xml:space="preserve">
<value>语言</value>
</data>
<data name="lbListComPorts" xml:space="preserve">
<value>列出已安装的串行端口</value>
</data>
<data name="lbRecievedData" xml:space="preserve">
<value>已接收数据</value>
</data>
<data name="lbSentData" xml:space="preserve">
<value>已发送数据</value>
</data>
<data name="lbUninstallComPort" xml:space="preserve">
<value>卸载串行端口</value>
</data>
</root>

View File

@ -19,6 +19,18 @@
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Update="Resources\Strings.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Strings.resx</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Update="Resources\Strings.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>