Browse Source

添加语言功能及相关设置

master
sc 3 months ago
parent
commit
3d64a4474d
  1. 2
      MainWindow.xaml
  2. 36
      Properties/Resources.Designer.cs
  3. 12
      Properties/Resources.en-US.resx
  4. 12
      Properties/Resources.resx
  5. 12
      Properties/Resources.zh-CN.resx
  6. 12
      Properties/Resources.zh-TW.resx
  7. 1
      SunlightCentralizedControlManagement_SCCM_.csproj
  8. 5
      View/EngineerSetView.xaml
  9. 20
      View/EngineerSetView.xaml.cs
  10. 1
      View/MonitorView.xaml.cs
  11. 6
      ViewModel/MainWindowViewModel.cs

2
MainWindow.xaml

@ -127,7 +127,7 @@
<Grid x:Name="gdMian" Background="White" Margin="60,50,0,0">
<ContentControl x:Name="Picture"/>
<Grid x:Name="Cdk_page" Visibility="Collapsed" Margin="0,0,0,0" Background="White" Opacity="0.8">
<TextBlock Height="150" Margin="0,0,0,300" TextWrapping="Wrap" Text="注册信息到期,处理注册信息预计需要3个工作日,为避免影响系统使用请及时提交注册信息!" Width="500" FontSize="34" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Height="150" Margin="0,0,0,300" TextWrapping="Wrap" Text="注册信息到期,为避免影响系统使用请及时提交注册信息!" Width="500" FontSize="34" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock x:Name="keytext" Height="50" Margin="0,0,0,100" TextWrapping="Wrap" Width="500" FontSize="34" HorizontalAlignment="Center" VerticalAlignment="Center" Foreground="Red"/>
<TextBlock Height="50" Margin="0,0,0,0" TextWrapping="Wrap" Text="请联系 SUNLIGHT" Width="300" FontSize="34" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<Button Content="{x:Static lang:Resources.Permit }" HorizontalAlignment="Center" Height="50" Margin="200,100,0,-100" VerticalAlignment="Center" Width="150" FontSize="24" BorderBrush="{x:Null}" Background="DarkGray" Click="ButtonPermit_Click"/>

36
Properties/Resources.Designer.cs

@ -2355,6 +2355,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
}
}
/// <summary>
/// 查找类似 Speed 的本地化字符串。
/// </summary>
public static string Speed {
get {
return ResourceManager.GetString("Speed", resourceCulture);
}
}
/// <summary>
/// 查找类似 SQL 的本地化字符串。
/// </summary>
@ -2589,6 +2598,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
}
}
/// <summary>
/// 查找类似 Test Voice 的本地化字符串。
/// </summary>
public static string TESTVOICE {
get {
return ResourceManager.GetString("TESTVOICE", resourceCulture);
}
}
/// <summary>
/// 查找类似 Time 的本地化字符串。
/// </summary>
@ -2724,6 +2742,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
}
}
/// <summary>
/// 查找类似 VOICE 的本地化字符串。
/// </summary>
public static string VOICE {
get {
return ResourceManager.GetString("VOICE", resourceCulture);
}
}
/// <summary>
/// 查找类似 void 的本地化字符串。
/// </summary>
@ -2733,6 +2760,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
}
}
/// <summary>
/// 查找类似 Vol 的本地化字符串。
/// </summary>
public static string Vol {
get {
return ResourceManager.GetString("Vol", resourceCulture);
}
}
/// <summary>
/// 查找类似 Volume 的本地化字符串。
/// </summary>

12
Properties/Resources.en-US.resx

@ -1056,4 +1056,16 @@
<data name="user_unlock" xml:space="preserve">
<value>UNLOCK</value>
</data>
<data name="VOICE" xml:space="preserve">
<value>Voice</value>
</data>
<data name="TESTVOICE" xml:space="preserve">
<value>Test Voice</value>
</data>
<data name="Speed" xml:space="preserve">
<value>Speed</value>
</data>
<data name="Vol" xml:space="preserve">
<value>Vol</value>
</data>
</root>

12
Properties/Resources.resx

@ -1056,4 +1056,16 @@
<data name="user_unlock" xml:space="preserve">
<value>user_unlock</value>
</data>
<data name="VOICE" xml:space="preserve">
<value>VOICE</value>
</data>
<data name="TESTVOICE" xml:space="preserve">
<value>Test Voice</value>
</data>
<data name="Speed" xml:space="preserve">
<value>Speed</value>
</data>
<data name="Vol" xml:space="preserve">
<value>Vol</value>
</data>
</root>

12
Properties/Resources.zh-CN.resx

@ -1056,4 +1056,16 @@
<data name="user_unlock" xml:space="preserve">
<value>解锁</value>
</data>
<data name="VOICE" xml:space="preserve">
<value>语音</value>
</data>
<data name="TESTVOICE" xml:space="preserve">
<value>测试语音</value>
</data>
<data name="Speed" xml:space="preserve">
<value>语速</value>
</data>
<data name="Vol" xml:space="preserve">
<value>音量</value>
</data>
</root>

12
Properties/Resources.zh-TW.resx

@ -1056,4 +1056,16 @@
<data name="user_unlock" xml:space="preserve">
<value>解鎖</value>
</data>
<data name="VOICE" xml:space="preserve">
<value>語音</value>
</data>
<data name="TESTVOICE" xml:space="preserve">
<value>測試語音</value>
</data>
<data name="Speed" xml:space="preserve">
<value>語速</value>
</data>
<data name="Vol" xml:space="preserve">
<value>音量</value>
</data>
</root>

1
SunlightCentralizedControlManagement_SCCM_.csproj

@ -80,6 +80,7 @@
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Speech" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />

5
View/EngineerSetView.xaml

@ -28,6 +28,11 @@
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,375,0,0" x:Name="textlog" TextWrapping="Wrap" Text="------------" VerticalAlignment="Top" Width="140" FontSize="20"/>
<CheckBox x:Name="dDispenser" Content="{x:Static lang:Resources.LinkDispenser}" HorizontalAlignment="Left" Height="35 " Margin="410,10,0,0" VerticalAlignment="Top" Width="200"
Checked="dDispenser_Checked" Unchecked="dDispenser_Checked" FontSize="20"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,450,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Speed}" VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox x:Name="VOICE_V1" HorizontalAlignment="Left" Height="40" Margin="150,450,0,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200" FontSize="16"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,490,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Vol}" VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox x:Name="VOICE_V2" HorizontalAlignment="Left" Height="40" Margin="150,490,0,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200" FontSize="16"/>
<Button Content="{x:Static lang:Resources.VOICE}" HorizontalAlignment="Left" Height="35" Margin="270,535,0,0" VerticalAlignment="Top" Width="80" Click="VOICE_Click"/>
</Grid>
</UserControl>

20
View/EngineerSetView.xaml.cs

@ -1,9 +1,11 @@
using SunlightCentralizedControlManagement_SCCM_.UserClass;
using ScottPlot.TickGenerators.TimeUnits;
using SunlightCentralizedControlManagement_SCCM_.UserClass;
using SunlightCentralizedControlManagement_SCCM_.ViewModel;
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Speech.Synthesis;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
@ -50,11 +52,14 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
TEXT_SQLUSER.Text = Configini.IniReadvalue("SQL_SERVER", "SQL4");
TEXT_SQLPASWORD.Text = Configini.IniReadvalue("SQL_SERVER", "SQL5");
dDispenser.IsChecked = Convert.ToBoolean(Configini.IniReadvalue("SYS", "DyelotsDispenser"));
VOICE_V1.Text = Configini.IniReadvalue("VOICE", "V1");
VOICE_V2.Text = Configini.IniReadvalue("VOICE", "V2");
}
catch (Exception ex) { LogGing.ERRDATA(ex); }
}
//调用配置文件
private UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
private SpeechSynthesizer synth = new SpeechSynthesizer();//语音
private void comboBoxCOM_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
@ -118,5 +123,18 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
Configini.IniWritevalue("SYS", "DyelotsDispenser", dDispenser.IsChecked.ToString());
MainWindowViewModel.DyelotsDispenser = (bool)dDispenser.IsChecked;
}
private void VOICE_Click(object sender, RoutedEventArgs e)//语言测试按钮
{
try
{
synth.Rate = int.Parse(VOICE_V1.Text);
synth.Volume = int.Parse(VOICE_V2.Text);
synth.SpeakAsync(Properties.Resources.TESTVOICE);
Configini.IniWritevalue("VOICE", "V1", VOICE_V1.Text);
Configini.IniWritevalue("VOICE", "V2", VOICE_V2.Text);
}
catch (Exception) { }
}
}
}

1
View/MonitorView.xaml.cs

@ -68,6 +68,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
machin_LOG.Text = MainWindowViewModel.machin_LOG;
IsInteractive = false;
DATA_view();
}
private string machine;

6
ViewModel/MainWindowViewModel.cs

@ -26,6 +26,7 @@ using System.Windows.Threading;
using System.Xml.Linq;
using TouchSocket.Core;
using TouchSocket.Sockets;
using System.Speech.Synthesis;
using static MaterialDesignThemes.Wpf.Theme;
using static SunlightCentralizedControlManagement_SCCM_.UserClass.SqliteHelper;
using static System.Net.WebRequestMethods;
@ -75,6 +76,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
public static UserControls.info[] inf = new UserControls.info[999]; //定义总览信息卡
public static int ERR_c = 0;//错误计数器
public static bool[] USER_Capacity { set; get; } = new bool[99];
private SpeechSynthesizer synth = new SpeechSynthesizer();//语音
public MainWindowViewModel()
{
@ -88,6 +90,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
SN_ID = Configini.IniReadvalue("SN", "SN2");
SN_KEY = Configini.IniReadvalue("SN", "SN1");
DyelotsDispenser = Convert.ToBoolean(Configini.IniReadvalue("SYS", "DyelotsDispenser"));
synth.Rate = int.Parse( Configini.IniReadvalue("VOICE", "V1"));
synth.Volume = int.Parse( Configini.IniReadvalue("VOICE", "V2"));
}
catch (Exception ex) { LogGing.ERRDATA(ex); }
@ -413,7 +418,6 @@ namespace SunlightCentralizedControlManagement_SCCM_.ViewModel
}
}
public static DataTable dt_d = new DataTable("DIO");
public static DataTable dt_a = new DataTable("AIO");
public static DataTable dt_m = new DataTable("M");

Loading…
Cancel
Save