|
|
@ -21,12 +21,15 @@ using System.Windows.Media.Imaging; |
|
|
|
using System.Windows.Navigation; |
|
|
|
using System.Windows.Shapes; |
|
|
|
using System.Windows.Threading; |
|
|
|
using VncSharpWpf; |
|
|
|
using System.Xml.Linq; |
|
|
|
using TouchSocket.Core; |
|
|
|
using TouchSocket.Sockets; |
|
|
|
using static SunlightCentralizedControlManagement_SCCM_.WindowsView.ViewStep; |
|
|
|
using static System.Net.WebRequestMethods; |
|
|
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Rebar; |
|
|
|
using SunlightCentralizedControlManagement_SCCM_.UserClass; |
|
|
|
using System.Net.NetworkInformation; |
|
|
|
|
|
|
|
namespace SunlightCentralizedControlManagement_SCCM_.View |
|
|
|
{ |
|
|
@ -91,12 +94,59 @@ namespace SunlightCentralizedControlManagement_SCCM_.View |
|
|
|
log.Visibility = Visibility.Visible; |
|
|
|
Picture.Visibility = Visibility.Collapsed; |
|
|
|
}//信息
|
|
|
|
private void ListViewItem_Conveyor(object sender, MouseButtonEventArgs e) |
|
|
|
|
|
|
|
private async Task<bool> PingTest(string ip) |
|
|
|
{ |
|
|
|
bool result = false; |
|
|
|
Ping pingSender = new Ping(); |
|
|
|
|
|
|
|
try |
|
|
|
{ |
|
|
|
PingReply reply = await pingSender.SendPingAsync(ip, 3000); |
|
|
|
|
|
|
|
if (reply.Status == IPStatus.Success) |
|
|
|
{ |
|
|
|
result = true; |
|
|
|
} |
|
|
|
} |
|
|
|
catch (PingException) |
|
|
|
{ |
|
|
|
result = false; |
|
|
|
} |
|
|
|
return result; |
|
|
|
} |
|
|
|
private async void ListViewItem_Screen(object sender, MouseButtonEventArgs e) |
|
|
|
{ |
|
|
|
machines_info = 1; |
|
|
|
log.Visibility = Visibility.Visible; |
|
|
|
Picture.Visibility = Visibility.Collapsed; |
|
|
|
}//输送
|
|
|
|
|
|
|
|
RemoteDesktopWpf remoteDesktopWpf = new RemoteDesktopWpf(); |
|
|
|
Picture.Content = remoteDesktopWpf; |
|
|
|
|
|
|
|
|
|
|
|
DataRow drEmployee = MainWindowViewModel.Machines.Select("NAME='" + machine + "'").First(); |
|
|
|
string host = drEmployee.Field<string>("IP"); |
|
|
|
int port = Convert.ToInt16(drEmployee.Field<int>("PORT")); |
|
|
|
string password = drEmployee.Field<string>("SYSKEY"); |
|
|
|
|
|
|
|
if (await PingTest(host)) |
|
|
|
{ |
|
|
|
if (!remoteDesktopWpf.IsConnected) |
|
|
|
{ |
|
|
|
try |
|
|
|
{ |
|
|
|
remoteDesktopWpf.VncPort = port; |
|
|
|
remoteDesktopWpf.Passwd = password; |
|
|
|
remoteDesktopWpf.Connect(host, true, false); |
|
|
|
} |
|
|
|
catch (Exception ex) |
|
|
|
{ |
|
|
|
LogGing.ERRDATA(ex); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}//远程
|
|
|
|
private void ListViewItem_Receipt(object sender, MouseButtonEventArgs e) |
|
|
|
{ |
|
|
|
machines_info = 2; |
|
|
|