|
|
@ -13,6 +13,7 @@ using System.Windows.Input; |
|
|
|
using System.Windows.Media; |
|
|
|
using System.Windows.Media.Imaging; |
|
|
|
using System.Windows.Shapes; |
|
|
|
using System.Net.NetworkInformation; |
|
|
|
|
|
|
|
|
|
|
|
namespace SunlightCentralizedControlManagement_SCCM_.EX |
|
|
@ -22,9 +23,24 @@ namespace SunlightCentralizedControlManagement_SCCM_.EX |
|
|
|
/// </summary>
|
|
|
|
public partial class VNC : Window |
|
|
|
{ |
|
|
|
string host = "172.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 连接成功!");
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -32,5 +48,32 @@ namespace SunlightCentralizedControlManagement_SCCM_.EX |
|
|
|
{ |
|
|
|
this.Close(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private bool PingTest(string ip) |
|
|
|
{ |
|
|
|
bool result = false; |
|
|
|
Ping pingSender = new Ping(); |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
PingReply reply = pingSender.Send(ip, 120); |
|
|
|
if (reply.Status == IPStatus.Success) |
|
|
|
{ |
|
|
|
result = true; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
catch (PingException e) |
|
|
|
{ |
|
|
|
result = false; |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|