<Window xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:loc="using:NewLife.XCoder.Services"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:NewLife.XCoder.ViewModels"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="700"
x:Class="NewLife.XCoder.Views.IpConfigWindow"
x:DataType="vm:IpConfigViewModel"
Title="{loc:Tr 'IP Settings'}" Width="800" Height="700"
WindowStartupLocation="CenterOwner">
<Window.Styles>
<Style Selector="TextBox.ConfigTextBox">
<Setter Property="Margin" Value="2"/>
<Setter Property="Height" Value="32"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderDefault}"/>
</Style>
<Style Selector="Button.ActionButton">
<Setter Property="Height" Value="32"/>
<Setter Property="Padding" Value="12,0"/>
<Setter Property="Margin" Value="2"/>
</Style>
<Style Selector="Border.GroupBorder">
<Setter Property="Background" Value="{DynamicResource BgSurface2}"/>
<Setter Property="BorderBrush" Value="{DynamicResource BorderDefault}"/>
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="CornerRadius" Value="10"/>
<Setter Property="Padding" Value="8"/>
<Setter Property="Margin" Value="0"/>
</Style>
</Window.Styles>
<Grid Margin="16" RowSpacing="10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<!-- 配置 -->
<Border Grid.Row="0" Classes="GroupBorder">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="80"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{loc:Tr 'Adapter'}" VerticalAlignment="Center" Margin="4,2"/>
<ComboBox Grid.Column="1" ItemsSource="{Binding Adapters}" SelectedItem="{Binding SelectedAdapter}" Margin="2" Height="32"/>
<TextBlock Grid.Column="2" Text="{loc:Tr 'Description'}" VerticalAlignment="Center" Margin="4,2"/>
<TextBox Grid.Column="3" Text="{Binding AdapterDescription}" Classes="ConfigTextBox" IsReadOnly="True"/>
<TextBlock Grid.Row="1" Text="{loc:Tr 'IP address'}" VerticalAlignment="Center" Margin="4,2"/>
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding IpAddress}" Classes="ConfigTextBox"/>
<TextBlock Grid.Row="1" Grid.Column="2" Text="{loc:Tr 'Subnet mask'}" VerticalAlignment="Center" Margin="4,2"/>
<TextBox Grid.Row="1" Grid.Column="3" Text="{Binding SubnetMask}" Classes="ConfigTextBox"/>
<TextBlock Grid.Row="2" Text="{loc:Tr 'Gateway'}" VerticalAlignment="Center" Margin="4,2"/>
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding Gateway}" Classes="ConfigTextBox"/>
<TextBlock Grid.Row="2" Grid.Column="2" Text="DNS" VerticalAlignment="Center" Margin="4,2"/>
<TextBox Grid.Row="2" Grid.Column="3" Text="{Binding Dns}" Classes="ConfigTextBox"/>
<TextBlock Grid.Row="3" Text="{loc:Tr 'Secondary IP'}" VerticalAlignment="Top" Margin="4,2"/>
<TextBox Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="3" Text="{Binding SecondaryIps}" AcceptsReturn="True" MinHeight="60"
FontFamily="{DynamicResource FontMono}" FontSize="12" BorderThickness="1" BorderBrush="{DynamicResource BorderDefault}"/>
<Button Grid.Row="4" Content="{loc:Tr 'Apply'}" Command="{Binding ApplyCommand}" Classes="ActionButton" Width="100" HorizontalAlignment="Left"/>
<Button Grid.Row="4" Grid.Column="1" Content="{loc:Tr 'Restore DHCP'}" Command="{Binding RestoreCommand}" Classes="ActionButton" Width="100"/>
</Grid>
</Border>
<!-- 日志 -->
<TextBox Classes="console" Grid.Row="1" Text="{Binding Log, Converter={x:Static loc:LocalizedTextConverter.Instance}}" AcceptsReturn="True" AcceptsTab="True"
FontFamily="{DynamicResource FontMono}" FontSize="12" Margin="0,4"
BorderThickness="1" BorderBrush="{DynamicResource BorderDefault}"/>
</Grid>
</Window>
|