|
| 1 | +<Window |
| 2 | + x:Class="SetIP.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
| 3 | + xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" Title="网络设置" |
| 4 | + Width="550" Height="560" FontSize="13" |
| 5 | + Background="#f6f6f6" Loaded="MainWindow_OnLoaded" ResizeMode="CanMinimize" |
| 6 | + WindowStartupLocation="CenterScreen" WindowStyle="ToolWindow" mc:Ignorable="d"> |
| 7 | + <Grid Margin="10"> |
| 8 | + <Grid.RowDefinitions> |
| 9 | + <RowDefinition Height="Auto" /> |
| 10 | + <RowDefinition Height="*" /> |
| 11 | + <RowDefinition Height="Auto" /> |
| 12 | + </Grid.RowDefinitions> |
| 13 | + <Button |
| 14 | + Name="BtnOpenNetworkConnections" Height="35" Margin="5" Padding="10,5" |
| 15 | + HorizontalAlignment="Left" VerticalAlignment="Center" Click="BtnOpenNetworkConnections_OnClick"> |
| 16 | + 打开系统网络连接设置 |
| 17 | + </Button> |
| 18 | + <ListBox |
| 19 | + Name="LbNic" Grid.Row="1" MaxHeight="180" Margin="5" |
| 20 | + SelectionChanged="LbNic_OnSelectionChanged" /> |
| 21 | + <Grid Grid.Row="2"> |
| 22 | + <Grid.Resources> |
| 23 | + <Style TargetType="Border"> |
| 24 | + <Setter Property="Padding" Value="5" /> |
| 25 | + </Style> |
| 26 | + </Grid.Resources> |
| 27 | + <Grid.RowDefinitions> |
| 28 | + <RowDefinition Height="Auto" /> |
| 29 | + <RowDefinition Height="Auto" /> |
| 30 | + <RowDefinition Height="Auto" /> |
| 31 | + <RowDefinition Height="Auto" /> |
| 32 | + <RowDefinition Height="Auto" /> |
| 33 | + <RowDefinition /> |
| 34 | + </Grid.RowDefinitions> |
| 35 | + <Grid.ColumnDefinitions> |
| 36 | + <ColumnDefinition Width="0.5*" /> |
| 37 | + <ColumnDefinition Width="0.6*" /> |
| 38 | + <ColumnDefinition Width="*" /> |
| 39 | + </Grid.ColumnDefinitions> |
| 40 | + <Border Grid.Row="0" Grid.Column="0"> |
| 41 | + <Label Content="IP 地址(*):" /> |
| 42 | + </Border> |
| 43 | + <Border Grid.Row="1" Grid.Column="0"> |
| 44 | + <Label Content="子网掩码(*):" /> |
| 45 | + </Border> |
| 46 | + <Border Grid.Row="2" Grid.Column="0"> |
| 47 | + <Label Content="默认网关:" /> |
| 48 | + </Border> |
| 49 | + <Border Grid.Row="3" Grid.Column="0"> |
| 50 | + <Label Content="首选 DNS:" /> |
| 51 | + </Border> |
| 52 | + <Border Grid.Row="4" Grid.Column="0"> |
| 53 | + <Label Content="备用 DNS:" /> |
| 54 | + </Border> |
| 55 | + <Border Grid.Row="0" Grid.Column="1"> |
| 56 | + <TextBox Name="TxtIp" /> |
| 57 | + </Border> |
| 58 | + |
| 59 | + <Border Grid.Row="1" Grid.Column="1"> |
| 60 | + <TextBox Name="TxtSubMask" /> |
| 61 | + </Border> |
| 62 | + <Border Grid.Row="2" Grid.Column="1"> |
| 63 | + <TextBox Name="TxtGateway" /> |
| 64 | + </Border> |
| 65 | + <Border Grid.Row="3" Grid.Column="1"> |
| 66 | + <TextBox Name="TxtPrimaryDns" /> |
| 67 | + </Border> |
| 68 | + <Border Grid.Row="4" Grid.Column="1"> |
| 69 | + <TextBox Name="TxtBackupDns" /> |
| 70 | + </Border> |
| 71 | + <Border Grid.Row="0" Grid.Column="2"> |
| 72 | + <Label Name="LblIpResult" /> |
| 73 | + </Border> |
| 74 | + <Border Grid.Row="1" Grid.Column="2"> |
| 75 | + <Label Name="LblSubMaskResult" /> |
| 76 | + </Border> |
| 77 | + <Border Grid.Row="2" Grid.Column="2"> |
| 78 | + <Label Name="LblGatewayResult" /> |
| 79 | + </Border> |
| 80 | + <Border Grid.Row="3" Grid.Column="2"> |
| 81 | + <Label Name="LblDns1Result" /> |
| 82 | + </Border> |
| 83 | + <Border Grid.Row="4" Grid.Column="2"> |
| 84 | + <Label Name="LblDns2Result" /> |
| 85 | + </Border> |
| 86 | + <Border |
| 87 | + Grid.Row="5" Grid.Column="0" Grid.ColumnSpan="3"> |
| 88 | + <Grid> |
| 89 | + <Grid.ColumnDefinitions> |
| 90 | + <ColumnDefinition Width="20"/> |
| 91 | + <ColumnDefinition Width="220"/> |
| 92 | + <ColumnDefinition Width="1.5*"/> |
| 93 | + <ColumnDefinition Width="*"/> |
| 94 | + </Grid.ColumnDefinitions> |
| 95 | + |
| 96 | + <StackPanel Grid.Column="1" Orientation="Horizontal" Name="SpNewIp"> |
| 97 | + <Button Name="BtnReplaceIp" Click="BtnReplaceIp_OnClick" MinWidth="100" > |
| 98 | + IP 地址 填入</Button> |
| 99 | + <Label VerticalContentAlignment="Center" |
| 100 | + HorizontalAlignment="Center" Name="LblNewIp" |
| 101 | + Background="AntiqueWhite" |
| 102 | + Content="192.168.61.180" Margin="5,0"/> |
| 103 | + </StackPanel> |
| 104 | + <Button Grid.Column="2" |
| 105 | + Name="BtnSetToOld" Height="35" MinWidth="130" HorizontalAlignment="Center" |
| 106 | + Click="BtnSetToOld_OnClick" Content="还原到之前的IP" /> |
| 107 | + |
| 108 | + <Button Grid.Column="3" Foreground="Red" |
| 109 | + Name="BtnSet" Height="35" Width="65" HorizontalAlignment="Center" |
| 110 | + Click="BtnSet_OnClick" Content="执行" /> |
| 111 | + </Grid> |
| 112 | + </Border> |
| 113 | + </Grid> |
| 114 | + </Grid> |
| 115 | +</Window> |
0 commit comments