<Window
  x:Class="VPet.ModMaker.Views.ModEdit.WorkEdit.WorkEditWindow"
  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.WorkEdit"
  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.WorkEdit"
  Title="{ll:Str 编辑工作}"
  Width="800"
  Height="450"
  d:DataContext="{d:DesignInstance Type=vm:WorkEditWindowVM}"
  WindowStartupLocation="CenterScreen"
  mc:Ignorable="d">
  <Grid>
    <Grid.ColumnDefinitions>
      <ColumnDefinition Width="Auto" />
      <ColumnDefinition />
      <ColumnDefinition Width="Auto" />
    </Grid.ColumnDefinitions>
    <Grid>
      <Grid.RowDefinitions>
        <RowDefinition Height="Auto" />
        <RowDefinition />
      </Grid.RowDefinitions>
      <Grid>
        <Image
          Width="250"
          Height="250"
          Source="{Binding Image.Value}"
          Stretch="Uniform">
          <Image.ContextMenu>
            <ContextMenu>
              <MenuItem Command="{Binding ChangeImageCommand}" Header="{ll:Str 修改测试图片}" />
            </ContextMenu>
          </Image.ContextMenu>
        </Image>
        <Label
          Padding="0"
          HorizontalAlignment="Left"
          VerticalAlignment="Top"
          HorizontalContentAlignment="Stretch"
          VerticalContentAlignment="Stretch"
          pu:LabelHelper.CornerRadius="5"
          Background="{Binding Work.Value.Background.Value}"
          BorderBrush="{Binding Work.Value.BorderBrush.Value}"
          BorderThickness="3">
          <Label.Style>
            <Style BasedOn="{StaticResource {x:Type Label}}" TargetType="Label">
              <Setter Property="Width">
                <Setter.Value>
                  <MultiBinding Converter="{StaticResource CalculatorConverter}" ConverterParameter="*">
                    <Binding Path="Work.Value.Width.Value" />
                    <Binding Path="LengthRatio.Value" />
                  </MultiBinding>
                </Setter.Value>
              </Setter>
              <Setter Property="Height">
                <Setter.Value>
                  <MultiBinding Converter="{StaticResource CalculatorConverter}" ConverterParameter="*/*">
                    <Binding Path="Work.Value.Width.Value" />
                    <Binding Path="LengthRatio.Value" />
                    <Binding Source="300" />
                    <Binding Source="180" />
                  </MultiBinding>
                </Setter.Value>
              </Setter>
              <Setter Property="Margin">
                <Setter.Value>
                  <MultiBinding Converter="{StaticResource RatioMarginConverter}">
                    <Binding Path="LengthRatio.Value" />
                    <Binding Path="Work.Value.Left.Value" />
                    <Binding Path="Work.Value.Top.Value" />
                  </MultiBinding>
                </Setter.Value>
              </Setter>
            </Style>
          </Label.Style>
          <Label.Content>
            <Grid>
              <Label
                HorizontalContentAlignment="Center"
                VerticalContentAlignment="Center"
                Background="{Binding Work.Value.Background.Value}"
                Content="{ll:Str 工作中}"
                Foreground="{Binding Work.Value.Foreground.Value}" />
              <Button
                VerticalAlignment="Bottom"
                Background="{Binding Work.Value.ButtonBackground.Value}"
                Content="{ll:Str 停止工作}"
                Foreground="{Binding Work.Value.ButtonForeground.Value}" />
            </Grid>
          </Label.Content>
        </Label>
        <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 Image.Value}" Value="{x:Null}">
                  <Setter Property="Visibility" Value="Visible" />
                </DataTrigger>
              </Style.Triggers>
            </Style>
          </Button.Style>
        </Button>
      </Grid>
      <Grid Grid.Row="1">
        <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" />
        </Grid.RowDefinitions>
        <Label Content="Id" />
        <TextBox Grid.Column="1" Text="{Binding Work.Value.Id.Value}" />
        <Label Grid.Row="1" Content="{ll:Str 名称}" />
        <TextBox
          Grid.Row="1"
          Grid.Column="1"
          Text="{Binding Work.Value.CurrentI18nData.Value.Name.Value}" />
        <Label Grid.Row="2" Content="{ll:Str 类型}" />
        <ComboBox
          Grid.Row="2"
          Grid.Column="1"
          ItemsSource="{Binding Work.Value.WorkTypes}"
          SelectedItem="{Binding Work.Value.WorkType.Value}" />
        <Label Grid.Row="3" Content="{ll:Str 指定动画}" />
        <TextBox
          Grid.Row="3"
          Grid.Column="1"
          Text="{Binding Work.Value.Graph.Value}" />
        <Label Grid.Row="4" Content="{ll:Str 是否超模}" />
        <TextBlock
          Grid.Row="4"
          Grid.Column="1"
          Text="{Binding Work.Value.IsOverLoad.Value}" />
        <!--<Label Grid.Row="3" Content="{ll:Str 宠物描述}" />
        <TextBox
          Grid.Row="3"
          Grid.Column="1"
          Text="{Binding Pet.Value.CurrentI18nData.Value.Description.Value}" />-->
      </Grid>
    </Grid>
    <Grid Grid.Column="1">
      <Grid.RowDefinitions>
        <RowDefinition />
        <RowDefinition Height="Auto" />
      </Grid.RowDefinitions>
      <ScrollViewer VerticalScrollBarVisibility="Auto">
        <Grid>
          <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
          </Grid.RowDefinitions>
          <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" />
            </Grid.RowDefinitions>
            <Label Content="{ll:Str 基础倍率}" />
            <pu:NumberInput Grid.Column="1" Value="{Binding Work.Value.MoneyBase.Value}" />
            <Label Grid.Row="1" Content="{ll:Str 等级倍率}" />
            <pu:NumberInput
              Grid.Row="1"
              Grid.Column="1"
              Value="{Binding Work.Value.MoneyLevel.Value}" />
            <Label Grid.Row="2" Content="{ll:Str 饱食度消耗倍率}" />
            <pu:NumberInput
              Grid.Row="2"
              Grid.Column="1"
              Value="{Binding Work.Value.StrengthFood.Value}" />
            <Label Grid.Row="3" Content="{ll:Str 口渴度消耗倍率}" />
            <pu:NumberInput
              Grid.Row="3"
              Grid.Column="1"
              Value="{Binding Work.Value.StrengthDrink.Value}" />
            <Label Grid.Row="4" Content="{ll:Str 心情消耗倍率}" />
            <pu:NumberInput
              Grid.Row="4"
              Grid.Column="1"
              Value="{Binding Work.Value.Feeling.Value}" />
            <Label Grid.Row="5" Content="{ll:Str 完成奖励倍率}" />
            <pu:NumberInput
              Grid.Row="5"
              Grid.Column="1"
              Value="{Binding Work.Value.FinishBonus.Value}" />
            <Label Grid.Row="6" Content="{ll:Str 等级限制}" />
            <pu:NumberInput
              Grid.Row="6"
              Grid.Column="1"
              Value="{Binding Work.Value.LevelLimit.Value}" />
            <Label Grid.Row="7" Content="{ll:Str 花费时间(分钟)}" />
            <pu:NumberInput
              Grid.Row="7"
              Grid.Column="1"
              Value="{Binding Work.Value.Time.Value}" />
          </Grid>
          <Expander Grid.Row="1" Header="{ll:Str 界面样式}">
            <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" />
              </Grid.RowDefinitions>
              <Label Content="{ll:Str 边框颜色}" />
              <pu:ColorPicker
                Grid.Column="1"
                ColorChannels="RGB"
                SelectedColor="{Binding Work.Value.BorderBrush.Value, Converter={StaticResource BrushToMediaColorConverter}}" />
              <Label Grid.Row="1" Content="{ll:Str 背景颜色}" />
              <pu:ColorPicker
                Grid.Row="1"
                Grid.Column="1"
                ColorChannels="RGB"
                SelectedColor="{Binding Work.Value.Background.Value, Converter={StaticResource BrushToMediaColorConverter}}" />
              <Label Grid.Row="2" Content="{ll:Str 字体颜色}" />
              <pu:ColorPicker
                Grid.Row="2"
                Grid.Column="1"
                ColorChannels="RGB"
                SelectedColor="{Binding Work.Value.Foreground.Value, Converter={StaticResource BrushToMediaColorConverter}}" />
              <Label Grid.Row="3" Content="{ll:Str 按钮背景颜色}" />
              <pu:ColorPicker
                Grid.Row="3"
                Grid.Column="1"
                ColorChannels="RGB"
                SelectedColor="{Binding Work.Value.ButtonBackground.Value, Converter={StaticResource BrushToMediaColorConverter}}" />
              <Label Grid.Row="4" Content="{ll:Str 按钮字体颜色}" />
              <pu:ColorPicker
                Grid.Row="4"
                Grid.Column="1"
                ColorChannels="RGB"
                SelectedColor="{Binding Work.Value.ButtonForeground.Value, Converter={StaticResource BrushToMediaColorConverter}}" />
              <Label Grid.Row="5" Content="X" />
              <pu:NumberInput
                Grid.Row="5"
                Grid.Column="1"
                Value="{Binding Work.Value.Left.Value}" />
              <Label Grid.Row="6" Content="Y" />
              <pu:NumberInput
                Grid.Row="6"
                Grid.Column="1"
                Value="{Binding Work.Value.Top.Value}" />
              <Label Grid.Row="7" Content="{ll:Str 宽}" />
              <pu:NumberInput
                Grid.Row="7"
                Grid.Column="1"
                Value="{Binding Work.Value.Width.Value}" />
            </Grid>
          </Expander>
        </Grid>
      </ScrollViewer>
      <Grid Grid.Row="1">
        <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>
