-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a51fe76
commit d9d84c1
Showing
11 changed files
with
744 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<ContentDialog | ||
x:Class="WinWoL.AddSSHConfigDialog" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> | ||
|
||
<Grid> | ||
<ScrollViewer Width="280"> | ||
<StackPanel Width="250" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center"> | ||
<TextBox x:Name="SSHConfigName" TextChanged="TextChanged" Header="配置别名:" PlaceholderText="" Width="250" Margin="0,0,0,8"/> | ||
<TextBox x:Name="SSHCommand" TextChanged="TextChanged" Header="SSH 命令:" PlaceholderText="" Width="250" Margin="0,0,0,8"/> | ||
<TextBox x:Name="SSHHost" TextChanged="TextChanged" Header="SSH 主机:" PlaceholderText="" Width="250" Margin="0,0,0,8"/> | ||
<TextBox x:Name="SSHPort" TextChanged="TextChanged" Header="SSH 端口:" PlaceholderText="" Width="250" Margin="0,0,0,8"/> | ||
<TextBox x:Name="SSHUser" TextChanged="TextChanged" Header="SSH 用户:" PlaceholderText="" Width="250" Margin="0,0,0,8"/> | ||
<TextBox x:Name="SSHPasswd" TextChanged="TextChanged" Header="SSH 密码:" PlaceholderText="" Width="250" Margin="0,0,0,8"/> | ||
</StackPanel> | ||
</ScrollViewer> | ||
</Grid> | ||
</ContentDialog> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
using Microsoft.UI.Xaml; | ||
using Microsoft.UI.Xaml.Controls; | ||
using Microsoft.UI.Xaml.Controls.Primitives; | ||
using Microsoft.UI.Xaml.Data; | ||
using Microsoft.UI.Xaml.Input; | ||
using Microsoft.UI.Xaml.Media; | ||
using Microsoft.UI.Xaml.Navigation; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Net; | ||
using System.Runtime.InteropServices.WindowsRuntime; | ||
using System.Text.RegularExpressions; | ||
using Validation; | ||
using Windows.Foundation; | ||
using Windows.Foundation.Collections; | ||
using Windows.Services.Maps; | ||
using Windows.Storage; | ||
using static System.Net.Mime.MediaTypeNames; | ||
|
||
namespace WinWoL | ||
{ | ||
public sealed partial class AddSSHConfigDialog : ContentDialog | ||
{ | ||
ApplicationDataContainer localSettings = ApplicationData.Current.LocalSettings; | ||
public AddSSHConfigDialog() | ||
{ | ||
this.InitializeComponent(); | ||
|
||
string configInner = localSettings.Values["SSHConfigIDTemp"] as string; | ||
if (configInner != null) | ||
{ | ||
string[] configInnerSplit = configInner.Split(','); | ||
SSHConfigName.Text = configInnerSplit[0]; | ||
SSHCommand.Text = configInnerSplit[1]; | ||
SSHHost.Text = configInnerSplit[2]; | ||
SSHPort.Text = configInnerSplit[3]; | ||
SSHUser.Text = configInnerSplit[4]; | ||
SSHPasswd.Text = configInnerSplit[5]; | ||
} | ||
} | ||
private void InnerChanged() | ||
{ | ||
localSettings.Values["SSHConfigIDTemp"] = | ||
SSHConfigName.Text + "," + SSHCommand.Text + "," | ||
+ SSHHost.Text + "," + SSHPort.Text + "," | ||
+ SSHUser.Text + "," + SSHPasswd.Text; | ||
|
||
//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) | ||
{ | ||
// ÄÚÈݱä¸ü | ||
InnerChanged(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,168 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Page | ||
x:Class="WinWoL.SSHWoL" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:WinWoL" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
mc:Ignorable="d" | ||
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> | ||
|
||
<Grid> | ||
<StackPanel Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center"> | ||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center"> | ||
<StackPanel Width="268" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center"> | ||
|
||
<TextBlock x:Name="Header" FontSize="24" Text="SSH 脚本" HorizontalAlignment="Center" /> | ||
|
||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" | ||
VerticalAlignment="Center" Margin="0,8,0,0"> | ||
<ComboBox x:Name="configNum" | ||
ItemsSource="{x:Bind ConfigSelector}" | ||
SelectionChanged="configNum_SelectionChanged" | ||
Header="配置编号:" | ||
Width="268"> | ||
</ComboBox> | ||
</StackPanel> | ||
|
||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" | ||
VerticalAlignment="Center" Margin="0,8,0,0"> | ||
<Button | ||
x:Name="HidePasswd" | ||
Click="HidePasswd_Click" | ||
Content="隐藏密码" | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Bottom" | ||
Width="84" | ||
Margin="0,0,8,0" | ||
/> | ||
<Button | ||
x:Name="ImportConfig" | ||
Click="ImportConfig_Click" | ||
Content="导入配置" | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Bottom" | ||
Width="84" | ||
Margin="0,0,8,0" | ||
/> | ||
<Button | ||
x:Name="ImportAndReplaceConfig" | ||
Content="覆盖配置" | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Bottom" | ||
Width="84" | ||
Margin="0,0,8,0" | ||
> | ||
<Button.Flyout> | ||
<Flyout> | ||
<StackPanel> | ||
<TextBlock | ||
Style="{ThemeResource BaseTextBlockStyle}" | ||
Text="您确定要覆盖此配置文件吗?" | ||
Margin="0,0,0,12" /> | ||
<Button | ||
Click="ImportConfig_Click" | ||
Content="确定" /> | ||
</StackPanel> | ||
</Flyout> | ||
</Button.Flyout> | ||
</Button> | ||
<Button | ||
x:Name="ExportConfig" | ||
Click="ExportConfig_Click" | ||
Content="导出配置" | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Bottom" | ||
Width="84" | ||
/> | ||
</StackPanel> | ||
|
||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,8,0,0"> | ||
<StackPanel Width="268" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center"> | ||
<TextBlock x:Name="SSHConfigName"/> | ||
<TextBlock x:Name="SSHCommand"/> | ||
<TextBlock x:Name="SSHHost"/> | ||
<TextBlock x:Name="SSHPort"/> | ||
<TextBlock x:Name="SSHUser"/> | ||
<TextBlock x:Name="SSHPasswd"/> | ||
<TextBlock x:Name="SSHPing"/> | ||
</StackPanel> | ||
</StackPanel> | ||
|
||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,8,0,0"> | ||
<Button | ||
x:Name="AddConfig" Click="AddConfigButton_Click" | ||
Content="添加配置" | ||
HorizontalAlignment="Center" VerticalAlignment="Bottom" | ||
Width="84" | ||
Margin="0,0,8,0"/> | ||
<Button | ||
x:Name="DelConfig" | ||
Content="删除配置" | ||
HorizontalAlignment="Center" VerticalAlignment="Bottom" | ||
Width="84" | ||
Margin="0,0,8,0"> | ||
<Button.Flyout> | ||
<Flyout> | ||
<StackPanel> | ||
<TextBlock | ||
Style="{ThemeResource BaseTextBlockStyle}" | ||
Text="您确定要删除此配置文件吗?" | ||
Margin="0,0,0,12" /> | ||
<Button | ||
Click="DelConfigButton_Click" | ||
Content="确定" /> | ||
</StackPanel> | ||
</Flyout> | ||
</Button.Flyout> | ||
</Button> | ||
<Button | ||
x:Name="RefConfig" Click="RefConfigButton_Click" | ||
Content="Ping" | ||
HorizontalAlignment="Center" VerticalAlignment="Bottom" | ||
Width="84" /> | ||
</StackPanel> | ||
|
||
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center" Margin="0,8,0,0"> | ||
<Button | ||
x:Name="RunSSH" | ||
Click="RunSSHButton_Click" | ||
Content="执行脚本" | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Bottom" | ||
Width="268" | ||
Margin="0,0,0,0" | ||
/> | ||
</StackPanel> | ||
|
||
</StackPanel> | ||
</StackPanel> | ||
</StackPanel> | ||
|
||
<TeachingTip x:Name="SSHResponse" | ||
Title="SSH 输出" | ||
Subtitle="" | ||
PreferredPlacement="Auto" | ||
PlacementMargin="20" | ||
IsLightDismissEnabled="True" | ||
CloseButtonContent="明白!"> | ||
</TeachingTip> | ||
<TeachingTip x:Name="SaveConfigTips" | ||
Title="" | ||
Subtitle="" | ||
PreferredPlacement="Auto" | ||
PlacementMargin="20" | ||
IsLightDismissEnabled="True" | ||
CloseButtonContent="确认"> | ||
</TeachingTip> | ||
<TeachingTip x:Name="SSHCommandNotSendTips" | ||
Title="SSH 链接失败" | ||
Subtitle="请检查您填写的配置以及网络状况" | ||
PreferredPlacement="Auto" | ||
PlacementMargin="20" | ||
IsLightDismissEnabled="True" | ||
CloseButtonContent="确认"> | ||
</TeachingTip> | ||
</Grid> | ||
</Page> |
Oops, something went wrong.