重写设置窗口

This commit is contained in:
yangwx
2025-03-13 01:06:32 +08:00
parent ca08aa615c
commit 296d450496
8 changed files with 160 additions and 95 deletions

View File

@@ -1,10 +1,12 @@
<UserControl x:Class="YwxApp.AiChat.Views.SettingView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">
<UserControl.Resources>
<Window x:Class="YwxApp.AiChat.SettingView"
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:YwxApp.AiChat"
mc:Ignorable="d" WindowStartupLocation="CenterScreen" WindowStyle="SingleBorderWindow"
Title="AiChatSetting" Height="360" Width="360">
<Window.Resources>
<ResourceDictionary>
<!--Resource dictionary : add the control style-->
<ResourceDictionary.MergedDictionaries>
@@ -14,7 +16,7 @@
<ResourceDictionary Source="Style/ComboBoxStyle.xaml"/>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
</Window.Resources>
<Grid Background="#FFFFFF" HorizontalAlignment="Stretch">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
@@ -29,8 +31,8 @@
<WrapPanel Margin="5,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left" >
<Label Content="Ollama路径:" Margin="5" HorizontalAlignment="Left" VerticalAlignment="Center" />
<TextBox x:Name="Tbx_OllamaAppPath" FontSize="12" Text="{Binding OllamaAppPath}" Style="{StaticResource SearchBoxStyle}" Margin="5"
MinWidth="180" VerticalAlignment="Center" VerticalContentAlignment="Center" />
MinWidth="180" VerticalAlignment="Center" VerticalContentAlignment="Center" />
<Label Name="Label_State" Style="{StaticResource RoundLabelStyle}" />
<Button Content="打开" Style="{StaticResource RoundCornerButtonStyle}" Command="{Binding StartOllamaServerCommand}"/>
</WrapPanel>
@@ -47,11 +49,11 @@
<WrapPanel Grid.Row="2" Margin="5,0,0,0" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.ColumnSpan="2">
<Label Content="模型:" VerticalAlignment="Center" Margin="5" />
<ComboBox x:Name="Cbx_ModelList" Style="{StaticResource RoundComboBoxStyle}" ItemsSource="{Binding ModelList}" SelectedItem="{Binding SelectedModel}"
MinWidth="180" VerticalAlignment="Center" VerticalContentAlignment="Center" />
MinWidth="180" VerticalAlignment="Center" VerticalContentAlignment="Center" />
<Button Content="刷新" Margin="5" Grid.Row="1" Style="{StaticResource RoundCornerButtonStyle}" Command="{Binding ModelListUpdateCommand}"/>
</WrapPanel>
<TextBox x:Name="ModelDesciption" Grid.Row="3" IsReadOnly="True" TextWrapping="WrapWithOverflow" Text="{Binding ModelInformation,Mode=OneWay}" Grid.ColumnSpan="2"/>
<ListBox x:Name="ModelList" Grid.Row="3" ItemsSource="{Binding ModelList}" SelectedItem="{Binding SelectedModel}"/>
</Grid>
</UserControl>
</Window>