sc 7 months ago
parent
commit
289a9fbf81
  1. 5
      EX/VNC.xaml
  2. 17
      EX/VNC.xaml.cs

5
EX/VNC.xaml

@ -6,13 +6,14 @@
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.EX" xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.EX"
xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties" xmlns:lang="clr-namespace:SunlightCentralizedControlManagement_SCCM_.Properties"
xmlns:vnc="clr-namespace:VncSharp;assembly=VncSharp" xmlns:vnc="clr-namespace:VncSharp;assembly=VncSharp"
mc:Ignorable="d" Loaded="Window_Loaded" mc:Ignorable="d" Loaded="Window_Loaded"
Title="VNC" Height="450" Width="800"> Title="VNC" Height="450" Width="800">
<Grid Margin="0,0,0,0"> <Grid Margin="0,0,0,0">
<Button x:Name="Save" Content="{x:Static lang:Resources.Cancel}" HorizontalAlignment="Right" Height="35" Margin="450,0,50,10" VerticalAlignment="Bottom" Width="80" Click="Save_Click"/> <Button x:Name="Save" Content="{x:Static lang:Resources.Cancel}" HorizontalAlignment="Right" Height="35" Margin="450,0,50,10" VerticalAlignment="Bottom" Width="80" Click="Save_Click"/>
<ContentControl Margin="0,0,0,60"> <ContentControl Margin="0,0,0,60">
<vnc:RemoteDesktop x:Name="vnc" /> <vnc:RemoteDesktop x:Name="vnc" />
</ContentControl> </ContentControl>
<TextBlock x:Name="log" VerticalAlignment="Bottom" Text="LINK-------" Margin="0,0,0,10" HorizontalAlignment="Left" Width="600" Height="35" FontSize="24" FontWeight="Bold" FontStyle="Italic" /> <TextBlock x:Name="log" VerticalAlignment="Bottom" Text="LINK-------" Margin="0,0,0,10" HorizontalAlignment="Left" Width="600" Height="35" FontSize="24" FontWeight="Bold" FontStyle="Italic" />
</Grid> </Grid>
</Window> </Window>

17
EX/VNC.xaml.cs

@ -46,7 +46,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.EX
try try
{ {
PingReply reply = await pingSender.SendPingAsync(ip, 6); PingReply reply = await pingSender.SendPingAsync(ip, 3000);
if (reply.Status == IPStatus.Success) if (reply.Status == IPStatus.Success)
{ {
@ -68,19 +68,28 @@ namespace SunlightCentralizedControlManagement_SCCM_.EX
} }
public void Parameter(object IP,object PROT,object USER ,object PASSWD) public void Parameter(object IP,object PROT,object USER ,object PASSWD)
{ host = IP.ToString();port =Convert.ToInt16( PROT); password = PASSWD.ToString(); } {// host = IP.ToString();
//port =Convert.ToInt16( PROT);
password = PASSWD.ToString(); }
private async Task Window_Loaded(object sender, RoutedEventArgs e) /* private Window_Loaded(object sender, RoutedEventArgs e)
{ {
}*/
private async void Window_Loaded(object sender, RoutedEventArgs e)
{
if (await PingTest(host)) if (await PingTest(host))
{ {
if (!vnc.IsConnected) if (!vnc.IsConnected)
{ {
vnc.VncPort = port;
vnc.Connect(host, false, true); vnc.Connect(host, false, true);
//System.Windows.MessageBox.Show("VNC 连接成功!"); //System.Windows.MessageBox.Show("VNC 连接成功!");
} }
} }
} }
} }
} }

Loading…
Cancel
Save