sc 7 months ago
parent
commit
0a80ae9db4
  1. 4
      EX/VNC.xaml.cs
  2. 6
      View/MonitorView.xaml
  3. 54
      View/MonitorView.xaml.cs

4
EX/VNC.xaml.cs

@ -63,17 +63,13 @@ namespace SunlightCentralizedControlManagement_SCCM_.EX
//rdp.SetScalingMode(false);//自动缩放全屏 //rdp.SetScalingMode(false);//自动缩放全屏
// rdp.SetInputMode(false);//可交互 // rdp.SetInputMode(false);//可交互
} }
catch (Exception ex) catch (Exception ex)
{ {
LogGing.ERRDATA(ex); LogGing.ERRDATA(ex);
} }
} }
} }
} }
private async Task<bool> PingTest(string ip) private async Task<bool> PingTest(string ip)

6
View/MonitorView.xaml

@ -169,10 +169,10 @@
</ListViewItem> </ListViewItem>
</ListView> </ListView>
<ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD"> <ListView ScrollViewer.HorizontalScrollBarVisibility="Disabled" Foreground="#FF1368BD">
<ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Conveyor"> <ListViewItem Width="150" MouseLeftButtonUp="ListViewItem_Screen">
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<materialDesign:PackIcon Kind="Pipe" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/> <materialDesign:PackIcon Kind="Monitor" Width="40" Height="30" Margin="10" VerticalAlignment="Center" Foreground="#FF1368BD"/>
<TextBlock Text="{x:Static lang:Resources.Conveyor}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/> <TextBlock Text="{x:Static lang:Resources.Screen}" VerticalAlignment="Center" Margin="20 10" Foreground="White"/>
</StackPanel> </StackPanel>
</ListViewItem> </ListViewItem>
</ListView> </ListView>

54
View/MonitorView.xaml.cs

@ -21,12 +21,15 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation; using System.Windows.Navigation;
using System.Windows.Shapes; using System.Windows.Shapes;
using System.Windows.Threading; using System.Windows.Threading;
using VncSharpWpf;
using System.Xml.Linq; using System.Xml.Linq;
using TouchSocket.Core; using TouchSocket.Core;
using TouchSocket.Sockets; using TouchSocket.Sockets;
using static SunlightCentralizedControlManagement_SCCM_.WindowsView.ViewStep; using static SunlightCentralizedControlManagement_SCCM_.WindowsView.ViewStep;
using static System.Net.WebRequestMethods; using static System.Net.WebRequestMethods;
using static System.Windows.Forms.VisualStyles.VisualStyleElement.Rebar; using static System.Windows.Forms.VisualStyles.VisualStyleElement.Rebar;
using SunlightCentralizedControlManagement_SCCM_.UserClass;
using System.Net.NetworkInformation;
namespace SunlightCentralizedControlManagement_SCCM_.View namespace SunlightCentralizedControlManagement_SCCM_.View
{ {
@ -91,12 +94,59 @@ namespace SunlightCentralizedControlManagement_SCCM_.View
log.Visibility = Visibility.Visible; log.Visibility = Visibility.Visible;
Picture.Visibility = Visibility.Collapsed; 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; machines_info = 1;
log.Visibility = Visibility.Visible; log.Visibility = Visibility.Visible;
Picture.Visibility = Visibility.Collapsed; 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) private void ListViewItem_Receipt(object sender, MouseButtonEventArgs e)
{ {
machines_info = 2; machines_info = 2;

Loading…
Cancel
Save