diff --git a/EX/VNC.xaml b/EX/VNC.xaml
index fe96cff..0c8d596 100644
--- a/EX/VNC.xaml
+++ b/EX/VNC.xaml
@@ -6,12 +6,13 @@
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.EX"
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
xmlns:vnc="clr-namespace:VncSharp;assembly=VncSharp"
- mc:Ignorable="d"
+ mc:Ignorable="d" Loaded="Window_Loaded"
Title="VNC" Height="450" Width="800">
+
diff --git a/EX/VNC.xaml.cs b/EX/VNC.xaml.cs
index 6b69641..40aa0a7 100644
--- a/EX/VNC.xaml.cs
+++ b/EX/VNC.xaml.cs
@@ -23,24 +23,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.EX
///
public partial class VNC : Window
{
- string host = "172.0.0.1"; // 替换为你的 VNC 服务器地址
+ string host = "127.0.0.1"; // 替换为你的 VNC 服务器地址
int port = 5901; // 替换为你的 VNC 服务器端口
string password = " "; // 替换为你的 VNC 服务器密码
public VNC()
{
InitializeComponent();
-
-
-
-
-
- if (!vnc.IsConnected)
- {
- vnc.Connect(host, false, true);
- //System.Windows.MessageBox.Show("VNC 连接成功!");
- }
-
}
@@ -50,30 +39,48 @@ namespace SunlightCentralizedControlManagement_SCCM_.EX
}
- private bool PingTest(string ip)
+ private async Task PingTest(string ip)
{
bool result = false;
Ping pingSender = new Ping();
try
{
- PingReply reply = pingSender.Send(ip, 120);
+ PingReply reply = await pingSender.SendPingAsync(ip, 6);
+
if (reply.Status == IPStatus.Success)
{
result = true;
+ log.Text = ip + " Connected";
+ }
+ else
+ {
+ log.Text = ip + " Timeout";
}
}
catch (PingException e)
{
result = false;
+ log.Text = ip + " Not Connected";
}
return result;
}
+ public void Parameter(object IP,object PROT,object USER ,object PASSWD)
+ { host = IP.ToString();port =Convert.ToInt16( PROT); password = PASSWD.ToString(); }
-
+ private async Task Window_Loaded(object sender, RoutedEventArgs e)
+ {
+ if (await PingTest(host))
+ {
+ if (!vnc.IsConnected)
+ {
+ vnc.Connect(host, false, true);
+ //System.Windows.MessageBox.Show("VNC 连接成功!");
+ }
+ }
+ }
+
}
-
-
}
diff --git a/UserControls/DispenseMacInfo.xaml b/UserControls/DispenseMacInfo.xaml
index 338fa37..9daa62b 100644
--- a/UserControls/DispenseMacInfo.xaml
+++ b/UserControls/DispenseMacInfo.xaml
@@ -38,6 +38,11 @@
+
+
+
+
+
diff --git a/UserControls/DispenseMacInfo.xaml.cs b/UserControls/DispenseMacInfo.xaml.cs
index 3bf4872..27d0c38 100644
--- a/UserControls/DispenseMacInfo.xaml.cs
+++ b/UserControls/DispenseMacInfo.xaml.cs
@@ -30,8 +30,8 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserControls
public DispenseMacInfo()
{
InitializeComponent();
- }
-
+ }
+
private void State_Click(object sender, RoutedEventArgs e)//状态
{
if (mlock.Visibility == Visibility.Visible)
@@ -63,6 +63,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.UserControls
MessageBox.Show(Properties.Resources.Not_a, "Dispense", MessageBoxButton.OK);
return;
}
+ VNC screen = new VNC();
+ screen.Parameter(IP.Text,PORT.Text,USER.Text,PASSWD.Text);
+ screen.Show();
}
}
diff --git a/View/DispenseMachinesSet.xaml.cs b/View/DispenseMachinesSet.xaml.cs
index 28ba402..778c87c 100644
--- a/View/DispenseMachinesSet.xaml.cs
+++ b/View/DispenseMachinesSet.xaml.cs
@@ -86,7 +86,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
dr_new.Add("type", type_);
dr_new.Add("State", "899");
dr_new.Add("User", User.Text);
- dr_new.Add("Passsword", Password.Text);
+ dr_new.Add("Password", Password.Text);
dr_new.Add("LOCK", dLICK.IsChecked.ToString());
dr_new.Add("DATA",imageData);
diff --git a/View/DispenseView.xaml.cs b/View/DispenseView.xaml.cs
index db05faf..f96598a 100644
--- a/View/DispenseView.xaml.cs
+++ b/View/DispenseView.xaml.cs
@@ -63,6 +63,10 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
dispenseMacInfo[i].Margin = new Thickness(5, 5, 0, 5);
dispenseMacInfo[i].Width = 400;
dispenseMacInfo[i].Height = 600;
+ dispenseMacInfo[i].IP.Text = DispenseMac.AsEnumerable().Select(row => row.Field("IP")).ElementAt(i);
+ dispenseMacInfo[i].USER.Text = DispenseMac.AsEnumerable().Select(row => row.Field("User")).ElementAt(i);
+ dispenseMacInfo[i].PORT.Text = DispenseMac.AsEnumerable().Select(row => row.Field("PORT")).ElementAt(i).ToString();
+ dispenseMacInfo[i].PASSWD.Text = DispenseMac.AsEnumerable().Select(row => row.Field("Password")).ElementAt(i);
dispenseMacInfo[i].type_.Text= DispenseMac.AsEnumerable().Select(row => row.Field("type")).ElementAt(i).ToString();
dispenseMacInfo[i].mac.Text = DispenseMac.AsEnumerable().Select(row => row.Field("name")).ElementAt(i);
dispenseMacInfo[i].macg.Text = DispenseMac.AsEnumerable().Select(row => row.Field("Groups")).ElementAt(i);