1
0
mirror of https://github.com/proxysu/ProxySU.git synced 2024-11-22 13:16:09 +03:00

学习使用状态栏

This commit is contained in:
ProxySU 2020-03-09 16:02:23 +08:00
parent 2e5a95c10a
commit cb2adddafe
2 changed files with 26 additions and 25 deletions

View File

@ -5,7 +5,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ProxySU" xmlns:local="clr-namespace:ProxySU"
mc:Ignorable="d" mc:Ignorable="d"
Title="ProxySU" Height="450" Width="600"> Title="ProxySU" Height="550" Width="600">
<Grid> <Grid>
<Grid> <Grid>
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
@ -22,9 +22,9 @@
<RowDefinition Height="30"></RowDefinition> <RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition> <RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition> <RowDefinition Height="30"></RowDefinition>
<RowDefinition Height="30"></RowDefinition> <RowDefinition Height="60"></RowDefinition>
<RowDefinition Height="30"></RowDefinition>
<RowDefinition ></RowDefinition> <RowDefinition ></RowDefinition>
<RowDefinition Height="60"></RowDefinition>
</Grid.RowDefinitions> </Grid.RowDefinitions>
<TextBlock Text="主机名" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5" Grid.Column="0" Grid.Row="0"></TextBlock> <TextBlock Text="主机名" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5" Grid.Column="0" Grid.Row="0"></TextBlock>
<TextBlock Text="端口" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5" Grid.Column="2" Grid.Row="0"></TextBlock> <TextBlock Text="端口" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="5" Grid.Column="2" Grid.Row="0"></TextBlock>
@ -55,13 +55,14 @@
<TextBox x:Name="TextBoxProxyUserName" IsEnabled="False" Text="" Margin="5" Grid.Column="1" Grid.Row="6"></TextBox> <TextBox x:Name="TextBoxProxyUserName" IsEnabled="False" Text="" Margin="5" Grid.Column="1" Grid.Row="6"></TextBox>
<PasswordBox x:Name="PasswordBoxProxyPassword" IsEnabled="False" Password="" Margin="5" Grid.Column="3" Grid.Row="6"></PasswordBox> <PasswordBox x:Name="PasswordBoxProxyPassword" IsEnabled="False" Password="" Margin="5" Grid.Column="3" Grid.Row="6"></PasswordBox>
<TextBlock x:Name="TextBlockSetUpProcessing" Text="等待安装布署" Grid.Column="1" Grid.Row="7" Grid.ColumnSpan="3"></TextBlock> <StatusBar x:Name="StatusBarStatusMonitoring" Grid.Column="0" Grid.Row="7" Grid.ColumnSpan="4"></StatusBar>
<ProgressBar x:Name="ProgressBarSetUpProcessing" Minimum="0" Maximum="100" Value="0" IsIndeterminate="False" Margin="7" Grid.Column="0" Grid.Row="8" Grid.ColumnSpan="4"></ProgressBar> <!--<TextBlock x:Name="TextBlockSetUpProcessing" Text="等待安装布署" Grid.Column="1" Grid.Row="7" Grid.ColumnSpan="3"></TextBlock>
<ProgressBar x:Name="ProgressBarSetUpProcessing" Minimum="0" Maximum="100" Value="0" IsIndeterminate="False" Margin="7" Grid.Column="0" Grid.Row="8" Grid.ColumnSpan="4"></ProgressBar>-->
<!--<TextBlock Text="代理类型:" Grid.Column="2" Grid.Row="3"></TextBlock> <!--<TextBlock Text="代理类型:" Grid.Column="2" Grid.Row="3"></TextBlock>
<ComboBox x:Name="proxyType" Grid.Column="3" Grid.Row="3" Margin="5"></ComboBox>--> <ComboBox x:Name="proxyType" Grid.Column="3" Grid.Row="3" Margin="5"></ComboBox>-->
<Button x:Name="Button_Login" Content="布署安装" Grid.ColumnSpan="2" Margin="20" Grid.Column="0" Grid.Row="9" Click="Button_Login_Click"></Button> <Button x:Name="Button_Login" Content="布署安装" Grid.ColumnSpan="2" Margin="10" Grid.Column="0" Grid.Row="9" Click="Button_Login_Click"></Button>
<Button x:Name="Button_canel" Content="取消" Grid.ColumnSpan="2" Margin="20" Grid.Column="2" Grid.Row="9" Click="Button_canel_Click"></Button> <Button x:Name="Button_canel" Content="取消" Grid.ColumnSpan="2" Margin="10" Grid.Column="2" Grid.Row="9" Click="Button_canel_Click"></Button>
</Grid> </Grid>
</Grid> </Grid>
</Window> </Window>

View File

@ -96,8 +96,8 @@ namespace ProxySU
string sshProxyUser = TextBoxProxyUserName.Text.ToString(); string sshProxyUser = TextBoxProxyUserName.Text.ToString();
string sshProxyPassword = PasswordBoxProxyPassword.Password.ToString(); string sshProxyPassword = PasswordBoxProxyPassword.Password.ToString();
TextBlockSetUpProcessing.Text = "登录中"; //TextBlockSetUpProcessing.Text = "登录中";
ProgressBarSetUpProcessing.IsIndeterminate = true; //ProgressBarSetUpProcessing.IsIndeterminate = true;
try try
@ -161,18 +161,18 @@ namespace ProxySU
#endregion #endregion
client.Connect(); client.Connect();
if (client.IsConnected == true) //if (client.IsConnected == true)
{ //{
TextBlockSetUpProcessing.Text = "主机已登录"; // TextBlockSetUpProcessing.Text = "主机已登录";
ProgressBarSetUpProcessing.IsIndeterminate = false; // ProgressBarSetUpProcessing.IsIndeterminate = false;
ProgressBarSetUpProcessing.Value = 100; // ProgressBarSetUpProcessing.Value = 100;
} //}
else //else
{ //{
TextBlockSetUpProcessing.Text = "主机登录失败"; // TextBlockSetUpProcessing.Text = "主机登录失败";
ProgressBarSetUpProcessing.IsIndeterminate = false; // ProgressBarSetUpProcessing.IsIndeterminate = false;
ProgressBarSetUpProcessing.Value = 0; // ProgressBarSetUpProcessing.Value = 0;
} //}
client.RunCommand("echo 1111 >> test.json"); client.RunCommand("echo 1111 >> test.json");
MessageBox.Show(client.ConnectionInfo.ServerVersion.ToString()); MessageBox.Show(client.ConnectionInfo.ServerVersion.ToString());
//MessageBox.Show(client); //MessageBox.Show(client);
@ -209,9 +209,9 @@ namespace ProxySU
{ {
MessageBox.Show("未知错误"); MessageBox.Show("未知错误");
} }
TextBlockSetUpProcessing.Text = "主机登录失败"; //TextBlockSetUpProcessing.Text = "主机登录失败";
ProgressBarSetUpProcessing.IsIndeterminate = false; //ProgressBarSetUpProcessing.IsIndeterminate = false;
ProgressBarSetUpProcessing.Value = 0; //ProgressBarSetUpProcessing.Value = 0;
} }
} }