优化界面布局和功能增强
在 `AiMessageControll.xaml` 中添加了 `hc:Divider` 控件,调整输入区域布局为 `DockPanel`,并简化发送消息界面。 在 `ImportExcelPage.xaml` 中新增 `DataGridContextMenu` 数据模板,优化 `DataGrid` 的右键菜单功能,并调整 `VirtualizingPanel` 属性。 使用 `hc:Card` 替代 `GridSplitter`,重新组织参数配置布局。 在 `ImportExcelPage.xaml.cs` 中添加按钮事件处理程序以切换配置面板显示状态。 在 `ImportViewModel.cs` 中新增 `_showConfig` 属性以控制配置信息的显示状态。
This commit is contained in:
parent
1f9dd20c87
commit
73ad1cd308
|
@ -3,6 +3,7 @@
|
|||
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"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:local="clr-namespace:ExcelHelper.Views.Components"
|
||||
xmlns:local1="clr-namespace:ExcelHelper.Converter"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
|
@ -99,6 +100,12 @@
|
|||
Foreground="#99000000"
|
||||
Text="{Binding Timestamp, StringFormat='{}{0:HH:mm}'}" />
|
||||
</StackPanel>
|
||||
<hc:Divider
|
||||
Height="10"
|
||||
Margin="0,3"
|
||||
LineStroke="#000"
|
||||
LineStrokeThickness="2"
|
||||
Visibility="{Binding IsUser, Converter={StaticResource Boolean2VisibilityReConverter}}" />
|
||||
</StackPanel>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
|
@ -107,46 +114,53 @@
|
|||
</ScrollViewer>
|
||||
|
||||
<!-- 输入区 -->
|
||||
<Grid Grid.Row="1" Margin="5">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Border
|
||||
Grid.Column="0"
|
||||
BorderBrush="#CCCCCC"
|
||||
BorderThickness="1"
|
||||
CornerRadius="5">
|
||||
<Border
|
||||
Grid.Row="1"
|
||||
Margin="8"
|
||||
Padding="5"
|
||||
Background="Transparent"
|
||||
BorderBrush="#000"
|
||||
BorderThickness="2"
|
||||
CornerRadius="3">
|
||||
|
||||
<StackPanel Grid.Row="1" Background="White">
|
||||
<TextBox
|
||||
x:Name="MessageInput"
|
||||
MinHeight="40"
|
||||
MaxHeight="120"
|
||||
Padding="8"
|
||||
AcceptsReturn="True"
|
||||
Background="Transparent"
|
||||
BorderThickness="0"
|
||||
IsEnabled="{Binding IsWaiting, Converter={StaticResource InverseBoolConverter}, UpdateSourceTrigger=PropertyChanged, ElementName=userControl}"
|
||||
KeyDown="MessageInput_KeyDown"
|
||||
Text="{Binding CurrentMessage, UpdateSourceTrigger=PropertyChanged, ElementName=userControl}"
|
||||
TextWrapping="Wrap"
|
||||
VerticalScrollBarVisibility="Auto" />
|
||||
</Border>
|
||||
<DockPanel>
|
||||
<hc:ComboBox Height="30" SelectedIndex="1">
|
||||
<ComboBoxItem Content="DeepSeek-V3" />
|
||||
<ComboBoxItem Content="DeepSeek-V3" />
|
||||
<ComboBoxItem Content="DeepSeek-V3" />
|
||||
</hc:ComboBox>
|
||||
<Button
|
||||
Height="30"
|
||||
Margin="5"
|
||||
Padding="15,0"
|
||||
HorizontalAlignment="Right"
|
||||
Background="#000"
|
||||
BorderBrush="Transparent"
|
||||
BorderThickness="0"
|
||||
Click="SendButton_Click"
|
||||
Content="发送 ✈"
|
||||
Foreground="White"
|
||||
IsEnabled="{Binding IsWaiting, Converter={StaticResource InverseBoolConverter}, UpdateSourceTrigger=PropertyChanged, ElementName=userControl}" />
|
||||
|
||||
<Button
|
||||
Grid.Column="1"
|
||||
Height="40"
|
||||
Margin="5,0,0,0"
|
||||
Padding="15,0"
|
||||
Background="#000"
|
||||
BorderBrush="Transparent"
|
||||
BorderThickness="0"
|
||||
Click="SendButton_Click"
|
||||
Content="发送"
|
||||
Foreground="White"
|
||||
IsEnabled="{Binding IsWaiting, Converter={StaticResource InverseBoolConverter}, UpdateSourceTrigger=PropertyChanged, ElementName=userControl}" />
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
</Border>
|
||||
<!-- 等待指示器 -->
|
||||
<Border
|
||||
Grid.Row="1"
|
||||
|
|
|
@ -46,6 +46,11 @@
|
|||
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
<DataTemplate x:Key="DataGridContextMenu">
|
||||
<Menu>
|
||||
<MenuItem Header="问这一行数据" />
|
||||
</Menu>
|
||||
</DataTemplate>
|
||||
</Page.Resources>
|
||||
<Grid
|
||||
AllowDrop="True"
|
||||
|
@ -82,22 +87,25 @@
|
|||
Visibility="{Binding IsLoading, Converter={StaticResource BooleanToVisibilityConverter}}" />
|
||||
<hc:TabControl
|
||||
Grid.Column="0"
|
||||
Grid.ColumnSpan="2"
|
||||
Margin="5,5,7,5"
|
||||
ShowCloseButton="False"
|
||||
ShowContextMenu="False">
|
||||
<hc:TabItem Header="预览">
|
||||
<DataGrid
|
||||
x:Name="ExcelDataPreviewGrid"
|
||||
hc:DataGridAttach.CanUnselectAllWithBlankArea="True"
|
||||
hc:DataGridAttach.ShowRowNumber="True"
|
||||
hc:DataGridAttach.ShowSelectAllButton="True"
|
||||
AutoGenerateColumns="False"
|
||||
ContextMenu="{StaticResource DataGridContextMenu}"
|
||||
EnableColumnVirtualization="True"
|
||||
EnableRowVirtualization="True"
|
||||
IsReadOnly="True"
|
||||
ItemsSource="{Binding ExcelData, IsAsync=True}"
|
||||
RowHeight="NaN"
|
||||
ScrollViewer.CanContentScroll="True"
|
||||
VirtualizingPanel.IsContainerVirtualizable="True"
|
||||
VirtualizingPanel.IsVirtualizing="True"
|
||||
VirtualizingPanel.VirtualizationMode="Recycling" />
|
||||
VirtualizingPanel.ScrollUnit="Pixel" />
|
||||
</hc:TabItem>
|
||||
|
||||
<hc:TabItem Header="Columns2Prompt">
|
||||
|
@ -126,92 +134,102 @@
|
|||
</Grid>
|
||||
</hc:TabItem>
|
||||
</hc:TabControl>
|
||||
<GridSplitter
|
||||
Grid.Column="0"
|
||||
Width="2"
|
||||
Margin="0,5" />
|
||||
|
||||
<hc:Card
|
||||
x:Name="ConfigCard"
|
||||
Grid.Column="1"
|
||||
Width="Auto"
|
||||
Height="Auto"
|
||||
Margin="5"
|
||||
HorizontalAlignment="Stretch">
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Bottom"
|
||||
Opacity="0.95">
|
||||
<hc:Card.Header>
|
||||
<hc:SimpleStackPanel
|
||||
Margin="5"
|
||||
HorizontalAlignment="Center"
|
||||
Orientation="Horizontal">
|
||||
<DockPanel Margin="5">
|
||||
<TextBlock
|
||||
Margin="5,0"
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Text="参数配置" />
|
||||
|
||||
<Button
|
||||
HorizontalAlignment="Right"
|
||||
Click="Button_Click_1"
|
||||
Content="▼"
|
||||
DockPanel.Dock="Left" />
|
||||
</DockPanel>
|
||||
</hc:Card.Header>
|
||||
<hc:TransitioningContentControl TransitionMode="Bottom2Top" Visibility="{Binding ShowConfig, Converter={StaticResource BooleanToVisibilityConverter}}">
|
||||
<hc:SimpleStackPanel SnapsToDevicePixels="True">
|
||||
<hc:SimpleStackPanel.Resources>
|
||||
<Style TargetType="{x:Type hc:SimpleStackPanel}">
|
||||
<Setter Property="Margin" Value="5,5" />
|
||||
</Style>
|
||||
</hc:SimpleStackPanel.Resources>
|
||||
<hc:SimpleStackPanel Orientation="Horizontal">
|
||||
<Label Content="指定的Sheet:" />
|
||||
<hc:ComboBox
|
||||
MinWidth="60"
|
||||
MaxWidth="180"
|
||||
Margin="0"
|
||||
ItemsSource="{Binding Sheets}"
|
||||
SelectedValue="{Binding SelectedSheetName}" />
|
||||
<Button
|
||||
Margin="0"
|
||||
VerticalAlignment="Center"
|
||||
Command="{Binding ReadSheetsCommand}"
|
||||
Content="刷新" />
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel Height="Auto" Orientation="Horizontal">
|
||||
<Label Content="起始位置:" />
|
||||
<hc:TextBox MinWidth="40" Text="{Binding StartCell}" />
|
||||
<CheckBox Content="包含列头" IsChecked="{Binding UseHeaderRow}" />
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel Orientation="Horizontal">
|
||||
<Label Content="结束位置:" />
|
||||
<hc:TextBox MinWidth="40" Text="{Binding EndCell}" />
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel Orientation="Horizontal">
|
||||
<Label>
|
||||
<CheckBox Content="合并的单元格进行填充" IsChecked="{Binding FillMergedCells}" />
|
||||
</Label>
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel Orientation="Horizontal">
|
||||
<Label Content="最大读取行数:" />
|
||||
<hc:NumericUpDown
|
||||
MinWidth="40"
|
||||
Maximum="300"
|
||||
Minimum="0"
|
||||
Value="{Binding MaxRow}" />
|
||||
<TextBlock
|
||||
Margin="5,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="预览时最大读取300行" />
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel Width="Auto" Orientation="Horizontal">
|
||||
<Label Content="当前文件路径:" />
|
||||
<!--<hc:TextBox MinWidth="200" />-->
|
||||
<hc:ComboBox
|
||||
MaxWidth="200"
|
||||
ItemsSource="{Binding ExcelFiles}"
|
||||
SelectedValue="{Binding CurrentFilePath}" />
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel
|
||||
IsEnabled="False"
|
||||
Orientation="Horizontal"
|
||||
ToolTip="暂不支持加密的Excel">
|
||||
<Label Content="Excel密码:" />
|
||||
<PasswordBox MinWidth="60" utils:PasswordBoxHelper.Password="{Binding ExcelPassword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<Button Content="?" ToolTip="未加密留空,多个Excel如果不同密码请分批次导入" />
|
||||
</hc:SimpleStackPanel>
|
||||
<Button
|
||||
HorizontalAlignment="Center"
|
||||
VerticalAlignment="Center"
|
||||
Command="{Binding ReLoadExcelCommand}"
|
||||
Content="重新读取Excel"
|
||||
Style="{StaticResource ButtonPrimary}" />
|
||||
</hc:SimpleStackPanel>
|
||||
</hc:Card.Header>
|
||||
<hc:SimpleStackPanel SnapsToDevicePixels="True">
|
||||
<hc:SimpleStackPanel.Resources>
|
||||
<Style TargetType="{x:Type hc:SimpleStackPanel}">
|
||||
<Setter Property="Margin" Value="5,5" />
|
||||
</Style>
|
||||
</hc:SimpleStackPanel.Resources>
|
||||
|
||||
<hc:SimpleStackPanel Orientation="Horizontal">
|
||||
<Label Content="指定的Sheet:" />
|
||||
<hc:ComboBox
|
||||
MinWidth="60"
|
||||
MaxWidth="180"
|
||||
Margin="0"
|
||||
ItemsSource="{Binding Sheets}"
|
||||
SelectedValue="{Binding SelectedSheetName}" />
|
||||
<Button
|
||||
Margin="0"
|
||||
VerticalAlignment="Center"
|
||||
Command="{Binding ReadSheetsCommand}"
|
||||
Content="刷新" />
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel Height="Auto" Orientation="Horizontal">
|
||||
<Label Content="起始位置:" />
|
||||
<hc:TextBox MinWidth="40" Text="{Binding StartCell}" />
|
||||
<CheckBox Content="包含列头" IsChecked="{Binding UseHeaderRow}" />
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel Orientation="Horizontal">
|
||||
<Label Content="结束位置:" />
|
||||
<hc:TextBox MinWidth="40" Text="{Binding EndCell}" />
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel Orientation="Horizontal">
|
||||
<Label>
|
||||
<CheckBox Content="合并的单元格进行填充" IsChecked="{Binding FillMergedCells}" />
|
||||
</Label>
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel Orientation="Horizontal">
|
||||
<Label Content="最大读取行数:" />
|
||||
<hc:NumericUpDown
|
||||
MinWidth="40"
|
||||
Maximum="300"
|
||||
Minimum="0"
|
||||
Value="{Binding MaxRow}" />
|
||||
<TextBlock
|
||||
Margin="5,0"
|
||||
VerticalAlignment="Center"
|
||||
Text="预览时最大读取300行" />
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel Width="Auto" Orientation="Horizontal">
|
||||
<Label Content="当前文件路径:" />
|
||||
<!--<hc:TextBox MinWidth="200" />-->
|
||||
<hc:ComboBox
|
||||
MaxWidth="200"
|
||||
ItemsSource="{Binding ExcelFiles}"
|
||||
SelectedValue="{Binding CurrentFilePath}" />
|
||||
</hc:SimpleStackPanel>
|
||||
<hc:SimpleStackPanel IsEnabled="False" Orientation="Horizontal">
|
||||
<Label Content="Excel密码:" />
|
||||
<PasswordBox MinWidth="60" utils:PasswordBoxHelper.Password="{Binding ExcelPassword, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<Button Content="?" ToolTip="未加密留空,多个Excel如果不同密码请分批次导入" />
|
||||
</hc:SimpleStackPanel>
|
||||
</hc:SimpleStackPanel>
|
||||
</hc:TransitioningContentControl>
|
||||
</hc:Card>
|
||||
<hc:Card Grid.Column="2">
|
||||
<!-- Fix: Added Mode=OneWay -->
|
||||
|
|
|
@ -117,4 +117,9 @@ public partial class ImportExcelPage : Page, IView, IRecipient<UpdateDataGridCol
|
|||
// 标记事件已处理,防止冒泡
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void Button_Click_1(object sender, System.Windows.RoutedEventArgs e)
|
||||
{
|
||||
ViewModel.ShowConfig = !ViewModel.ShowConfig;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -443,6 +443,13 @@ public partial class ImportViewModel : ObservableRecipient, IViewModel
|
|||
[ObservableProperty]
|
||||
private string _dbType;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 是否显示配置信息
|
||||
/// </summary>
|
||||
[ObservableProperty]
|
||||
private bool _showConfig = false;
|
||||
|
||||
/// <summary>
|
||||
/// 加密连接
|
||||
/// </summary>
|
||||
|
|
Loading…
Reference in New Issue