添加vnc功能
This commit is contained in:
commit
18d6aa3e87
8 files changed
+70
-40
No files matched your search
Binary file not shown.
Binary file not shown.
+4
-4
@@ -6,15 +6,15 @@
|
||||
xmlns:local="clr-namespace:SunlightCentralizedControlManagement_SCCM_.EX"
|
||||
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:rdp="clr-namespace:VncSharpWpf;assembly=VncSharpWpf"
|
||||
mc:Ignorable="d" Loaded="Window_Loaded"
|
||||
Title="VNC" Height="450" Width="800">
|
||||
<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"/>
|
||||
<WindowsFormsHost Margin="0,0,0,60">
|
||||
<vnc:RemoteDesktop x:Name="vnc" />
|
||||
</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" />
|
||||
<Grid Margin="0,0,0,60">
|
||||
<rdp:RemoteDesktopWpf x:Name="rdp" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
</Window>
|
||||
+46
-28
@@ -14,6 +14,7 @@ using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using System.Net.NetworkInformation;
|
||||
using VncSharpWpf;
|
||||
|
||||
|
||||
namespace SunlightCentralizedControlManagement_SCCM_.EX
|
||||
@@ -30,15 +31,60 @@ namespace SunlightCentralizedControlManagement_SCCM_.EX
|
||||
public VNC()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// vnc.Cursor = Cursors;
|
||||
|
||||
// vnc.MouseMove += Vnc_MouseMove;
|
||||
// vnc.MouseDown += Vnc_MouseDown ;
|
||||
// vnc.MouseUp += Vnc_MouseUp;
|
||||
// vnc.MouseLeave += Vnc_MouseLeave;
|
||||
// vnc.MouseWheel += Vnc_MouseWheel;
|
||||
// vnc.PreviewKeyDown += Vnc_PreviewKeyDown;
|
||||
|
||||
|
||||
// rdp.ConnectComplete += new ConnectCompleteHandler(ConnectCompleteEventHandler);
|
||||
// rdp.ConnectionLost += new EventHandler(ConnectionLostEventHandler);
|
||||
// rdp.StoppedListen += new EventHandler(ConnectionLostEventHandler);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
private void Save_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (rdp.IsConnected) { rdp.Disconnect(); }//断开连接
|
||||
this.Close();
|
||||
}
|
||||
|
||||
public void Parameter(object IP, object PROT, object USER, object PASSWD)
|
||||
{
|
||||
host = IP.ToString();
|
||||
port = Convert.ToInt16(PROT);
|
||||
password = PASSWD.ToString();
|
||||
}
|
||||
|
||||
private async void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (await PingTest(host))
|
||||
{
|
||||
if (!rdp.IsConnected)
|
||||
{
|
||||
try
|
||||
{
|
||||
rdp.VncPort = port;
|
||||
rdp.Passwd = password;
|
||||
rdp.Connect(host, true, true);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
private async Task<bool> PingTest(string ip)
|
||||
{
|
||||
bool result = false;
|
||||
@@ -66,33 +112,5 @@ namespace SunlightCentralizedControlManagement_SCCM_.EX
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public void Parameter(object IP,object PROT,object USER ,object PASSWD)
|
||||
{// host = IP.ToString();
|
||||
//port =Convert.ToInt16( PROT);
|
||||
// password = PASSWD.ToString();
|
||||
}
|
||||
|
||||
/* private Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
}*/
|
||||
|
||||
private async void Window_Loaded(object sender, RoutedEventArgs e)
|
||||
{
|
||||
|
||||
if (await PingTest(host))
|
||||
{
|
||||
if (!vnc.IsConnected)
|
||||
{
|
||||
vnc.VncPort = port;
|
||||
vnc.GetPassword();
|
||||
vnc.Connect(host, true, true);
|
||||
// vnc.Authenticate(password);
|
||||
|
||||
//System.Windows.MessageBox.Show("VNC 连接成功!");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SunlightCentralizedControlM
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nGantt", "..\nGantt\nGantt.csproj", "{CCC54F28-5D20-4AB3-A1A8-C62CD2DA3AE7}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VncSharpWpf", "..\VncSharpWpf\VncSharpWpf.csproj", "{77B5CB63-E14B-4253-881D-6BE9D7C57076}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -21,6 +23,10 @@ Global
|
||||
{CCC54F28-5D20-4AB3-A1A8-C62CD2DA3AE7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CCC54F28-5D20-4AB3-A1A8-C62CD2DA3AE7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CCC54F28-5D20-4AB3-A1A8-C62CD2DA3AE7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{77B5CB63-E14B-4253-881D-6BE9D7C57076}.Debug|Any CPU.ActiveCfg = Debug|x86
|
||||
{77B5CB63-E14B-4253-881D-6BE9D7C57076}.Debug|Any CPU.Build.0 = Debug|x86
|
||||
{77B5CB63-E14B-4253-881D-6BE9D7C57076}.Release|Any CPU.ActiveCfg = Release|x86
|
||||
{77B5CB63-E14B-4253-881D-6BE9D7C57076}.Release|Any CPU.Build.0 = Release|x86
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -406,6 +406,7 @@
|
||||
<None Include="DATA\Chart.db" />
|
||||
<None Include="DATA\nGantt.zip" />
|
||||
<None Include="DATA\SCCM.db" />
|
||||
<None Include="DATA\VncSharpWpf.zip" />
|
||||
<None Include="Fonts\font-awesome-4.7.0.zip" />
|
||||
<None Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.eot" />
|
||||
<Resource Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.ttf" />
|
||||
@@ -485,15 +486,13 @@
|
||||
<PackageReference Include="TouchSocket">
|
||||
<Version>3.0.9</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="VncSharp">
|
||||
<Version>1.0.7</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="ControlUse\" />
|
||||
<Folder Include="EX\EXModel\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="EX\DLL\VncSharpWpf.dll" />
|
||||
<Content Include="Fonts\font-awesome-4.7.0\css\font-awesome.css" />
|
||||
<Content Include="Fonts\font-awesome-4.7.0\css\font-awesome.min.css" />
|
||||
<Content Include="Fonts\font-awesome-4.7.0\fonts\fontawesome-webfont.svg" />
|
||||
@@ -546,6 +545,13 @@
|
||||
<Project>{ccc54f28-5d20-4ab3-a1a8-c62cd2da3ae7}</Project>
|
||||
<Name>nGantt</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\VncSharpWpf\VncSharpWpf.csproj">
|
||||
<Project>{77b5cb63-e14b-4253-881d-6be9d7c57076}</Project>
|
||||
<Name>VncSharpWpf</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<WCFMetadata Include="Connected Services\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Target Name="AfterResolveReferences">
|
||||
|
||||
@@ -40,9 +40,9 @@
|
||||
<materialDesign:PackIcon x:Name="mlock" Kind="Lock" VerticalAlignment="Bottom" HorizontalAlignment="Left" Width="50" Height="50" Foreground="#FFA98C00" VerticalContentAlignment="Center" HorizontalContentAlignment="Center"/>
|
||||
|
||||
</Grid>
|
||||
<TextBlock x:Name="IP" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" />
|
||||
<TextBlock x:Name="PORT" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" />
|
||||
<TextBlock x:Name="USER" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" />
|
||||
<TextBlock x:Name="PASSWD" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" />
|
||||
<TextBlock x:Name="IP" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="{x:Null}" />
|
||||
<TextBlock x:Name="PORT" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="{x:Null}" />
|
||||
<TextBlock x:Name="USER" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="{x:Null}" />
|
||||
<TextBlock x:Name="PASSWD" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top" Foreground="{x:Null}" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -81,7 +81,7 @@
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,50,0,0" TextWrapping="Wrap" Text="{x:Static lang:Resources.MachineGroup}" VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="150,100,0,0" x:Name="IP" VerticalAlignment="Top" Width="200" FontSize="20" MaxLines="1"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="350,100,0,0" TextWrapping="Wrap" Text=":" VerticalAlignment="Top" Width="20" FontSize="25"/>
|
||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="360,100,0,0" x:Name="PORT" VerticalAlignment="Top" Width="60" FontSize="20" MaxLines="1" Text="7789"/>
|
||||
<TextBox HorizontalAlignment="Left" Height="30" Margin="360,100,0,0" x:Name="PORT" VerticalAlignment="Top" Width="60" FontSize="20" MaxLines="1" Text="5901"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,100,0,0" TextWrapping="Wrap" Text="IP/PORT" VerticalAlignment="Top" Width="120" FontSize="25"/>
|
||||
<TextBlock HorizontalAlignment="Left" Height="40" Margin="10,600,0,15" x:Name="textlog" TextWrapping="Wrap" Text="------------" VerticalAlignment="Bottom" Width="140" FontSize="20"/>
|
||||
<Button Content="{x:Static lang:Resources.Save}" HorizontalAlignment="Left" Height="35" Margin="250,600,0,15" VerticalAlignment="Bottom" Width="80" Click="Save_Click"/>
|
||||
|
||||
Reference in new issue
Block a user