Skip to content

Commit

Permalink
完善默认行为。
Browse files Browse the repository at this point in the history
  • Loading branch information
SIXiaolong1117 committed Mar 1, 2023
1 parent d7f36f9 commit 7e6b173
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 9 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@

安装需要注意的是,要右键“使用PowrShell”运行`Install.ps1`,而不是直接双击`WinWoL.msix`

## 使用教程

参考本项目[Wiki](https://github.com/Direct5dom/WinWoL/wiki)

## 🛠️获取源码

要构建此项目,您需要将项目源码克隆到本地。
Expand Down
8 changes: 4 additions & 4 deletions WinWoL/RDP.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBox x:Name="ipAddress" Header="IP地址:" Width="268" Margin="0,8,0,0"/>
<TextBlock Text="RDP的IP地址" Foreground="DarkGray" FontSize="12"/>
<TextBox x:Name="ipPort" Header="端口:" Width="268" Margin="0,8,0,0"/>
<TextBlock Text="RDP的端口" Foreground="DarkGray" FontSize="12"/>
<TextBox x:Name="ipAddress" Header="IP地址:" PlaceholderText="192.168.0.2" Width="268" Margin="0,8,0,0"/>
<TextBlock Text="远程主机的IP地址" Foreground="DarkGray" FontSize="12"/>
<TextBox x:Name="ipPort" Header="端口:" PlaceholderText="3389" Width="268" Margin="0,8,0,0"/>
<TextBlock Text="远程主机的RDP端口" Foreground="DarkGray" FontSize="12"/>

<Button x:Name="RDPPC" Click="RDPPCButton_Click"
HorizontalAlignment="Center" VerticalAlignment="Bottom"
Expand Down
4 changes: 4 additions & 0 deletions WinWoL/RDP.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ public RDP()
}
private void RDPPCButton_Click(object sender, RoutedEventArgs e)
{
if (ipPort.Text == "")
{
ipPort.Text = "3389";
}
localSettings.Values["mstscCMD"] = "mstsc /v:" + ipAddress.Text + ":" + ipPort.Text + ";";
ThreadStart childref = new ThreadStart(RDPPCChildThread);
Thread childThread = new Thread(childref);
Expand Down
10 changes: 5 additions & 5 deletions WinWoL/WoL.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBox x:Name="macAddress" Header="Mac地址:" Width="268" Margin="0,8,0,0"/>
<TextBox x:Name="macAddress" Header="Mac地址:" PlaceholderText="AA:BB:CC:DD:EE:FF" Width="268" Margin="0,8,0,0"/>
<TextBlock Text="待唤醒设备的MAC地址" Foreground="DarkGray" FontSize="12"/>
<TextBox x:Name="ipAddress" Header="IP地址:" Width="268" Margin="0,8,0,0"/>
<TextBlock Text="待唤醒设备的IP地址" Foreground="DarkGray" FontSize="12"/>
<TextBox x:Name="ipPort" Header="端口:" Width="268" Margin="0,8,0,0"/>
<TextBlock Text="唤醒设备使用的端口" Foreground="DarkGray" FontSize="12"/>
<TextBox x:Name="ipAddress" Header="IP地址:" PlaceholderText="255.255.255.255" Width="268" Margin="0,8,0,0"/>
<TextBlock Text="接收Magic Packet的IP地址" Foreground="DarkGray" FontSize="12"/>
<TextBox x:Name="ipPort" Header="端口:" PlaceholderText="7 or 9" Width="268" Margin="0,8,0,0"/>
<TextBlock Text="接收Magic Packet的端口" Foreground="DarkGray" FontSize="12"/>

<Button x:Name="WakePC" Click="WakePCButton_Click"
HorizontalAlignment="Center" VerticalAlignment="Bottom"
Expand Down
9 changes: 9 additions & 0 deletions WinWoL/WoL.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ public WoL()
}
private void WakePCButton_Click(object sender, RoutedEventArgs e)
{
if (ipAddress.Text == "")
{
// 255.255.255.255是一个特殊的IP地址,可以向LAN网络内的所有设备发送数据
ipAddress.Text = "255.255.255.255";
}
if (ipPort.Text == "")
{
ipPort.Text = "9";
}
sendMagicPacket(macAddress.Text, ipAddress.Text, int.Parse(ipPort.Text));
}
public void sendMagicPacket(string macAddress, string domain, int port)
Expand Down

0 comments on commit 7e6b173

Please sign in to comment.