借助网络配置,控制Modbus工具的日志显示,避免卡死界面
智能大石头 authored at 2021-12-11 22:09:19
3.67 KiB
XCoder
<Window xmlns="https://github.com/avaloniaui"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d" d:DesignWidth="900" d:DesignHeight="700"
        x:Class="XCoderAv.Views.MelSpectrumWindow"
        Title="音频梅尔频谱" Width="900" Height="700"
        WindowStartupLocation="CenterOwner">
    <Window.Styles>
        <Style Selector="TextBox.ConfigTextBox">
            <Setter Property="Margin" Value="2"/>
            <Setter Property="Height" Value="26"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="BorderBrush" Value="#D0D0D0"/>
        </Style>
        <Style Selector="Button.ActionButton">
            <Setter Property="Height" Value="30"/>
            <Setter Property="Margin" Value="2"/>
        </Style>
        <Style Selector="Border.GroupBorder">
            <Setter Property="BorderBrush" Value="#D0D0D0"/>
            <Setter Property="BorderThickness" Value="1"/>
            <Setter Property="Margin" Value="0,0,0,6"/>
        </Style>
    </Window.Styles>

    <Grid Margin="6">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>

        <!-- 文件选择 -->
        <Border Grid.Row="0" Classes="GroupBorder">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"/>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>

                <TextBlock Text="WAV 文件" VerticalAlignment="Center" Margin="4,2"/>
                <TextBox Grid.Column="1" Text="{Binding FilePath}" Classes="ConfigTextBox" IsReadOnly="True"/>
                <Button Grid.Column="2" Content="选择文件" Classes="ActionButton" Width="80"/>
            </Grid>
        </Border>

        <!-- 声道选择 -->
        <Border Grid.Row="1" Classes="GroupBorder" Padding="4">
            <StackPanel Orientation="Horizontal">
                <TextBlock Text="声道" VerticalAlignment="Center" Margin="4,0"/>
                <ComboBox ItemsSource="{Binding ChannelList}" SelectedIndex="{Binding SelectedChannelIndex}" Width="120" Height="28" Margin="4,0"/>
            </StackPanel>
        </Border>

        <!-- 频谱图 -->
        <Grid Grid.Row="2" Margin="0,4">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="*"/>
            </Grid.RowDefinitions>
            <TextBlock Text="梅尔频谱图" FontWeight="Bold" Margin="4,2"/>
            <Border Grid.Row="1" BorderBrush="#D0D0D0" BorderThickness="1" Margin="0,0,0,4">
                <Image Source="{Binding MelImagePath}" Stretch="Fill"/>
            </Border>
            <TextBlock Grid.Row="1" Text="音量曲线图" FontWeight="Bold" Margin="4,2" VerticalAlignment="Bottom"/>
            <Border Grid.Row="2" BorderBrush="#D0D0D0" BorderThickness="1">
                <Image Source="{Binding VolumeImagePath}" Stretch="Fill"/>
            </Border>
        </Grid>

        <!-- 日志 -->
        <TextBox Grid.Row="3" Text="{Binding Log}" AcceptsReturn="True" AcceptsTab="True"
                 FontFamily="Consolas" FontSize="12" MinHeight="60" Margin="0,4"
                 BorderThickness="1" BorderBrush="#D0D0D0"/>
    </Grid>
</Window>