mirror of
https://github.com/proxysu/ProxySU.git
synced 2024-11-22 05:06:08 +03:00
学习两个窗口间传递值
This commit is contained in:
parent
c81e3d577f
commit
c6f91bee1c
@ -98,7 +98,11 @@
|
||||
<Button x:Name="ButtonSetConfiguration" Margin="6" Content="配置" Grid.Column="2" Grid.Row="2" Click="ButtonSetConfiguration_Click"></Button>-->
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="BBR设置" Width="150" Height="30"></TabItem>
|
||||
<TabItem Header="BBR设置" Width="150" Height="30">
|
||||
<Grid>
|
||||
<Button Content="测试接收到的模参数" Margin="50" Click="Button_Click"></Button>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
|
||||
|
||||
|
@ -24,14 +24,14 @@ namespace ProxySU
|
||||
/// </summary>
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public static string[] ReceiveConfigurationParameters { get; set; }
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
RadioButtonPasswordLogin.IsChecked = true;
|
||||
RadioButtonNoProxy.IsChecked = true;
|
||||
RadioButtonProxyNoLogin.IsChecked = true;
|
||||
//GuideConfiguration.IsChecked = true;
|
||||
//RadioButtonTemplateConfiguration.IsChecked = true;
|
||||
ReceiveConfigurationParameters = new string[5];
|
||||
}
|
||||
//System.Diagnostics.Process exitProgram = System.Diagnostics.Process.GetProcessById(System.Diagnostics.Process.GetCurrentProcess().Id);
|
||||
private void Button_Login_Click(object sender, RoutedEventArgs e)
|
||||
@ -591,6 +591,14 @@ namespace ProxySU
|
||||
|
||||
windowTemplateConfiguration.ShowDialog();
|
||||
}
|
||||
//测试接收到的模板参数
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
foreach (string num in ReceiveConfigurationParameters)
|
||||
{
|
||||
MessageBox.Show(num);
|
||||
}
|
||||
}
|
||||
|
||||
//private void ButtonSetConfiguration_Click(object sender, RoutedEventArgs e)
|
||||
//{
|
||||
|
@ -37,7 +37,7 @@
|
||||
</Grid.RowDefinitions>
|
||||
<RadioButton x:Name="RadioButtonTCP" Content="TCP" Grid.Column="0" Grid.Row="0" Checked="RadioButtonTCP_Checked"></RadioButton>
|
||||
<TextBlock Text="TCP说明" Grid.Column="1" Grid.Row="0" Grid.ColumnSpan="2"></TextBlock>
|
||||
<RadioButton x:Name="RadioButtonTCPhttp" Content="TCP+Http伪装" Grid.Column="0" Grid.Row="1" Checked="RadioButtonTCP_Checked"></RadioButton>
|
||||
<RadioButton x:Name="RadioButtonTCPhttp" Content="TCP+Http伪装" Grid.Column="0" Grid.Row="1" Checked="RadioButtonTCPhttp_Checked" ></RadioButton>
|
||||
<TextBlock Text="TCP+Http伪装说明" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="2"></TextBlock>
|
||||
<RadioButton x:Name="RadioButtonMkcpNoCamouflage" Content="mKCP(无伪装)" Grid.Column="0" Grid.Row="2" Checked="RadioButtonTCP_Checked"></RadioButton>
|
||||
<TextBlock Text="mkcp协议,不进行伪装,发送的数据是没有特征的数据包。" Grid.Column="1" Grid.Row="2" Grid.ColumnSpan="2"></TextBlock>
|
||||
@ -79,7 +79,7 @@
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock x:Name="TextBlockServerListenPort" Text="服务端口:" Grid.Column="0" Grid.Row="0"></TextBlock>
|
||||
<TextBox x:Name="TextBoxServerListenPort" Grid.Column="1" Grid.Row="0" Grid.ColumnSpan="2" Margin="5"></TextBox>
|
||||
<Button x:Name="ButtonServerListenPort" Content="随机选择" Grid.Column="3" Grid.Row="0" Margin="5"></Button>
|
||||
<Button x:Name="ButtonServerListenPort" Content="随机选择" Grid.Column="3" Grid.Row="0" Margin="5" Click="ButtonServerListenPort_Click"></Button>
|
||||
<TextBlock x:Name="TextBlockNewUUID" Text="新建UUID:" Grid.Column="0" Grid.Row="1"></TextBlock>
|
||||
<TextBox x:Name="TextBoxNewUUID" Grid.Column="1" Grid.Row="1" Grid.ColumnSpan="2" Margin="5"></TextBox>
|
||||
<Button x:Name="ButtonNewUUID" Content="更新" Grid.Column="3" Grid.Row="1" Margin="5" Click="ButtonNewUUID_Click"></Button>
|
||||
@ -88,7 +88,7 @@
|
||||
<Button x:Name="ButtonExistingUUID" Content="粘贴到框中" Grid.Column="3" Grid.Row="2" Margin="5"></Button>
|
||||
<TextBlock x:Name="TextBlockPath" Text="路径:" Grid.Column="0" Grid.Row="3"></TextBlock>
|
||||
<TextBox x:Name="TextBoxPath" Grid.Column="1" Grid.Row="3" Grid.ColumnSpan="2" Margin="5"></TextBox>
|
||||
<Button x:Name="ButtonPath" Content="随机" Grid.Column="3" Grid.Row="3" Margin="5"></Button>
|
||||
<Button x:Name="ButtonPath" Content="随机" Grid.Column="3" Grid.Row="3" Margin="5" Click="ButtonPath_Click"></Button>
|
||||
<TextBlock x:Name="TextBlockDomain" Text="域名:" Grid.Column="0" Grid.Row="4"></TextBlock>
|
||||
<TextBox x:Name="TextBoxDomain" Grid.Column="1" Grid.Row="4" Grid.ColumnSpan="2" Margin="5"></TextBox>
|
||||
<Button x:Name="ButtonDomain" Content="检测" Grid.Column="3" Grid.Row="4" Margin="5"></Button>
|
||||
|
@ -14,7 +14,7 @@ using System.Windows.Shapes;
|
||||
namespace ProxySU
|
||||
{
|
||||
/// <summary>
|
||||
/// Window1.xaml 的交互逻辑
|
||||
/// WindowTemplateConfiguration.xaml 的交互逻辑
|
||||
/// </summary>
|
||||
public partial class WindowTemplateConfiguration : Window
|
||||
{
|
||||
@ -29,56 +29,79 @@ namespace ProxySU
|
||||
|
||||
if (RadioButtonTCP.IsChecked == true)
|
||||
{
|
||||
//传递模板类型
|
||||
MainWindow.ReceiveConfigurationParameters[0] = "TCP";
|
||||
|
||||
}
|
||||
else if (RadioButtonWebSocketTLS2Web.IsChecked == true)
|
||||
{
|
||||
//传递模板类型
|
||||
MainWindow.ReceiveConfigurationParameters[0] = "WebSocketTLS2Web";
|
||||
|
||||
}
|
||||
else if (RadioButtonTCPhttp.IsChecked == true)
|
||||
{
|
||||
|
||||
//传递模板类型
|
||||
MainWindow.ReceiveConfigurationParameters[0] = "TCPhttp";
|
||||
}
|
||||
else if (RadioButtonMkcpNoCamouflage.IsChecked == true)
|
||||
{
|
||||
|
||||
//传递模板类型
|
||||
MainWindow.ReceiveConfigurationParameters[0] = "MkcpNoCamouflage";
|
||||
}
|
||||
else if (RadioButton2mKCP2SRTP.IsChecked == true)
|
||||
{
|
||||
|
||||
//传递模板类型
|
||||
MainWindow.ReceiveConfigurationParameters[0] = "mKCP2SRTP";
|
||||
}
|
||||
else if (RadioButton2mKCPuTP.IsChecked == true)
|
||||
{
|
||||
|
||||
//传递模板类型
|
||||
MainWindow.ReceiveConfigurationParameters[0] = "mKCPuTP";
|
||||
}
|
||||
else if (RadioButton2mKCP2WechatVideo.IsChecked == true)
|
||||
{
|
||||
|
||||
//传递模板类型
|
||||
MainWindow.ReceiveConfigurationParameters[0] = "mKCP2WechatVideo";
|
||||
}
|
||||
else if (RadioButton2mKCP2DTLS.IsChecked == true)
|
||||
{
|
||||
|
||||
//传递模板类型
|
||||
MainWindow.ReceiveConfigurationParameters[0] = "mKCP2DTLS";
|
||||
}
|
||||
else if (RadioButton2mKCP2WireGuard.IsChecked == true)
|
||||
{
|
||||
|
||||
//传递模板类型
|
||||
MainWindow.ReceiveConfigurationParameters[0] = "mKCP2WireGuard";
|
||||
}
|
||||
else if (RadioButtonHTTP2.IsChecked == true)
|
||||
{
|
||||
|
||||
//传递模板类型
|
||||
MainWindow.ReceiveConfigurationParameters[0] = "HTTP2";
|
||||
}
|
||||
else if (RadioButtonTLS.IsChecked == true)
|
||||
{
|
||||
|
||||
//传递模板类型
|
||||
MainWindow.ReceiveConfigurationParameters[0] = "TLS";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
//传递模板类型
|
||||
MainWindow.ReceiveConfigurationParameters[0] = "TCP";
|
||||
}
|
||||
//传递服务端口
|
||||
MainWindow.ReceiveConfigurationParameters[1] = TextBoxServerListenPort.Text.ToString();
|
||||
//传递uuid
|
||||
MainWindow.ReceiveConfigurationParameters[2] = TextBoxNewUUID.Text.ToString();
|
||||
//传递路径
|
||||
MainWindow.ReceiveConfigurationParameters[3] = TextBoxPath.Text.ToString();
|
||||
//传递域名
|
||||
MainWindow.ReceiveConfigurationParameters[4] = TextBoxDomain.Text.ToString();
|
||||
this.Close();
|
||||
}
|
||||
|
||||
private void ButtondCancel_Click(object sender, RoutedEventArgs e) => Close();
|
||||
|
||||
#region 其他设置中的界面控制
|
||||
private void RadioButtonTCP_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
TextBlockServerListenPort.Visibility = Visibility.Visible;
|
||||
@ -92,6 +115,9 @@ namespace ProxySU
|
||||
ButtonDomain.Visibility = Visibility.Collapsed;
|
||||
Guid uuid = Guid.NewGuid();
|
||||
TextBoxNewUUID.Text = uuid.ToString();
|
||||
Random random = new Random();
|
||||
int randomServerPort = random.Next(10000, 50000);
|
||||
TextBoxServerListenPort.Text = randomServerPort.ToString();
|
||||
}
|
||||
|
||||
private void RadioButtonHTTP2_Checked(object sender, RoutedEventArgs e)
|
||||
@ -102,6 +128,7 @@ namespace ProxySU
|
||||
ButtonServerListenPort.Visibility = Visibility.Visible;
|
||||
TextBlockPath.Visibility = Visibility.Visible;
|
||||
TextBoxPath.Visibility = Visibility.Visible;
|
||||
TextBoxPath.Text = "/ray";
|
||||
ButtonPath.Visibility = Visibility.Visible;
|
||||
TextBlockDomain.Visibility = Visibility.Visible;
|
||||
TextBoxDomain.Visibility = Visibility.Visible;
|
||||
@ -109,11 +136,45 @@ namespace ProxySU
|
||||
Guid uuid = Guid.NewGuid();
|
||||
TextBoxNewUUID.Text = uuid.ToString();
|
||||
}
|
||||
|
||||
private void RadioButtonTCPhttp_Checked(object sender, RoutedEventArgs e)
|
||||
{
|
||||
TextBlockServerListenPort.Visibility = Visibility.Visible;
|
||||
TextBoxServerListenPort.Visibility = Visibility.Visible;
|
||||
ButtonServerListenPort.Visibility = Visibility.Visible;
|
||||
TextBoxServerListenPort.Text = "80";
|
||||
TextBlockPath.Visibility = Visibility.Collapsed;
|
||||
TextBoxPath.Visibility = Visibility.Collapsed;
|
||||
ButtonPath.Visibility = Visibility.Collapsed;
|
||||
TextBlockDomain.Visibility = Visibility.Collapsed;
|
||||
TextBoxDomain.Visibility = Visibility.Collapsed;
|
||||
ButtonDomain.Visibility = Visibility.Collapsed;
|
||||
Guid uuid = Guid.NewGuid();
|
||||
TextBoxNewUUID.Text = uuid.ToString();
|
||||
}
|
||||
#endregion
|
||||
//产生随机的uuid
|
||||
private void ButtonNewUUID_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Guid uuid = Guid.NewGuid();
|
||||
TextBoxNewUUID.Text = uuid.ToString();
|
||||
}
|
||||
//产生随机服务端口
|
||||
private void ButtonServerListenPort_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Random random = new Random();
|
||||
int randomServerPort = random.Next(10000, 50000);
|
||||
TextBoxServerListenPort.Text = randomServerPort.ToString();
|
||||
}
|
||||
//产生随机的Path
|
||||
private void ButtonPath_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
Random random = new Random();
|
||||
int randomSerialNum = random.Next(0, 4);
|
||||
Guid uuid = Guid.NewGuid();
|
||||
string[] pathArray = uuid.ToString().Split('-');
|
||||
string path = pathArray[randomSerialNum];
|
||||
TextBoxPath.Text = $"/{path}";
|
||||
//MessageBox.Show(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user