sc 7 months ago
parent
commit
e11373d5f8
  1. 5
      EX/VNC.xaml
  2. 9
      EX/VNC.xaml.cs
  3. 1
      SunlightCentralizedControlManagement_SCCM_.csproj

5
EX/VNC.xaml

@ -5,14 +5,15 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
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:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
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"> <WindowsFormsHost Margin="0,0,0,60">
<vnc:RemoteDesktop x:Name="vnc" /> <vnc:RemoteDesktop x:Name="vnc" />
</ContentControl> </WindowsFormsHost>
<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>

9
EX/VNC.xaml.cs

@ -25,7 +25,7 @@ namespace SunlightCentralizedControlManagement_SCCM_.EX
{ {
string host = "127.0.0.1"; // 替换为你的 VNC 服务器地址 string host = "127.0.0.1"; // 替换为你的 VNC 服务器地址
int port = 5901; // 替换为你的 VNC 服务器端口 int port = 5901; // 替换为你的 VNC 服务器端口
string password = " "; // 替换为你的 VNC 服务器密码 string password = "123456"; // 替换为你的 VNC 服务器密码
public VNC() public VNC()
{ {
@ -70,7 +70,8 @@ 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(); {// host = IP.ToString();
//port =Convert.ToInt16( PROT); //port =Convert.ToInt16( PROT);
password = PASSWD.ToString(); } // password = PASSWD.ToString();
}
/* private Window_Loaded(object sender, RoutedEventArgs e) /* private Window_Loaded(object sender, RoutedEventArgs e)
{ {
@ -85,7 +86,9 @@ namespace SunlightCentralizedControlManagement_SCCM_.EX
if (!vnc.IsConnected) if (!vnc.IsConnected)
{ {
vnc.VncPort = port; vnc.VncPort = port;
vnc.Connect(host, false, true); vnc.GetPassword();
vnc.Connect(host, true, true);
// vnc.Authenticate(password);
//System.Windows.MessageBox.Show("VNC 连接成功!"); //System.Windows.MessageBox.Show("VNC 连接成功!");
} }

1
SunlightCentralizedControlManagement_SCCM_.csproj

@ -93,6 +93,7 @@
<Reference Include="WindowsBase" /> <Reference Include="WindowsBase" />
<Reference Include="PresentationCore" /> <Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" /> <Reference Include="PresentationFramework" />
<Reference Include="WindowsFormsIntegration" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ApplicationDefinition Include="App.xaml"> <ApplicationDefinition Include="App.xaml">

Loading…
Cancel
Save