Merge branch 'master' of http://www.scserverddns.top:13000/sc/SunlightCentralizedControlManagement
This commit is contained in:
commit
87d131b5e8
9 files changed
+139
-18
No files matched your search
@@ -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>
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -130,6 +130,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
|
||||
}//信息
|
||||
else if (machines_info == 1)
|
||||
{
|
||||
|
||||
}//输送状态
|
||||
else if (machines_info == 2)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user