<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="1000" d:DesignHeight="750"
x:Class="NewLife.XCoder.Views.DataModelingWindow"
x:DataType="vm:DataModelingViewModel"
Title="{loc:Tr 'Code generator'}" Width="1000" Height="750"
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="*"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<!-- 配置 -->
<Border Grid.Row="0" Classes="GroupBorder">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<TextBlock Text="{loc:Tr 'Database'}" VerticalAlignment="Center" Margin="4,2"/>
<ComboBox Grid.Column="1" ItemsSource="{Binding Connections}" SelectedItem="{Binding ConnName}" Margin="2" Height="32"/>
<Button Grid.Column="2" Content="{Binding ConnectButtonText}" Command="{Binding ConnectCommand}" Classes="ActionButton" Width="80"/>
<Button Grid.Column="3" Content="{loc:Tr 'Refresh'}" Command="{Binding RefreshTablesCommand}" Classes="ActionButton" Width="80"/>
<TextBlock Grid.Row="1" Text="{loc:Tr 'Namespace'}" VerticalAlignment="Center" Margin="4,2"/>
<TextBox Grid.Row="1" Grid.Column="1" Text="{Binding NameSpace}" Classes="ConfigTextBox"/>
<TextBlock Grid.Row="1" Grid.Column="2" Text="{loc:Tr 'Connection name'}" VerticalAlignment="Center" Margin="4,2"/>
<TextBox Grid.Row="1" Grid.Column="3" Text="{Binding EntityConnName}" Classes="ConfigTextBox"/>
<TextBlock Grid.Row="2" Text="{loc:Tr 'Output directory'}" VerticalAlignment="Center" Margin="4,2"/>
<TextBox Grid.Row="2" Grid.Column="1" Text="{Binding OutputPath}" Classes="ConfigTextBox"/>
<TextBlock Grid.Row="2" Grid.Column="2" Text="{loc:Tr 'Base class'}" VerticalAlignment="Center" Margin="4,2"/>
<TextBox Grid.Row="2" Grid.Column="3" Text="{Binding BaseClass}" Classes="ConfigTextBox"/>
</Grid>
</Border>
<!-- 表列表 -->
<Grid Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<StackPanel Orientation="Horizontal">
<TextBlock Text="{loc:Tr 'Data table'}" FontWeight="Bold" Margin="4,2" VerticalAlignment="Center"/>
<Button Content="{loc:Tr 'Generate selected'}" Command="{Binding GenerateTableCommand}" Classes="ActionButton" Margin="4,0"/>
<Button Content="{loc:Tr 'Generate all'}" Command="{Binding GenerateAllCommand}" Classes="ActionButton"/>
<Button Content="{loc:Tr 'Open folder'}" Command="{Binding OpenOutputDirCommand}" Classes="ActionButton"/>
</StackPanel>
<ListBox Grid.Row="1" ItemsSource="{Binding Tables}" SelectedItem="{Binding SelectedTable}"
Margin="0,4" BorderThickness="1" BorderBrush="{DynamicResource BorderDefault}">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}"/>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
<!-- 状态 -->
<Border Grid.Row="2" BorderBrush="{DynamicResource BorderDefault}" BorderThickness="0,1,0,0" Padding="4,2">
<TextBlock Text="{Binding Status, Converter={x:Static loc:LocalizedTextConverter.Instance}}"/>
</Border>
</Grid>
</Window>
|