<Window x:Class="ServerManagerTool.WorldSaveRestoreWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:com="clr-namespace:ServerManagerTool.Common;assembly=ServerManager.Common"
        MinWidth="700" MinHeight="480" Width="800" Height="480" ResizeMode="CanResize" WindowStyle="ToolWindow" WindowStartupLocation="CenterOwner" ShowInTaskbar="False" 
        Loaded="Window_Loaded"
        Icon="../Art/favicon.ico" Title="{DynamicResource WorldSaveRestore_Title}">
    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="..\Globalization\en-US\en-US.xaml"/>
                <ResourceDictionary Source="..\Styles\Default.xaml"/>
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    <Grid Background="{StaticResource BeigeGradient}">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto"/>
            <RowDefinition Height="1*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="Auto"/>
            <ColumnDefinition Width="200*"/>
        </Grid.ColumnDefinitions>

        <Button Grid.Row="0" Grid.Column="0" HorizontalAlignment="Left" VerticalAlignment="Top" Click="Reload_Click" Margin="5,5,5,0" Width="22" Height="22" ToolTip="{DynamicResource WorldSaveRestore_ReloadTooltip}">
            <Image Source="{com:Icon Path=/ARK Server Manager;component/Art/Reload.ico,Size=32}"  />
        </Button>

        <DataGrid Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" ItemsSource="{Binding WorldSaveFiles}" Margin="5" AutoGenerateColumns="False" CanUserAddRows="False" CanUserReorderColumns="False" CanUserSortColumns="True" RowHeaderWidth="0" SelectionMode="Single">
            <DataGrid.Resources>
                <Style TargetType="{x:Type DataGridRow}">
                    <Style.Resources>
                        <SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="{x:Static SystemColors.HighlightColor}"/>
                        <SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightTextBrushKey}" Color="{x:Static SystemColors.HighlightTextColor}"/>
                    </Style.Resources>
                    <Style.Triggers>
                        <DataTrigger Binding="{Binding IsActiveFile}" Value="True">
                            <Setter Property="Background" Value="#FFF5DFB8" />
                        </DataTrigger>
                        <DataTrigger Binding="{Binding IsArchiveFile}" Value="True">
                            <Setter Property="Foreground" Value="Blue" />
                        </DataTrigger>
                    </Style.Triggers>
                </Style>
            </DataGrid.Resources>

            <DataGrid.HorizontalGridLinesBrush>
                <SolidColorBrush Color="#FFB4B4B4"/>
            </DataGrid.HorizontalGridLinesBrush>
            <DataGrid.VerticalGridLinesBrush>
                <SolidColorBrush Color="#FFB4B4B4"/>
            </DataGrid.VerticalGridLinesBrush>

            <DataGrid.Columns>
                <DataGridTextColumn     Width="1*" Binding="{Binding FileName, Mode=OneWay}" Header="{DynamicResource WorldSaveRestore_NameColumnLabel}"/>
                <DataGridTextColumn     Width="130" Binding="{Binding CreatedDate, Mode=OneWay}" Header="{DynamicResource WorldSaveRestore_CreatedDateColumnLabel}">
                    <DataGridTextColumn.HeaderStyle>
                        <Style TargetType="DataGridColumnHeader" BasedOn="{StaticResource {x:Type DataGridColumnHeader}}">
                            <Setter Property="HorizontalContentAlignment" Value="Right"/>
                        </Style>
                    </DataGridTextColumn.HeaderStyle>
                    <DataGridTextColumn.CellStyle>
                        <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
                            <Setter Property="HorizontalAlignment" Value="Right"/>
                        </Style>
                    </DataGridTextColumn.CellStyle>
                </DataGridTextColumn>
                <DataGridTextColumn     Width="130" Binding="{Binding UpdatedDate, Mode=OneWay}" Header="{DynamicResource WorldSaveRestore_UpdatedDateColumnLabel}">
                    <DataGridTextColumn.HeaderStyle>
                        <Style TargetType="DataGridColumnHeader" BasedOn="{StaticResource {x:Type DataGridColumnHeader}}">
                            <Setter Property="HorizontalContentAlignment" Value="Right"/>
                        </Style>
                    </DataGridTextColumn.HeaderStyle>
                    <DataGridTextColumn.CellStyle>
                        <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
                            <Setter Property="HorizontalAlignment" Value="Right"/>
                        </Style>
                    </DataGridTextColumn.CellStyle>
                </DataGridTextColumn>
                <DataGridTemplateColumn Width="30" CanUserReorder="False" CanUserResize="False">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Button Width="22" Height="22" Margin="0" HorizontalAlignment="Center" VerticalAlignment="Center" Click="Restore_Click" ToolTip="{DynamicResource WorldSaveRestore_RestoreTooltip}">
                                <Image Source="{com:Icon Path=/ARK Server Manager;component/Art/Download.ico,Size=32}"  />
                            </Button>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                    <DataGridTemplateColumn.CellStyle>
                        <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding IsActiveFile}" Value="True">
                                    <Setter Property="Visibility" Value="Hidden" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </DataGridTemplateColumn.CellStyle>
                </DataGridTemplateColumn>
                <DataGridTemplateColumn Width="30" CanUserReorder="False" CanUserResize="False">
                    <DataGridTemplateColumn.CellTemplate>
                        <DataTemplate>
                            <Button Width="22" Height="22" Margin="0" HorizontalAlignment="Center" VerticalAlignment="Center" Click="Delete_Click" ToolTip="{DynamicResource WorldSaveRestore_DeleteTooltip}">
                                <Image Source="{com:Icon Path=/ARK Server Manager;component/Art/Delete.ico,Size=32}"  />
                            </Button>
                        </DataTemplate>
                    </DataGridTemplateColumn.CellTemplate>
                    <DataGridTemplateColumn.CellStyle>
                        <Style TargetType="DataGridCell" BasedOn="{StaticResource {x:Type DataGridCell}}">
                            <Style.Triggers>
                                <DataTrigger Binding="{Binding IsActiveFile}" Value="True">
                                    <Setter Property="Visibility" Value="Hidden" />
                                </DataTrigger>
                            </Style.Triggers>
                        </Style>
                    </DataGridTemplateColumn.CellStyle>
                </DataGridTemplateColumn>
            </DataGrid.Columns>
        </DataGrid>
    </Grid>
</Window>
