添加VncSharp库
This commit is contained in:
commit
2d4cba6cc4
3 files changed
+51
-3
No files matched your search
+5
-3
@@ -4,12 +4,14 @@
|
|||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
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:vnc="clr-namespace:VncSharp;assembly=VncSharp"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
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">
|
||||||
|
<vnc:RemoteDesktop x:Name="vnc" />
|
||||||
|
</ContentControl>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
||||||
@@ -13,6 +13,7 @@ using System.Windows.Input;
|
|||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
using System.Net.NetworkInformation;
|
||||||
|
|
||||||
|
|
||||||
namespace SunlightCentralizedControlManagement_SCCM_.EX
|
namespace SunlightCentralizedControlManagement_SCCM_.EX
|
||||||
@@ -22,9 +23,24 @@ namespace SunlightCentralizedControlManagement_SCCM_.EX
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class VNC : Window
|
public partial class VNC : Window
|
||||||
{
|
{
|
||||||
|
string host = "172.0.0.1"; // 替换为你的 VNC 服务器地址
|
||||||
|
int port = 5901; // 替换为你的 VNC 服务器端口
|
||||||
|
string password = " "; // 替换为你的 VNC 服务器密码
|
||||||
|
|
||||||
public VNC()
|
public VNC()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if (!vnc.IsConnected)
|
||||||
|
{
|
||||||
|
vnc.Connect(host, false, true);
|
||||||
|
//System.Windows.MessageBox.Show("VNC 连接成功!");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -32,5 +48,32 @@ namespace SunlightCentralizedControlManagement_SCCM_.EX
|
|||||||
{
|
{
|
||||||
this.Close();
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -484,6 +484,9 @@
|
|||||||
<PackageReference Include="TouchSocket">
|
<PackageReference Include="TouchSocket">
|
||||||
<Version>3.0.9</Version>
|
<Version>3.0.9</Version>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
<PackageReference Include="VncSharp">
|
||||||
|
<Version>1.0.7</Version>
|
||||||
|
</PackageReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Folder Include="ControlUse\" />
|
<Folder Include="ControlUse\" />
|
||||||
|
|||||||
Reference in new issue
Block a user