GrasscutterCommandGenerator/Source/GrasscutterTools/Windows/MainWindow.xaml
筱傑 a055dc5299 Framework changed to WPF
Only the basic window frame is implemented.
Adjusted the structure of resource files.
2022-09-29 21:56:43 +08:00

407 lines
18 KiB
XML

<Window
x:Class="GrasscutterTools.Windows.MainWindow"
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:p="clr-namespace:GrasscutterTools.Properties"
Title="{x:Static p:Resources.GrasscutterTools}"
Width="940"
Height="500"
MinWidth="940"
MinHeight="500"
d:DataContext="{Binding RelativeSource={RelativeSource Self}}"
Background="{StaticResource WindowBackgroundBrush}"
Icon="/Resources/IconGrasscutter.ico"
WindowStartupLocation="CenterScreen"
mc:Ignorable="d">
<Window.Resources>
<Style x:Key="MenuItemStyle" TargetType="{x:Type RadioButton}">
<Setter Property="Foreground" Value="#DDDDDD" />
<Setter Property="Background" Value="Transparent" />
<Setter Property="Height" Value="40" />
<Setter Property="Cursor" Value="Hand" />
<Setter Property="FontSize" Value="16" />
<Setter Property="Margin" Value="16,4,16,0" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type RadioButton}">
<Border
x:Name="BorderBlack"
Background="{TemplateBinding Background}"
CornerRadius="4">
<ContentControl
x:Name="LblContent"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="{TemplateBinding Content}"
FontSize="{TemplateBinding FontSize}"
Foreground="{TemplateBinding Foreground}" />
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="BorderBlack" Property="Background" Value="{StaticResource HoverBrush}" />
<Setter TargetName="LblContent" Property="Foreground" Value="White" />
</Trigger>
<Trigger Property="IsChecked" Value="True">
<Setter TargetName="BorderBlack" Property="Background" Value="{StaticResource NormalBorderBrush}" />
<Setter TargetName="LblContent" Property="Foreground" Value="White" />
<Setter Property="Cursor" Value="Arrow" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</Window.Resources>
<DockPanel>
<DockPanel Width="200" DockPanel.Dock="Left">
<!-- Logo -->
<Image
x:Name="ImgLogo"
Width="60"
Height="60"
Margin="8"
HorizontalAlignment="Center"
VerticalAlignment="Top"
DockPanel.Dock="Bottom"
Source="/Resources/IconGrasscutter.png" />
<!-- 左侧,菜单栏 -->
<ScrollViewer>
<StackPanel x:Name="SPMenu" Grid.Column="0">
<RadioButton
x:Name="RadHome"
Content="Home"
Style="{StaticResource MenuItemStyle}" />
<RadioButton
x:Name="RadCustom"
Content="Custom"
Cursor="Hand"
Style="{StaticResource MenuItemStyle}" />
<RadioButton
x:Name="RadArtifact"
Content="Artifact"
Style="{StaticResource MenuItemStyle}" />
<RadioButton
x:Name="RadGive"
Content="Give"
Style="{StaticResource MenuItemStyle}" />
<RadioButton
x:Name="RadSpawn"
Content="Spawn"
Style="{StaticResource MenuItemStyle}" />
<RadioButton
x:Name="RadQuests"
Content="Quests"
Style="{StaticResource MenuItemStyle}" />
<RadioButton
x:Name="RadStats"
Content="Stats"
Style="{StaticResource MenuItemStyle}" />
<RadioButton
x:Name="RadTools"
Content="Tools"
Style="{StaticResource MenuItemStyle}" />
<RadioButton
x:Name="RadScenes"
Content="Scenes"
Style="{StaticResource MenuItemStyle}" />
<RadioButton
x:Name="RadDungeons"
Content="Dungeons"
Style="{StaticResource MenuItemStyle}" />
<RadioButton
x:Name="RadManage"
Content="Manage"
Style="{StaticResource MenuItemStyle}" />
<RadioButton
x:Name="RadOpenCommand"
Content="Open Command"
Style="{StaticResource MenuItemStyle}" />
<RadioButton
x:Name="RadAbout"
Content="About"
Style="{StaticResource MenuItemStyle}" />
<RadioButton
x:Name="RadSettings"
Content="Settings"
Style="{StaticResource MenuItemStyle}" />
</StackPanel>
</ScrollViewer>
</DockPanel>
<!-- 右侧,列表栏 -->
<DockPanel
x:Name="DockListBar"
Width="250"
d:Visibility="Visible"
DockPanel.Dock="Right"
Visibility="Collapsed">
<!-- 顶部,搜索栏 -->
<Grid Margin="4" DockPanel.Dock="Top">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<!-- 搜索框 -->
<TextBox
x:Name="TxtSearch"
d:Text="Filter"
TextChanged="TxtSearch_TextChanged" />
<!-- 清除搜索内容图标按钮 -->
<Button
x:Name="BtnClearFilter"
Width="10"
Height="10"
Margin="0,0,5,0"
HorizontalAlignment="Right"
d:Visibility="Visible"
Click="BtnClearFilter_Click"
Cursor="Hand"
Foreground="{DynamicResource GlyphBrush}"
Visibility="Hidden">
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Grid x:Name="GridBG" Background="Transparent">
<Line
x:Name="L1"
Stroke="{TemplateBinding Foreground}"
StrokeEndLineCap="Round"
StrokeStartLineCap="Round"
StrokeThickness="2"
X1="0"
X2="10"
Y1="0"
Y2="10" />
<Line
x:Name="L2"
Stroke="{TemplateBinding Foreground}"
StrokeEndLineCap="Round"
StrokeStartLineCap="Round"
StrokeThickness="2"
X1="10"
X2="0"
Y1="0"
Y2="10" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="L1" Property="Stroke" Value="{DynamicResource TextBrush}" />
<Setter TargetName="L2" Property="Stroke" Value="{DynamicResource TextBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<!-- 分类按钮 -->
<Button
x:Name="BtnCategory"
Grid.Column="1"
Width="16"
Height="16"
Margin="4,0,0,0"
HorizontalAlignment="Right"
d:Visibility="Visible"
Click="BtnCategory_Click"
Cursor="Hand"
Foreground="{DynamicResource GlyphBrush}"
Visibility="Collapsed">
<Button.Template>
<ControlTemplate TargetType="{x:Type Button}">
<Grid x:Name="GridBG" Background="Transparent">
<Line
x:Name="L1"
Stroke="{TemplateBinding Foreground}"
StrokeEndLineCap="Round"
StrokeStartLineCap="Round"
StrokeThickness="2"
X1="1"
X2="15"
Y1="3"
Y2="3" />
<Line
x:Name="L2"
Stroke="{TemplateBinding Foreground}"
StrokeEndLineCap="Round"
StrokeStartLineCap="Round"
StrokeThickness="2"
X1="1"
X2="12"
Y1="8"
Y2="8" />
<Line
x:Name="L3"
Stroke="{TemplateBinding Foreground}"
StrokeEndLineCap="Round"
StrokeStartLineCap="Round"
StrokeThickness="2"
X1="1"
X2="9"
Y1="13"
Y2="13" />
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="true">
<Setter TargetName="L1" Property="Stroke" Value="{DynamicResource TextBrush}" />
<Setter TargetName="L2" Property="Stroke" Value="{DynamicResource TextBrush}" />
<Setter TargetName="L3" Property="Stroke" Value="{DynamicResource TextBrush}" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Button.Template>
</Button>
<!-- 分类弹窗 -->
<Popup
x:Name="MenuCategories"
Placement="Right"
PlacementTarget="{Binding ElementName=BtnCategory}"
StaysOpen="False">
<GroupBox Padding="8" Header="Category">
<StackPanel x:Name="SPCategories">
<CheckBox
x:Name="ChkAllCategory"
Checked="ChkAllCategory_Checked"
Content="All"
Unchecked="ChkAllCategory_Unchecked" />
</StackPanel>
</GroupBox>
</Popup>
</Grid>
</Grid>
<!-- 列表 -->
<DataGrid
x:Name="ListShared"
d:ItemsSource="{d:SampleData ItemCount=10}"
AutoGenerateColumns="False"
Background="{StaticResource ControlBackgroundBrush}"
CanUserResizeColumns="False"
CanUserResizeRows="False"
ColumnHeaderHeight="0"
Foreground="{StaticResource TextBrush}"
IsReadOnly="True"
RowBackground="{StaticResource NormalBrush}"
RowHeaderWidth="0"
SelectionMode="Single"
SelectionUnit="FullRow">
<DataGrid.Columns>
<DataGridTextColumn
Width="*"
Binding="{Binding}"
Header="Item" />
</DataGrid.Columns>
<!--<DataGrid.GroupStyle>
<GroupStyle>
<GroupStyle.ContainerStyle>
<Style TargetType="{x:Type GroupItem}">
<Setter Property="Margin" Value="0,0,0,5" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type GroupItem}">
<Expander
Background="#FF112255"
BorderBrush="#FF002255"
BorderThickness="1,1,1,5"
Foreground="#FFEEEEEE"
IsExpanded="True">
<Expander.Header>
<DockPanel>
<TextBlock
Width="100"
Margin="5,0,0,0"
FontWeight="Bold"
Text="{Binding Path=Name}" />
<TextBlock FontWeight="Bold" Text="{Binding Path=ItemCount}" />
</DockPanel>
</Expander.Header>
<Expander.Content>
<ItemsPresenter />
</Expander.Content>
</Expander>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</GroupStyle.ContainerStyle>
</GroupStyle>
</DataGrid.GroupStyle>-->
</DataGrid>
</DockPanel>
<!-- 底部,命令栏 -->
<GroupBox
x:Name="GrpCommandBar"
Padding="8,4,8,0"
VerticalAlignment="Center"
d:Visibility="Visible"
DockPanel.Dock="Bottom"
Header="Command (Press and hold Ctrl to run automatically)"
Visibility="Collapsed">
<DockPanel>
<!-- 命令栏 -->
<DockPanel DockPanel.Dock="Top">
<!-- 运行按钮 -->
<Button
x:Name="BtnRun"
Padding="8,0"
Click="BtnRun_Click"
Content="Run(F5)"
DockPanel.Dock="Left" />
<!-- 自动复制开关 -->
<CheckBox
x:Name="ChkAuto"
Margin="4"
VerticalAlignment="Center"
Content="Auto"
DockPanel.Dock="Right" />
<!-- 复制按钮 -->
<Button
x:Name="BtnCopy"
Padding="8,0"
Content="Copy"
DockPanel.Dock="Right" />
<!-- 命令输入框 -->
<TextBox
x:Name="TxtCommand"
Margin="4"
FontSize="14"
MaxLines="1" />
</DockPanel>
<!-- 命令执行记录 -->
<TextBox
x:Name="TxtCommandLog"
Height="150"
Margin="4"
d:Visibility="Visible"
FontSize="14"
IsReadOnly="True"
TextWrapping="Wrap"
VerticalScrollBarVisibility="Auto"
Visibility="Collapsed" />
</DockPanel>
</GroupBox>
<!-- 页面内容 -->
<Frame
x:Name="FrameContent"
Background="{StaticResource LightBrush}"
NavigationUIVisibility="Hidden" />
</DockPanel>
</Window>