From a628fb1c31dbdc291bfa5a302c2ccf1af0cdc80b Mon Sep 17 00:00:00 2001 From: SI_Xiaolong Date: Sun, 2 Apr 2023 11:28:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=86WoL=E5=92=8CRDP=E7=9A=84=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=95=B4=E5=90=88=E5=9C=A8=E4=B8=80=E8=B5=B7=EF=BC=8C?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E5=85=B1=E7=94=A8=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WinWoL/AddConfigDialog.xaml | 58 +++++++++++++++++++++++----- WinWoL/AddConfigDialog.xaml.cs | 68 ++++++++++++++++++++++++++++++++- WinWoL/MainWindow.xaml | 10 ++--- WinWoL/MainWindow.xaml.cs | 16 +++----- WinWoL/Package.appxmanifest | 2 +- WinWoL/SettingsPage.xaml | 8 +++- WinWoL/SettingsPage.xaml.cs | 13 +++++++ WinWoL/WinWoL.csproj | 4 +- WinWoL/WoL.xaml | 22 ++++++++--- WinWoL/WoL.xaml.cs | 69 +++++++++++++++++++++++++++++----- 10 files changed, 224 insertions(+), 46 deletions(-) diff --git a/WinWoL/AddConfigDialog.xaml b/WinWoL/AddConfigDialog.xaml index 197d94a..5558e4e 100644 --- a/WinWoL/AddConfigDialog.xaml +++ b/WinWoL/AddConfigDialog.xaml @@ -14,7 +14,7 @@ - + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WinWoL/AddConfigDialog.xaml.cs b/WinWoL/AddConfigDialog.xaml.cs index 71bbdc9..9eae352 100644 --- a/WinWoL/AddConfigDialog.xaml.cs +++ b/WinWoL/AddConfigDialog.xaml.cs @@ -49,12 +49,76 @@ public AddConfigDialog() macAddress.Text = configInnerSplit[1]; ipAddress.Text = configInnerSplit[2]; ipPort.Text = configInnerSplit[3]; + rdpIsOpen.IsOn = configInnerSplit[4] == "True"; + rdpIpAddress.Text = configInnerSplit[5]; + rdpIpPort.Text = configInnerSplit[6]; + Broadcast.IsChecked = configInnerSplit[7] == "True"; + SameIPAddr.IsChecked = configInnerSplit[8] == "True"; + } + + redIsOpenCheck(); + } + private void InnerChanged() + { + localSettings.Values["ConfigIDTemp"] = configName.Text + "," + macAddress.Text + "," + + ipAddress.Text + "," + ipPort.Text + "," + + rdpIsOpen.IsOn + "," + rdpIpAddress.Text + "," + rdpIpPort.Text + "," + + Broadcast.IsChecked + "," + SameIPAddr.IsChecked; + + if (localSettings.Values["DeveloperImpartIsOpen"] as string == "True") + { + Test.Text = localSettings.Values["ConfigIDTemp"] as string; + Test.Visibility = Visibility.Visible; + } + else + { + Test.Visibility = Visibility.Collapsed; } } public void TextChanged(object sender, TextChangedEventArgs e) { - localSettings.Values["ConfigIDTemp"] = configName.Text + "," + macAddress.Text + "," + ipAddress.Text + "," + ipPort.Text; - Test.Text = localSettings.Values["ConfigIDTemp"] as string; + InnerChanged(); + } + private void Broadcast_Checked(object sender, RoutedEventArgs e) + { + ipAddress.Text = "255.255.255.255"; + ipAddress.IsEnabled = false; + SameIPAddr.IsEnabled = false; + InnerChanged(); + } + private void Broadcast_Unchecked(object sender, RoutedEventArgs e) + { + ipAddress.IsEnabled = true; + SameIPAddr.IsEnabled = true; + InnerChanged(); + } + + private void SameIPAddr_Checked(object sender, RoutedEventArgs e) + { + rdpIpAddress.Text = ipAddress.Text; + rdpIpAddress.IsEnabled = false; + InnerChanged(); + } + private void SameIPAddr_Unchecked(object sender, RoutedEventArgs e) + { + rdpIpAddress.IsEnabled = true; + InnerChanged(); + } + private void rdpIsOpen_Toggled(object sender, RoutedEventArgs e) + { + redIsOpenCheck(); + InnerChanged(); + } + private void redIsOpenCheck() + { + if (rdpIsOpen.IsOn == true) + { + RDPSettings.Visibility = Visibility.Visible; + } + else + { + RDPSettings.Visibility = Visibility.Collapsed; + } } } } \ No newline at end of file diff --git a/WinWoL/MainWindow.xaml b/WinWoL/MainWindow.xaml index f3ebea2..2664dd7 100644 --- a/WinWoL/MainWindow.xaml +++ b/WinWoL/MainWindow.xaml @@ -48,11 +48,11 @@ - - - - - + + + + + diff --git a/WinWoL/MainWindow.xaml.cs b/WinWoL/MainWindow.xaml.cs index 1b69668..716661b 100644 --- a/WinWoL/MainWindow.xaml.cs +++ b/WinWoL/MainWindow.xaml.cs @@ -51,19 +51,13 @@ public MainWindow() { this.InitializeComponent(); - // Hide default title bar. + // 隐藏默认TitleBar ExtendsContentIntoTitleBar = true; SetTitleBar(AppTitleBar); TrySetSystemBackdrop(); - if (localSettings.Values["adb"] == null) - { - localSettings.Values["adb"] = "adb"; - } - NavView.SelectedItem = NavView.MenuItems[0]; - //contentFrame.Navigate(typeof(DragandDrop)); } bool TrySetSystemBackdrop() @@ -169,10 +163,10 @@ private void NavigationView_SelectionChanged(NavigationView sender, NavigationVi { contentFrame.Navigate(typeof(WoL)); } - else if ((string)selectedItem.Tag == "RDP") - { - contentFrame.Navigate(typeof(RDP)); - } + //else if ((string)selectedItem.Tag == "RDP") + //{ + // contentFrame.Navigate(typeof(RDP)); + //} else if ((string)selectedItem.Tag == "Ping") { contentFrame.Navigate(typeof(Ping)); diff --git a/WinWoL/Package.appxmanifest b/WinWoL/Package.appxmanifest index 59a6a8f..32f6b3e 100644 --- a/WinWoL/Package.appxmanifest +++ b/WinWoL/Package.appxmanifest @@ -9,7 +9,7 @@ + Version="1.0.2.0" /> WinWoL diff --git a/WinWoL/SettingsPage.xaml b/WinWoL/SettingsPage.xaml index 71532b1..bbd7814 100644 --- a/WinWoL/SettingsPage.xaml +++ b/WinWoL/SettingsPage.xaml @@ -29,12 +29,18 @@ + + + + + Margin="0,0,0,16"> diff --git a/WinWoL/SettingsPage.xaml.cs b/WinWoL/SettingsPage.xaml.cs index 4f5a0e8..27efa93 100644 --- a/WinWoL/SettingsPage.xaml.cs +++ b/WinWoL/SettingsPage.xaml.cs @@ -76,6 +76,8 @@ public SettingsPage() // �Ƿ����룬�ӳ����� //throw new Exception($"Wrong material type: {localSettings.Values["materialStatus"]}"); } + + DeveloperImpart.IsOn = (localSettings.Values["DeveloperImpartIsOpen"] as string == "True"); } // ������������ComboBox�Ķ��¼� @@ -138,5 +140,16 @@ private void CMDDisplay_SelectionChanged(object sender, SelectionChangedEventArg break; } } + private void DeveloperImpart_Toggled(object sender, RoutedEventArgs e) + { + if (DeveloperImpart.IsOn == true) + { + localSettings.Values["DeveloperImpartIsOpen"] = "True"; + } + else + { + localSettings.Values["DeveloperImpartIsOpen"] = "False"; + } + } } } diff --git a/WinWoL/WinWoL.csproj b/WinWoL/WinWoL.csproj index 76ef58d..9c84877 100644 --- a/WinWoL/WinWoL.csproj +++ b/WinWoL/WinWoL.csproj @@ -41,8 +41,8 @@ - - + + diff --git a/WinWoL/WoL.xaml b/WinWoL/WoL.xaml index 85796c0..f1a4bc1 100644 --- a/WinWoL/WoL.xaml +++ b/WinWoL/WoL.xaml @@ -50,6 +50,8 @@ + + @@ -69,14 +71,13 @@ x:Name="AddConfig" Click="AddConfigButton_Click" Content="添加配置" HorizontalAlignment="Center" VerticalAlignment="Bottom" - Width="84" + Width="130" Margin="0,0,8,0"/> + +