<UserControl x:Class="GitHub.VisualStudio.Views.Dialog.ForkRepositoryExecuteView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:ghfvs="https://github.com/github/VisualStudio"
             xmlns:markdig="clr-namespace:Markdig.Wpf;assembly=Markdig.Wpf"
             xmlns:sampleData="clr-namespace:GitHub.SampleData;assembly=GitHub.App"
             xmlns:ui="https://github.com/github/VisualStudio"
             VerticalAlignment="Top"
             Margin="8"
             xmlns:vs="clr-namespace:Microsoft.VisualStudio.PlatformUI;assembly=Microsoft.VisualStudio.Shell.14.0"
             Background="{DynamicResource {x:Static vs:ThemedDialogColors.WindowPanelBrushKey}}"
             Foreground="{DynamicResource {x:Static vs:ThemedDialogColors.WindowPanelTextBrushKey}}"
             mc:Ignorable="d" d:DesignWidth="300" Height="315.179">

    <Control.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="DialogStyles.xaml" />
            </ResourceDictionary.MergedDictionaries>

            <!-- Disable links until we make them work-->
            <Style TargetType="Hyperlink">
                <Setter Property="IsEnabled" Value="False"/>
            </Style>
        </ResourceDictionary>
    </Control.Resources>

  <d:DesignProperties.DataContext>
    <sampleData:ForkRepositoryExecuteViewModelDesigner/>
  </d:DesignProperties.DataContext>

  <StackPanel Margin="0 8 0 0">
    <TextBlock FontSize="16" TextWrapping="Wrap">
      You're about to fork the 
      <Hyperlink>
        <Run Text="{Binding SourceRepository.Owner, Mode=OneWay}"/>/<Run Text="{Binding SourceRepository.Name, Mode=OneWay}"/>
      </Hyperlink>
      repository to
      <Hyperlink>
        <Run Text="{Binding DestinationRepository.Owner, Mode=OneWay}"/>/<Run Text="{Binding DestinationRepository.Name, Mode=OneWay}"/>
      </Hyperlink>.
    </TextBlock>

    <TextBlock Margin="0 16 0 0" FontSize="14">This operation will:</TextBlock>

    <StackPanel Orientation="Vertical">
        <Border Margin="0 8 0 4" CornerRadius="2" Padding="8 16">
                <StackPanel>
                    <Grid Margin="0 0 0 0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <ui:OcticonImage Grid.Column="0" Icon="repo_forked" Height="16" Width="16" />
                        <TextBlock Margin="8 0 0 0" Grid.Column="1" TextWrapping="Wrap" Text="{x:Static ghfvs:Resources.ForkTheRepository}" />
                    </Grid>

                    <Grid Margin="0 16 0 0">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                    <ui:OcticonImage Grid.Column="0" Icon="home" Height="16" Width="16" />

                    <TextBlock Margin="8 0 0 0" Grid.Column="1" TextWrapping="Wrap">
                      <Run Text="{x:Static ghfvs:Resources.UpdateYourLocalRepositoryS}"/>
                      <Run Style="{DynamicResource {x:Static markdig:Styles.CodeStyleKey}}">origin</Run>
                      <Run Text="{x:Static ghfvs:Resources.ToPointTo}"/>
                      <Hyperlink><Run Text="{Binding DestinationRepository.CloneUrl, Mode=OneWay}"/></Hyperlink>
                     </TextBlock>
                    </Grid>
            
                    <Grid Margin="0 16 0 0" >
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>

                        <ui:OcticonImage Grid.Column="0" Icon="globe" Height="16" Width="16" />
                        <TextBlock Margin="8 0 0 0" Grid.Column="1" TextWrapping="Wrap">
                           Add an <Run Style="{DynamicResource {x:Static markdig:Styles.CodeStyleKey}}">upstream</Run> remote pointing to 
                           <Hyperlink><Run Text="{Binding SourceRepository.CloneUrl, Mode=OneWay}"/></Hyperlink>
                        </TextBlock>
                    </Grid>
                </StackPanel>
        </Border>

        <TextBlock TextWrapping="Wrap"
                   Margin="0 4" 
                   Foreground="Red" 
                   Text="{Binding Error, Mode=OneWay}"
                   Visibility="{Binding Error, Converter={ui:NullToVisibilityConverter}}" 
                   HorizontalAlignment="Left" />
        <StackPanel Margin="0 8" Orientation="Horizontal" HorizontalAlignment="Right">
          <Button HorizontalAlignment="Right" Padding="16 4" Margin="0 0 4 0" Command="{Binding BackCommand}" Content="{x:Static ghfvs:Resources.Back}"/>
          <Button HorizontalAlignment="Right" Padding="16 4" Command="{Binding CreateFork}" Content="{x:Static ghfvs:Resources.ForkRepository}"/>
        </StackPanel>
    </StackPanel>
  </StackPanel>
</UserControl>
