<Window
  x:Class="VPet.ModMaker.Views.ModEdit.FoodEdit.FoodEditWindow"
  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:ll="clr-namespace:LinePutScript.Localization.WPF;assembly=LinePutScript.Localization.WPF"
  xmlns:local="clr-namespace:VPet.ModMaker.Views.ModEdit.FoodEdit"
  xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  xmlns:pu="https://opensource.panuon.com/wpf-ui"
  xmlns:vm="clr-namespace:VPet.ModMaker.ViewModels.ModEdit.FoodEdit"
  Title="{ll:Str 编辑食物}"
  Width="800"
  Height="450"
  d:DataContext="{d:DesignInstance Type=vm:FoodEditWindowVM}"
  WindowStartupLocation="CenterScreen"
  mc:Ignorable="d">
  <Grid>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="250" />
      <ColumnDefinition />
      <ColumnDefinition Width="Auto" />
    </Grid.ColumnDefinitions>
    <Grid>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition />
      </Grid.RowDefinitions>
      <Grid>
        <Image
          x:Name="Image_FoodImage"
          Width="250"
          Height="250"
          Source="{Binding Food.Value.Image.Value}"
          Stretch="Uniform">
          <Image.ContextMenu>
            <ContextMenu>
              <MenuItem Command="{Binding ChangeImageCommand}" Header="{ll:Str 修改图片}" />
            </ContextMenu>
          </Image.ContextMenu>
        </Image>
        <Button
          HorizontalAlignment="Center"
          VerticalAlignment="Center"
          Command="{Binding AddImageCommand}"
          Content="{ll:Str 添加图片}">
          <Button.Style>
            <Style BasedOn="{StaticResource {x:Type Button}}" TargetType="Button">
              <Setter Property="Visibility" Value="Hidden" />
              <Style.Triggers>
                <DataTrigger Binding="{Binding Food.Value.Image.Value}" Value="{x:Null}">
                  <Setter Property="Visibility" Value="Visible" />
                </DataTrigger>
              </Style.Triggers>
            </Style>
          </Button.Style>
        </Button>
      </Grid>
      <ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
        <Grid>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition />
          </Grid.ColumnDefinitions>
          <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition />
          </Grid.RowDefinitions>
          <Label Content="Id" />
          <TextBox
            Grid.Column="1"
            pu:TextBoxHelper.Watermark="Id"
            Text="{Binding Food.Value.Id.Value, UpdateSourceTrigger=PropertyChanged}" />
          <Label Grid.Row="1" Content="{ll:Str 食物类型}" />
          <ComboBox
            x:Name="ComboBox_FoodType"
            Grid.Row="1"
            Grid.Column="1"
            ItemsSource="{Binding Food.Value.FoodTypes}"
            SelectedItem="{Binding Food.Value.Type.Value}" />
          <Label Grid.Row="2" Content="{ll:Str 动画名称}" />
          <TextBox
            Grid.Row="2"
            Grid.Column="1"
            pu:TextBoxHelper.Watermark="{ll:Str 绑定的动画名称(非必要)}"
            Text="{Binding Food.Value.Graph.Value, UpdateSourceTrigger=PropertyChanged}" />
          <Label Grid.Row="3" Content="{ll:Str 食物名称}" />
          <TextBox
            Grid.Row="3"
            Grid.Column="1"
            pu:TextBoxHelper.Watermark="{ll:Str 食物名称}"
            Text="{Binding Food.Value.CurrentI18nData.Value.Name.Value, UpdateSourceTrigger=PropertyChanged}" />
          <Label Grid.Row="4" Content="{ll:Str 食物描述}" />
          <TextBox
            Grid.Row="4"
            Grid.Column="1"
            pu:TextBoxHelper.Watermark="{ll:Str 食物描述}"
            Style="{StaticResource TextBox_Wrap}"
            Text="{Binding Food.Value.CurrentI18nData.Value.Description.Value, UpdateSourceTrigger=PropertyChanged}" />
        </Grid>
      </ScrollViewer>
    </Grid>
    <Grid Grid.Column="1">
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition />
        <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>
      <Label Content="{ll:Str 食物效果}" />
      <ScrollViewer Grid.Row="1" VerticalScrollBarVisibility="Auto">
        <Grid>
          <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition />
          </Grid.ColumnDefinitions>
          <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
          </Grid.RowDefinitions>
          <Label Content="{ll:Str 饱腹值}" />
          <pu:NumberInput
            x:Name="NumberInput_StrengthFood"
            Grid.Column="1"
            Value="{Binding Food.Value.StrengthFood.Value, Mode=TwoWay}" />
          <Label Grid.Row="2" Content="{ll:Str 口渴值}" />
          <pu:NumberInput
            Grid.Row="2"
            Grid.Column="1"
            Value="{Binding Food.Value.StrengthDrink.Value, Mode=TwoWay}" />
          <Label Grid.Row="3" Content="{ll:Str 健康值}" />
          <pu:NumberInput
            Grid.Row="3"
            Grid.Column="1"
            Value="{Binding Food.Value.Health.Value, Mode=TwoWay}" />
          <Label Grid.Row="4" Content="{ll:Str 体力值}" />
          <pu:NumberInput
            Grid.Row="4"
            Grid.Column="1"
            Value="{Binding Food.Value.Strength.Value, Mode=TwoWay}" />
          <Label Grid.Row="5" Content="{ll:Str 心情值}" />
          <pu:NumberInput
            Grid.Row="5"
            Grid.Column="1"
            Value="{Binding Food.Value.Feeling.Value, Mode=TwoWay}" />
          <Label Grid.Row="6" Content="{ll:Str 好感值}" />
          <pu:NumberInput
            Grid.Row="6"
            Grid.Column="1"
            Value="{Binding Food.Value.Likability.Value, Mode=TwoWay}" />
          <Label Grid.Row="7" Content="{ll:Str 经验值}" />
          <pu:NumberInput
            Grid.Row="7"
            Grid.Column="1"
            Value="{Binding Food.Value.Exp.Value, Mode=TwoWay}" />
          <Label Grid.Row="8" Content="{ll:Str 价格}" />
          <pu:NumberInput
            Grid.Row="8"
            Grid.Column="1"
            Value="{Binding Food.Value.Price.Value, Mode=TwoWay}" />
          <Label Grid.Row="9" Content="{ll:Str 参考价格}" />
          <Grid Grid.Row="9" Grid.Column="1">
            <Grid.ColumnDefinitions>
              <ColumnDefinition />
              <ColumnDefinition Width="Auto" />
              <ColumnDefinition Width="Auto" />
            </Grid.ColumnDefinitions>
            <TextBlock Text="{Binding Food.Value.ReferencePrice.Value}" />
            <Button
              Grid.Column="1"
              Command="{Binding SetReferencePriceCommand}"
              CommandParameter="{Binding Food.Value.ReferencePrice.Value}"
              Content="{ll:Str 设置}" />
            <pu:Switch
              Grid.Column="2"
              BoxHeight="16"
              BoxWidth="30"
              Content="{ll:Str 自动设置}"
              IsChecked="{Binding AutoSetReferencePrice.Value}" />
          </Grid>
        </Grid>
      </ScrollViewer>
      <Grid Grid.Row="2">
        <Grid.ColumnDefinitions>
          <ColumnDefinition />
          <ColumnDefinition />
        </Grid.ColumnDefinitions>
        <Button
          x:Name="Button_Cancel"
          Margin="10"
          Click="Button_Cancel_Click"
          Content="{ll:Str 取消}" />
        <Button
          x:Name="Button_Yes"
          Grid.Column="1"
          Margin="10"
          Click="Button_Yes_Click"
          Content="{ll:Str 确定}" />
      </Grid>
    </Grid>
    <ListBox Grid.Column="2" Template="{StaticResource ListBox_ShowLangs}" />
  </Grid>
</Window>
