<?xml version="1.0" encoding="utf-8"?>
<UserControl x:Class="UploadFiles.Page" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:c1="http://schemas.componentone.com/winfx/2006/xaml">
	<UserControl.Resources>

		<Style x:Key="LabelFile" TargetType="TextBlock">
			<Setter Property="FontSize" Value="10" />
			<Setter Property="Margin" Value="4 2 1 1" />
			<Setter Property="TextAlignment" Value="Left" />
			<Setter Property="Width" Value="120" />
		</Style>

		<Style x:Key="LabelTitle" TargetType="TextBlock">
			<Setter Property="FontSize" Value="10" />
			<Setter Property="FontWeight" Value="Bold" />
			<Setter Property="TextAlignment" Value="Center" />
			<Setter Property="TextWrapping" Value="Wrap" />
		</Style>

		<Style x:Key="Label" TargetType="TextBlock">
			<Setter Property="FontSize" Value="10" />
			<Setter Property="TextAlignment" Value="Center" />
			<Setter Property="TextWrapping" Value="Wrap" />
		</Style>

		<Style x:Key="Face" TargetType="Border">
			<Setter Property="BorderBrush" Value="Black" />
			<Setter Property="BorderThickness" Value="1.5" />
		</Style>

		<Style x:Key="Combo" TargetType="c1:C1ComboBox">
			<Setter Property="Margin" Value="0 0 0 10" />
			<Setter Property="FontSize" Value="11" />
			<Setter Property="Width" Value="200" />
			<Setter Property="Height" Value="25" />
			<Setter Property="IsEditable" Value="False" />
			<Setter Property="AutoComplete" Value="False" />
		</Style>

		<Style x:Key="EndPoint" TargetType="FrameworkElement">
			<Setter Property="Width" Value="160" />
			<Setter Property="MinHeight" Value="160" />
		</Style>

		<SolidColorBrush x:Key="DisabledBrush" Color="Gray" />
		<Style x:Key="DisabledStyle" TargetType="Rectangle">
			<Setter Property="RadiusX" Value="1" />
			<Setter Property="RadiusY" Value="1" />
			<Setter Property="Opacity" Value="0.92" />
			<Setter Property="IsHitTestVisible" Value="False" />
			<Setter Property="StrokeThickness" Value="0" />
			<Setter Property="Stroke" Value="{StaticResource DisabledBrush}" />
			<Setter Property="Fill" Value="{StaticResource DisabledBrush}" />
		</Style>

	</UserControl.Resources>
	<Grid>
		<StackPanel Background="White">
			<Border Background="DarkBlue" BorderBrush="Lavender" BorderThickness="2" Width="500" Margin="0 20 0 0">
				<StackPanel Margin="20 20 20 20" HorizontalAlignment="Left">
					<TextBlock Text="When you choose an Upload method from the Client, you are also choosing how the files are going to be handled in the Server." FontSize="12" Foreground="Lavender" TextWrapping="Wrap" />
					<TextBlock Text="For each type, the C1Uploader might expect a different handler or method in the server." FontSize="12" Foreground="Lavender" TextWrapping="Wrap" Margin="0 10 0 0" />					
				</StackPanel>
			</Border>

			<Grid x:Name="LayoutRoot" Margin="10 10 10 10">
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="Auto" />
					<ColumnDefinition MinWidth="10" Width="*" />
					<ColumnDefinition Width="Auto" />
				</Grid.ColumnDefinitions>
				<Grid.RowDefinitions>
					<RowDefinition Height="Auto" />
					<RowDefinition Height="160" />
					<RowDefinition Height="*" />
				</Grid.RowDefinitions>

				<!-- Progress bar -->
				<Grid Grid.Column="1" Grid.Row="1">
					<!-- Proceed to upload -->
					<StackPanel>
						<StackPanel Orientation="Horizontal" VerticalAlignment="Bottom" HorizontalAlignment="Center">
							<Grid Width="30" Height="30">
								<Ellipse Fill="Black" Stroke="White" StrokeThickness="2" />
								<TextBlock Text="3" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White" FontSize="18" />
							</Grid>
							<TextBlock Text="Call the BeginUpload method" FontSize="10" Width="120" TextWrapping="Wrap" Margin="5 0 0 0" />
						</StackPanel>
						<Button Content="Begin upload" Width="100" Height="30" Click="Upload_Click" />
					</StackPanel>
					<Border BorderBrush="Black" BorderThickness="1" Background="LightBlue" Height="7.5" Margin="-5 0 -5 0" />
				</Grid>

				<!-- Client -->
				<TextBlock Grid.Row="0" Text="Client" Style="{StaticResource LabelTitle}" Foreground="Blue" />
				<StackPanel Grid.Column="0" Grid.Row="1" Grid.RowSpan="2">
					<Border x:Name="Client" Background="LightGoldenrodYellow" VerticalAlignment="Top" Width="160" MinHeight="160" BorderBrush="Black" BorderThickness="1.5">
						<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
							<StackPanel Orientation="Vertical">
								<StackPanel Orientation="Horizontal">
									<Grid Grid.Row="0" Width="30" Height="30" VerticalAlignment="Bottom" HorizontalAlignment="Left">
										<Ellipse Fill="Black" Stroke="White" StrokeThickness="2" />
										<TextBlock Text="1" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White" FontSize="18" />
									</Grid>
									<TextBlock Text="Add a FilePicker in the Client" Width="80" FontSize="10" TextWrapping="Wrap" Margin="5 0 0 0" />
								</StackPanel>
								<c1:C1FilePicker x:Name="filePicker" VerticalAlignment="Top" Margin="0 20 0 0" FontSize="11" Watermark="Pick files..." SelectedFilesChanged="C1FilePicker_SelectedFilesChanged" Multiselect="True" />
							</StackPanel>
					</StackPanel>
					</Border>
				</StackPanel>
				<ItemsControl Grid.Row="2" Grid.Column="0" x:Name="selectedFiles" Background="Wheat" Margin="0 5 0 0">
					<ItemsControl.ItemTemplate>
						<DataTemplate>
							<TextBlock Text="{Binding Name}" Style="{StaticResource LabelFile}" />
					</DataTemplate>
					</ItemsControl.ItemTemplate>
				</ItemsControl>

				<!-- Server -->
				<StackPanel Grid.Row="0" Grid.Column="2">
					<TextBlock Text="Server" Style="{StaticResource LabelTitle}" Foreground="Blue" />
					<TextBlock Text="(details in the following file)" Style="{StaticResource LabelTitle}" Foreground="Blue" />
				</StackPanel>
				<StackPanel Grid.Row="1" Grid.RowSpan="2" Grid.Column="2">
					<Grid x:Name="Server" Style="{StaticResource EndPoint}">
                        <Border x:Name="server_OneFilePerRequest_WebService" Background="LightGoldenrodYellow" Style="{StaticResource Face}">
							<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
								<TextBlock Text="WebService.asmx" Style="{StaticResource LabelTitle}" />
								<TextBlock Text="UploadFile" Style="{StaticResource Label}" />
							</StackPanel>
						</Border>
                        <Border x:Name="server_AllFilesInOneRequest_WebService" Background="LightSalmon" Style="{StaticResource Face}">
							<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
								<TextBlock Text="WebService.asmx" Style="{StaticResource LabelTitle}" />
								<TextBlock Text="UploadFiles" Style="{StaticResource Label}" />
							</StackPanel>
						</Border>
                        <Border x:Name="server_SplitFilesIntoMultipleRequests_WebService" Background="LightCoral" Style="{StaticResource Face}">
							<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
								<TextBlock Text="WebService.asmx" Style="{StaticResource LabelTitle}" />
								<TextBlock Text="UploadFile" Style="{StaticResource Label}" />
							</StackPanel>
						</Border>
                        <Border x:Name="server_OneFilePerRequest_MultiPartHost" Background="LightBlue" Style="{StaticResource Face}">
							<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
								<TextBlock Text="Handler.ashx" Style="{StaticResource LabelTitle}" />
								<TextBlock Text="------------" Style="{StaticResource Label}" />
							</StackPanel>
						</Border>
                        <Border x:Name="server_AllFilesInOneRequest_MultiPartHost" Background="LightGreen" Style="{StaticResource Face}">
							<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
								<TextBlock Text="Handler.ashx" Style="{StaticResource LabelTitle}" />
								<TextBlock Text="------------" Style="{StaticResource Label}" />
							</StackPanel>
						</Border>
                        <Border x:Name="server_SplitFilesIntoMultipleRequests_MultiPartHost" Background="LightPink" Style="{StaticResource Face}">
							<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center">
								<TextBlock Text="MergeHandler.ashx" Style="{StaticResource LabelTitle}" />
								<TextBlock Text="-----------------" Style="{StaticResource Label}" />
							</StackPanel>
						</Border>
                    </Grid>
				</StackPanel>
				<ItemsControl x:Name="uploadedFiles" Grid.Row="2" Grid.Column="2" Margin="0 5 0 0" HorizontalAlignment="Left" />

				<!-- Configuration -->
				<StackPanel Grid.Row="2" Grid.Column="1" Margin="25 5 25 5" VerticalAlignment="Top">

					<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0 0 0 15">
						<Grid Width="30" Height="30" VerticalAlignment="Bottom" HorizontalAlignment="Center">
							<Ellipse Fill="Black" Stroke="White" StrokeThickness="2" />
							<TextBlock Text="2" VerticalAlignment="Center" HorizontalAlignment="Center" Foreground="White" FontSize="18" />
						</Grid>
						<TextBlock Text="Create a new C1Uploader and configure it" FontSize="10" TextWrapping="Wrap" Width="160" Margin="5 0 0 0" />
					</StackPanel>

					<!-- Address -->
					<TextBlock Text="Address:" Style="{StaticResource LabelTitle}" />
				<TextBox x:Name="txtAddress" FontSize="11" Width="200" Margin="0 0 0 10" />
				
				<!-- Communication method -->
				<TextBlock Text="Communication method:" Style="{StaticResource LabelTitle}" />
				<c1:C1ComboBox x:Name="cboCommunication" SelectedIndex="0" SelectedItemChanged="cboCommunication_SelectedItemChanged" Style="{StaticResource Combo}" />
				
				<!-- Request per File -->
				<TextBlock Text="Files per request:" Style="{StaticResource LabelTitle}" />
				<c1:C1ComboBox x:Name="cboRequests" SelectedIndex="0" SelectedItemChanged="cboRequests_SelectedItemChanged" Style="{StaticResource Combo}" />

				<!-- MaximumUploadSize -->
				<TextBlock Text="Maximum size of each request (KB):" Style="{StaticResource LabelTitle}" />
				<c1:C1NumericBox x:Name="numMaxUploadSize" Value="100" AllowNull="True" FontSize="11" Width="200" />

				<!-- Description -->
				<Border Background="AliceBlue" BorderBrush="Lavender" BorderThickness="2" Margin="0 20 0 0">
					<TextBlock x:Name="txtDescription" Text="This method will..." FontSize="11" Foreground="DarkBlue" HorizontalAlignment="Center" TextWrapping="Wrap" Margin="20 20 20 20" />
				</Border>			
			</StackPanel>
			</Grid>
		</StackPanel>

		<Grid x:Name="rectDisabled" Visibility="Collapsed">
			<Rectangle Style="{StaticResource DisabledStyle}" />
			<StackPanel VerticalAlignment="Center">
				<TextBlock Text="Uploading..." Foreground="Black" FontSize="24" FontWeight="Bold" TextAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center" />
				<TextBlock x:Name="txtUploadPct" Foreground="Black" FontSize="24" FontWeight="Bold" TextAlignment="Center" VerticalAlignment="Center" HorizontalAlignment="Center" />
			</StackPanel>
		</Grid>
	</Grid>
</UserControl>