借助网络配置,控制Modbus工具的日志显示,避免卡死界面
智能大石头 authored at 2021-12-11 22:09:19
4.70 KiB
XCoder
<UserControl xmlns="https://github.com/avaloniaui"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:loc="using:NewLife.XCoder.Services"
             x:Class="NewLife.XCoder.Tools.Platform.PlatformToolView">
    <ScrollViewer Name="PageScroll" Margin="20"
                  HorizontalScrollBarVisibility="Disabled"
                  VerticalScrollBarVisibility="Auto">
        <Grid Name="PageRoot" RowDefinitions="Auto,Auto,*,Auto" RowSpacing="12"
              MinHeight="{Binding #PageScroll.Viewport.Height}">
            <StackPanel Spacing="2">
                <TextBlock Text="{loc:Tr 'Platform Diagnostics'}" Classes="sectionTitle" />
                <TextBlock Text="{loc:Tr 'View platform capabilities, enumerate USB/audio/NIC devices and generate copyable NIC configuration commands.'}"
                           Classes="dim" TextWrapping="Wrap" />
            </StackPanel>

            <Border Grid.Row="1" Classes="panel" Padding="16">
                <StackPanel Spacing="10">
                    <TextBlock Name="PlatformText" Classes="cardTitle" Text="" />
                    <TextBlock Name="SerialText" Classes="dim" TextWrapping="Wrap" Text="" />
                    <TextBox Name="CapabilityBox" AcceptsReturn="True" MinHeight="110" IsReadOnly="True"
                             FontFamily="{DynamicResource FontMono}" TextWrapping="Wrap" />
                </StackPanel>
            </Border>

            <Border Grid.Row="2" Classes="panel" Padding="16" MinHeight="200">
                <Grid RowDefinitions="Auto,Auto,*" RowSpacing="10">
                    <TextBlock Text="{loc:Tr 'Device enumeration'}" Classes="cardTitle" />
                    <StackPanel Grid.Row="1" Orientation="Horizontal" Spacing="8">
                        <Button Name="UsbButton" Classes="secondary" Content="{loc:Tr 'Enumerate USB'}" />
                        <Button Name="AudioButton" Classes="secondary" Content="{loc:Tr 'Enumerate audio devices'}" />
                        <Button Name="AdapterButton" Classes="secondary" Content="{loc:Tr 'Enumerate NICs'}" />
                        <TextBlock Name="ListStatus" Classes="dim" VerticalAlignment="Center" Text="{loc:Tr 'Not enumerated'}" />
                    </StackPanel>
                    <TextBox Grid.Row="2" Name="DeviceBox" AcceptsReturn="True" MinHeight="140" IsReadOnly="True"
                             FontFamily="{DynamicResource FontMono}" TextWrapping="NoWrap" />
                </Grid>
            </Border>

            <Border Grid.Row="3" Classes="panel" Padding="16">
                <StackPanel Spacing="10">
                    <TextBlock Text="{loc:Tr 'NIC address configuration (generate commands first, then execute after confirmation)'}" Classes="cardTitle" />
                    <WrapPanel>
                        <TextBlock Text="{loc:Tr 'NIC'}" Classes="dim" VerticalAlignment="Center" Margin="0,0,6,6" />
                        <ComboBox Name="AdapterBox" Width="240" Margin="0,0,12,6" />
                        <TextBlock Text="IP" Classes="dim" VerticalAlignment="Center" Margin="0,0,6,6" />
                        <TextBox Name="IpBox" Width="140" Text="192.168.1.50" Margin="0,0,12,6" />
                        <TextBlock Text="{loc:Tr 'Mask'}" Classes="dim" VerticalAlignment="Center" Margin="0,0,6,6" />
                        <TextBox Name="MaskBox" Width="140" Text="255.255.255.0" Margin="0,0,12,6" />
                        <TextBlock Text="{loc:Tr 'Gateway'}" Classes="dim" VerticalAlignment="Center" Margin="0,0,6,6" />
                        <TextBox Name="GatewayBox" Width="140" Text="192.168.1.1" Margin="0,0,0,6" />
                    </WrapPanel>

                    <StackPanel Orientation="Horizontal" Spacing="8">
                        <Button Name="PlanButton" Classes="primary" Content="{loc:Tr 'Generate command'}" />
                        <Button Name="DhcpButton" Classes="secondary" Content="{loc:Tr 'Generate DHCP command'}" />
                        <Button Name="CopyButton" Classes="secondary" Content="{loc:Tr 'Copy command'}" />
                        <Button Name="ApplyButton" Classes="secondary" Content="{loc:Tr 'Run (administrator required)'}" />
                        <TextBlock Name="StatusText" Classes="dim" VerticalAlignment="Center" Text="{loc:Tr 'Waiting'}" />
                    </StackPanel>

                    <TextBox Name="PlanBox" AcceptsReturn="True" MinHeight="90" IsReadOnly="True"
                             FontFamily="{DynamicResource FontMono}" TextWrapping="NoWrap"
                             PlaceholderText="{loc:Tr 'Generated commands appear here and can be copied to a terminal'}" />
                </StackPanel>
            </Border>
        </Grid>
    </ScrollViewer>
</UserControl>