sc 1 year ago
parent
commit
87d131b5e8
  1. 3
      MainWindow.xaml.cs
  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. 16
      UserClass/AsyncTcpClient.cs
  7. 18
      View/EngineerSetView.xaml
  8. 47
      View/EngineerSetView.xaml.cs
  9. 1
      View/MonitorView.xaml.cs

3
MainWindow.xaml.cs

@ -102,7 +102,8 @@ namespace SunlightCentralizedControlManagement_SCCM_
private void ButtonSYS_Click(object sender, RoutedEventArgs e)
{
Picture.Content = new View.MachinesSet();//EngineerSetView();
// Picture.Content = new View.MachinesSet();//EngineerSetView();
Picture.Content = new View.EngineerSetView();
}
}
}

36
Properties/Resources.Designer.cs

@ -1311,6 +1311,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
}
}
/// <summary>
/// 查找类似 Mode 的本地化字符串。
/// </summary>
public static string Mode {
get {
return ResourceManager.GetString("Mode", resourceCulture);
}
}
/// <summary>
/// 查找类似 Monitor 的本地化字符串。
/// </summary>
@ -1491,6 +1500,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
}
}
/// <summary>
/// 查找类似 Password 的本地化字符串。
/// </summary>
public static string Password {
get {
return ResourceManager.GetString("Password", resourceCulture);
}
}
/// <summary>
/// 查找类似 Paused 的本地化字符串。
/// </summary>
@ -2076,6 +2094,24 @@ namespace SunlightCentralizedControlManagement_SCCM_.Properties {
}
}
/// <summary>
/// 查找类似 SERVER 的本地化字符串。
/// </summary>
public static string SERVER {
get {
return ResourceManager.GetString("SERVER", resourceCulture);
}
}
/// <summary>
/// 查找类似 SQL 的本地化字符串。
/// </summary>
public static string SQL {
get {
return ResourceManager.GetString("SQL", resourceCulture);
}
}
/// <summary>
/// 查找类似 StartDate 的本地化字符串。
/// </summary>

12
Properties/Resources.en-US.resx

@ -927,4 +927,16 @@
<data name="Test" xml:space="preserve">
<value>Test</value>
</data>
<data name="SQL" xml:space="preserve">
<value>SQL</value>
</data>
<data name="SERVER" xml:space="preserve">
<value>SERVER</value>
</data>
<data name="Password" xml:space="preserve">
<value>Password</value>
</data>
<data name="Mode" xml:space="preserve">
<value>Mode</value>
</data>
</root>

12
Properties/Resources.resx

@ -927,4 +927,16 @@
<data name="Test" xml:space="preserve">
<value>Test</value>
</data>
<data name="SQL" xml:space="preserve">
<value>SQL</value>
</data>
<data name="SERVER" xml:space="preserve">
<value>SERVER</value>
</data>
<data name="Password" xml:space="preserve">
<value>Password</value>
</data>
<data name="Mode" xml:space="preserve">
<value>Mode</value>
</data>
</root>

12
Properties/Resources.zh-CN.resx

@ -927,4 +927,16 @@
<data name="Test" xml:space="preserve">
<value>测试</value>
</data>
<data name="SQL" xml:space="preserve">
<value>数据库</value>
</data>
<data name="SERVER" xml:space="preserve">
<value>服务器</value>
</data>
<data name="Password" xml:space="preserve">
<value>密码</value>
</data>
<data name="Mode" xml:space="preserve">
<value>模式</value>
</data>
</root>

16
UserClass/AsyncTcpClient.cs

@ -108,9 +108,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
}
else if (SYSAPI == "SC831")
{
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
MonitorView.TechnologicalProcess = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
MonitorView.TechnologicalProcess = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
}
else if (SYSAPI == "SC832")
{
@ -125,20 +124,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserClass
else if (SYSAPI == "SC851")
{
DAT = DAT.Substring(DAT.IndexOf("]") + 1);
DataTable obj = JsonConvert.DeserializeObject<DataTable>(DAT);//反序列化
// client.SendAsync("SC851" + "[" + MainWindowViewModel.S01 + "]" + MainWindowViewModel.dt_d.ToJsonString());//数字开关信息
}//数字开关表
// tcpClient.Logger.Info($"客户端接收到信息:{mes}");
return EasyTask.CompletedTask;
};

18
View/EngineerSetView.xaml

@ -10,10 +10,22 @@
<Grid>
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,10,0,0" x:Name="comboBoxCOM0" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxCOM_SelectionChanged" FontSize="20" />
<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"/>
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,90,0,0" x:Name="comboBoxCOM2" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxCOM_SelectionChanged" FontSize="20"/>
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,50,0,0" x:Name="comboBoxCOM1" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxCOM_SelectionChanged" FontSize="20"/>
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,90,0,0" x:Name="comboBoxCOM2" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxCOM_SelectionChanged" FontSize="20"/>
<ComboBox HorizontalAlignment="Left" Height="30" Margin="150,130,0,0" x:Name="comboBoxLanguage" VerticalAlignment="Top" Width="200" SelectionChanged="comboBoxLanguage_SelectionChanged" FontSize="20"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,130,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Language}" VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,170,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.SERVER}" VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,210,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Mode}" VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,250,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.SQL}" VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,290,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.USER}" VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,330,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.Password}" VerticalAlignment="Top" Width="120" FontSize="25"/>
<TextBox x:Name="TEXT_SQLIP" HorizontalAlignment="Left" Height="40" Margin="150,170,0,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200" FontSize="20"/>
<ComboBox x:Name="TEXT_SQMOD" Height="40" Margin="150,210,0,0" VerticalAlignment="Top" Width="200" FontSize="16" HorizontalAlignment="Left"/>
<TextBox x:Name="TEXT_SQLNAME" HorizontalAlignment="Left" Height="40" Margin="150,250,0,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200" FontSize="20"/>
<TextBox x:Name="TEXT_SQLUSER" HorizontalAlignment="Left" Height="40" Margin="150,290,0,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200" FontSize="20"/>
<TextBox x:Name="TEXT_SQLPASWORD" HorizontalAlignment="Left" Height="40" Margin="150,330,0,0" TextWrapping="NoWrap" VerticalAlignment="Top" Width="200" FontSize="20"/>
<Button Content="{x:Static lang:Resources.Test}" HorizontalAlignment="Left" Height="35" Margin="270,375,0,0" VerticalAlignment="Top" Width="80" Click="Test_Click"/>
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,375,0,0" x:Name="textlog" TextWrapping="Wrap" Text="------------" VerticalAlignment="Top" Width="140" FontSize="20"/>
</Grid>
</UserControl>
</UserControl>

47
View/EngineerSetView.xaml.cs

@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
@ -35,8 +36,15 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
comboBoxCOM2.Text = Configini.IniReadvalue("SYS", "COM");
string[] Language = {"en-US","zh-CN","zh-TW" };
string[] SQMOD = { "Windows Authentication", "SQL SERVER"};
comboBoxLanguage.ItemsSource = Language;
TEXT_SQMOD.ItemsSource = SQMOD;
comboBoxLanguage.Text = Configini.IniReadvalue("SYS", "Language");
TEXT_SQLIP.Text = Configini.IniReadvalue("SQL_SERVER", "SQL1"); //读配置文件
TEXT_SQLNAME.Text = Configini.IniReadvalue("SQL_SERVER", "SQL2");
TEXT_SQMOD.Text = Configini.IniReadvalue("SQL_SERVER", "SQL3");
TEXT_SQLUSER.Text = Configini.IniReadvalue("SQL_SERVER", "SQL4");
TEXT_SQLPASWORD.Text = Configini.IniReadvalue("SQL_SERVER", "SQL5");
}
//调用配置文件
private UserClass.IniFile.IniFiles Configini = new UserClass.IniFile.IniFiles(Convert.ToString(System.AppDomain.CurrentDomain.BaseDirectory) + "SCCM.ini");
@ -52,5 +60,44 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
{
Configini.IniWritevalue("SYS", "Language", comboBoxLanguage.SelectedValue.ToString());
}
private async void Test_Click(object sender, RoutedEventArgs e)
{
textlog.Text = "TEST";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 0, 255));
string Connstr_SC;
try
{
if (TEXT_SQMOD.Text == "Windows Authentication") //连接数据库测试
{
Connstr_SC = "server=" + TEXT_SQLIP.Text + ";database=" + TEXT_SQLNAME.Text + ";Trusted_Connection=SSPI";
}
else
{
Connstr_SC = "server=" + TEXT_SQLIP.Text + ";database=" + TEXT_SQLNAME.Text + ";User ID=" + TEXT_SQLUSER.Text + ";Password=" + TEXT_SQLPASWORD.Text;
}
SqlConnection conn_SC = new SqlConnection(Connstr_SC);
await conn_SC.OpenAsync(); //连接数据库
conn_SC.Close();
}
catch (Exception)
{
textlog.Text = "Link timeout";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(255, 0, 0));
return;
}
textlog.Text = "Link succeed";
textlog.Foreground = new SolidColorBrush(Color.FromRgb(0, 255, 0));
MessageBoxResult SqlShow = System.Windows.MessageBox.Show("Whether the connection is successfully saved", "SQL", MessageBoxButton.YesNo, MessageBoxImage.Information); //连接成功提示是否保存
if (SqlShow == MessageBoxResult.Yes)
{
Configini.IniWritevalue("SQL_SERVER", "SQL1", TEXT_SQLIP.Text);
Configini.IniWritevalue("SQL_SERVER", "SQL2", TEXT_SQLNAME.Text);
Configini.IniWritevalue("SQL_SERVER", "SQL3", TEXT_SQMOD.SelectedValue.ToString());
Configini.IniWritevalue("SQL_SERVER", "SQL4", TEXT_SQLUSER.Text);
Configini.IniWritevalue("SQL_SERVER", "SQL5", TEXT_SQLPASWORD.Text);
}
}
}
}

1
View/MonitorView.xaml.cs

@ -130,6 +130,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
}//信息
else if (machines_info == 1)
{
}//输送状态
else if (machines_info == 2)
{

Loading…
Cancel
Save