<Window x:Class="Immense.RemoteControl.Desktop.UI.WPF.Views.FileTransferWindow"
        x:Name="ThisWindow"
        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:local="clr-namespace:Immense.RemoteControl.Desktop.UI.WPF.Views"
        xmlns:vm="clr-namespace:Immense.RemoteControl.Desktop.UI.WPF.ViewModels"
        xmlns:fakes="clr-namespace:Immense.RemoteControl.Desktop.UI.WPF.ViewModels.Fakes"
        mc:Ignorable="d"
        Title="File Transfer"
        Height="300" Width="400" 
        Topmost="True"
        ContentRendered="Window_ContentRendered"
        d:DataContext="{d:DesignInstance Type=fakes:FakeFileTransferWindowViewModel, IsDesignTimeCreatable=True}"
        Icon="{Binding Icon}">

    <Window.Resources>
        <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="/Immense.RemoteControl.Desktop.UI.WPF;component/Resources/Styles.xaml" />
            </ResourceDictionary.MergedDictionaries>
        </ResourceDictionary>
    </Window.Resources>
    
    <Grid Margin="10">
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        
        <TextBlock FontWeight="Bold" FontSize="16" Grid.Row="0">
            <Run>Upload files to</Run>
            <Run Text="{Binding ViewerName}"></Run>
        </TextBlock>

        <TextBlock Grid.Row="1" Margin="0,10,0,0">
            Current Uploads:
        </TextBlock>

        <Border Grid.Row="2" Margin="0,5,0,0" BorderBrush="LightGray" BorderThickness="1">
            <ScrollViewer >
                <ItemsControl ItemsSource="{Binding FileUploads}">
                    <ItemsControl.ItemTemplate>
                        <DataTemplate>
                            <StackPanel HorizontalAlignment="Stretch" Margin="0,0,5,0">
                                <TextBlock Text="{Binding DisplayName, StringFormat={}{0}:}" Margin="0,0,0,2"></TextBlock>
                                <Grid Margin="0,0,0,10">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition />
                                        <ColumnDefinition Width="Auto" />
                                    </Grid.ColumnDefinitions>
                                    <ProgressBar Value="{Binding PercentProgress}" Maximum="1" LargeChange="0.01" Height="18"></ProgressBar>
                                    <Button Grid.Column="1"
                                            VerticalAlignment="Top"
                                            Command="{Binding DataContext, ElementName=ThisWindow}" 
                                            CommandParameter="{Binding}" 
                                            Content="x"
                                            Style="{StaticResource NormalButton}" 
                                            BorderThickness="0" />
                                </Grid>
                            </StackPanel>
                        </DataTemplate>
                    </ItemsControl.ItemTemplate>
                </ItemsControl>
            </ScrollViewer>
        </Border>

        <Button Grid.Row="3" Margin="0,10,0,0" Height="60" Style="{StaticResource NormalButton}" Command="{Binding OpenFileDialogCommand}">
            Click here to upload files.
        </Button>
    </Grid>
</Window>
