<local:GenericGitHubPaneView x:Class="GitHub.VisualStudio.Views.GitHubPane.GitHubPaneView"
             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:ghfvs="https://github.com/github/VisualStudio"
             xmlns:views="clr-namespace:GitHub.VisualStudio.Views"
             xmlns:local="clr-namespace:GitHub.VisualStudio.Views.GitHubPane"
             xmlns:uic="clr-namespace:GitHub.VisualStudio.UI.Controls"
             Background="{DynamicResource GitHubVsToolWindowBackground}"
             Foreground="{DynamicResource GitHubVsWindowText}"
             d:DesignHeight="300"
             d:DesignWidth="300"
             mc:Ignorable="d">
  <Control.Resources>
    <ResourceDictionary>
      <ResourceDictionary.MergedDictionaries>
        <ghfvs:SharedDictionaryManager Source="pack://application:,,,/GitHub.VisualStudio.UI;component/SharedDictionary.xaml" />
        <ghfvs:SharedDictionaryManager Source="pack://application:,,,/GitHub.UI;component/SharedDictionary.xaml" />
      </ResourceDictionary.MergedDictionaries>
      <Style x:Key="PaneHorizontalSeparator" TargetType="{x:Type Separator}">
        <Setter Property="Background" Value="{DynamicResource GitHubHeaderSeparatorBrush}" />
        <Setter Property="Height" Value="2" />
        <Setter Property="SnapsToDevicePixels" Value="True" />
        <Setter Property="Template">
          <Setter.Value>
            <ControlTemplate TargetType="{x:Type Separator}">
              <Border Width="{TemplateBinding Width}"
                      Background="{TemplateBinding Background}"
                      BorderBrush="{TemplateBinding Background}"
                      SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" />
            </ControlTemplate>
          </Setter.Value>
        </Setter>
      </Style>
      <views:ViewLocator x:Key="viewLocator"/>
      <DataTemplate DataType="{x:Type ghfvs:ViewModelBase}">
        <ContentControl Content="{Binding Converter={StaticResource viewLocator}}"/>
      </DataTemplate>
    </ResourceDictionary>
  </Control.Resources>

  <DockPanel>
    <uic:InfoPanel x:Name="infoPanel"
                   DockPanel.Dock="Top"
                   Message="{Binding Message}"
                   ShowCloseButton="True"
                   VerticalAlignment="Top"/>
    <StackPanel DockPanel.Dock="Top"
                Margin="6,9,9,5"
                Orientation="Horizontal">
      <TextBlock Margin="0,-5,0,0"
                 FontSize="14.7"
                 FontWeight="SemiBold"
                 Foreground="{DynamicResource GitHubPaneTitleBrush}"
                 Text="{Binding Title}" />
      <Separator Margin="5,-2,5,0"
                 Foreground="{DynamicResource GitHubPaneTitleBrush}"
                 Style="{StaticResource TitleVerticalSeparator}" />
            <ghfvs:GitHubActionLink Margin="0,-2.5,0,0" Command="{Binding BrowseRepository}" Content="{Binding LocalRepository.Name}" />
        </StackPanel>

    <Separator Margin="0,0,0,2"
               DockPanel.Dock="Top"
               Style="{StaticResource PaneHorizontalSeparator}" />

    <Grid>
      <DockPanel Visibility="{Binding ContentOverride, Converter={ghfvs:EqualsToVisibilityConverter None}}">
        <ghfvs:GitHubProgressBar DockPanel.Dock="Top"
                             IsIndeterminate="True"
                             Style="{DynamicResource GitHubProgressBar}"
                             Visibility="{Binding Content.Content.IsBusy, Converter={ghfvs:BooleanToHiddenVisibilityConverter}, FallbackValue=Hidden}"/>
        <ContentControl Content="{Binding Content}"/>
      </DockPanel>
      <ghfvs:Spinner Width="48"
                  Height="48"
                  HorizontalAlignment="Center"
                  VerticalAlignment="Center"
                  Visibility="{Binding ContentOverride, Converter={ghfvs:EqualsToVisibilityConverter Spinner}, FallbackValue=Collapsed}"/>
      <Border HorizontalAlignment="Stretch"
              VerticalAlignment="Stretch"
              Visibility="{Binding ContentOverride, Converter={ghfvs:EqualsToVisibilityConverter Error}, FallbackValue=Collapsed}">
        <StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
          <ghfvs:OcticonImage Icon="alert" Width="32" Height="32" Margin="8"/>
          <TextBlock Text="{Binding Content.Content.Error.Message}" TextAlignment="Center" TextWrapping="Wrap"/>
        </StackPanel>
      </Border>
    </Grid>
  </DockPanel>
</local:GenericGitHubPaneView>
