<Window x:Class="ServerManagerTool.PluginsWindow"
        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="640" MinHeight="480" Width="640" Height="480" ResizeMode="CanResize" WindowStyle="ToolWindow" WindowStartupLocation="CenterOwner" ShowInTaskbar="False"
        Icon="../Art/favicon.ico" Title="{DynamicResource PluginsWindow_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/>
        </Grid.RowDefinitions>

        <GroupBox Grid.Row="0" HorizontalAlignment="Stretch" Style="{StaticResource GroupBoxStyle}">
            <GroupBox.Header>
                <StackPanel Orientation="Horizontal" Margin="0,5,0,5">
                    <Button Width="22" Height="22" Click="AddPlugin_Click" ToolTip="{DynamicResource PluginsWindow_AddPluginTooltip}">
                        <Image Source="{com:Icon Path=/Ark Server Manager;component/Art/Add.ico,Size=32}"/>
                    </Button>
                    <Button Width="22" Height="22" Click="ClearPlugins_Click" Margin="10,0,0,0" ToolTip="{DynamicResource PluginsWindow_ClearPluginsTooltip}">
                        <Image Source="{com:Icon Path=/Ark Server Manager;component/Art/Delete.ico,Size=32}"/>
                    </Button>
                    <Button Width="22" Height="22" Click="OpenPluginsFolder_Click" Margin="10,0,0,0" ToolTip="{DynamicResource PluginsWindow_OpenPluginsFolderTooltip}">
                        <Image Source="{com:Icon Path=/Ark Server Manager;component/Art/FolderOpen.ico,Size=32}"/>
                    </Button>
                    <Button Width="22" Height="22" Click="PluginsForum_Click" Margin="20,0,0,0" ToolTip="{DynamicResource PluginsWindow_PluginsForumTooltip}">
                        <Image Source="{com:Icon Path=/Ark Server Manager;component/Art/Help.ico,Size=32}"/>
                    </Button>
                </StackPanel>
            </GroupBox.Header>

            <DataGrid ItemsSource="{Binding PluginHelperInstance.Plugins}" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False" CanUserReorderColumns="False" CanUserSortColumns="true" SelectionMode="Single" CanUserResizeColumns="False" CanUserResizeRows="False" RowHeaderWidth="25">
                <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>
                </DataGrid.Resources>

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

                <DataGrid.Columns>
                    <DataGridTextColumn     Width="4*" Binding="{Binding Plugin.PluginName}" IsReadOnly="True">
                        <DataGridTextColumn.Header>
                            <TextBlock Text="{DynamicResource PluginsWindow_NameColumnLabel}" />
                        </DataGridTextColumn.Header>
                    </DataGridTextColumn>
                    <DataGridTextColumn     Width="2*" Binding="{Binding PluginType}" IsReadOnly="True">
                        <DataGridTextColumn.Header>
                            <TextBlock Text="{DynamicResource PluginsWindow_TypeColumnLabel}" />
                        </DataGridTextColumn.Header>
                    </DataGridTextColumn>
                    <DataGridTextColumn     Width="1*" Binding="{Binding Plugin.PluginVersion}" IsReadOnly="True">
                        <DataGridTextColumn.Header>
                            <TextBlock Text="{DynamicResource PluginsWindow_VersionColumnLabel}" />
                        </DataGridTextColumn.Header>
                    </DataGridTextColumn>
                    <DataGridTemplateColumn Width="30" CanUserReorder="False" IsReadOnly="True">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Button Width="22" Height="22" Margin="0" IsTabStop="False" HorizontalAlignment="Center" VerticalAlignment="Center" Click="ConfigPlugin_Click" ToolTip="{DynamicResource PluginsWindow_ConfigPluginTooltip}">
                                    <Button.Style>
                                        <Style BasedOn="{StaticResource {x:Type Button}}" TargetType="{x:Type Button}">
                                            <Style.Triggers>
                                                <DataTrigger Binding="{Binding Plugin.HasConfigForm}" Value="False">
                                                    <Setter Property="Visibility" Value="Hidden" />
                                                </DataTrigger>
                                            </Style.Triggers>
                                        </Style>
                                    </Button.Style>
                                    <Image Source="{com:Icon Path=/Ark Server Manager;component/Art/Settings.ico,Size=32}"/>
                                </Button>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                    <DataGridTemplateColumn Width="30" CanUserReorder="False" IsReadOnly="True">
                        <DataGridTemplateColumn.CellTemplate>
                            <DataTemplate>
                                <Button Width="22" Height="22" Margin="0" IsTabStop="False" HorizontalAlignment="Center" VerticalAlignment="Center" Click="RemovePlugin_Click" ToolTip="{DynamicResource PluginsWindow_RemovePluginTooltip}">
                                    <Image Source="{com:Icon Path=/Ark Server Manager;component/Art/Delete.ico,Size=32}"/>
                                </Button>
                            </DataTemplate>
                        </DataGridTemplateColumn.CellTemplate>
                    </DataGridTemplateColumn>
                </DataGrid.Columns>
            </DataGrid>
        </GroupBox>
    </Grid>
</Window>
