<WindowsAPICodePackShell:GlassWindow x:Class="Hiyoko.Forms.MainForm" x:Name="this"
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:WindowsAPICodePackPresentation="clr-namespace:Microsoft.WindowsAPICodePack.Controls.WindowsPresentationFoundation;assembly=Microsoft.WindowsAPICodePack.Shell"
	xmlns:WindowsAPICodePackShell="clr-namespace:Microsoft.WindowsAPICodePack.Shell;assembly=Microsoft.WindowsAPICodePack.Shell"
	xmlns:c="clr-namespace:Hiyoko"
	xmlns:local="clr-namespace:Hiyoko.Forms"
	xmlns:HiyokoUtilities="clr-namespace:Hiyoko.Utilities"
	xmlns:NetCache="clr-namespace:System.Net.Cache"
	Title="Hiyoko - A Twitter Client" Height="640" Width="640"
	ResizeMode="CanResizeWithGrip" FontSize="12">
	<Window.Resources>
		<ResourceDictionary>
			<ResourceDictionary.MergedDictionaries>
				<ResourceDictionary Source="/PresentationFramework.Aero, Version=3.0.0.0, Culture=Neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL;component/themes/aero.normalcolor.xaml" />
				<ResourceDictionary Source="/Hiyoko;component/forms/generic.xaml" />
			</ResourceDictionary.MergedDictionaries>
			
			<ObjectDataProvider x:Key="networkJobServerProvider"></ObjectDataProvider>
			
			<DataTemplate x:Key="outputItemTemplate">
				<DockPanel>
					<Image DockPanel.Dock="Left" Source="{Binding Converter={StaticResource OutputItemToImageSourceConverter}}" Width="15" Height="15" />
					<TextBlock DockPanel.Dock="Right" Text="{Binding Path=DateTime, Converter={StaticResource DateTimeToStringConverter}}" />
					<TextBlock Text="{Binding Text}" TextTrimming="CharacterEllipsis" TextWrapping="WrapWithOverflow" />
				</DockPanel>
			</DataTemplate>  
			<Style x:Key="outputListBoxStyle" TargetType="{x:Type ListBox}" BasedOn="{StaticResource {x:Type ListBox}}">
				<Setter Property="HorizontalContentAlignment" Value="Stretch" />
				<Setter Property="ItemTemplate" Value="{DynamicResource outputItemTemplate}" />  
				<Setter Property="Background" Value="#00000000" />  
				<Setter Property="ItemsPanel">
					<Setter.Value>
						<ItemsPanelTemplate>
							<VirtualizingStackPanel Orientation="Vertical" />
						</ItemsPanelTemplate>
					</Setter.Value>
				</Setter>
			</Style>
			
			<!-- for .NetFx 4.0
			<Style TargetType="{x:Type TextBoxBase}">
				<Style.Triggers>
					<Trigger Property="InputMethod.ImeState" Value="On">
						<Setter Property="CaretBrush" Value="Red" />
					</Trigger>
				</Style.Triggers>
			</Style>
			-->
			<!--<Style TargetType="{x:Type MenuItem}">
				<Style.Triggers>
					<Trigger Property="IsVisible" Value="true">
						<Setter Property="InputGestureText"
								Value="{Binding RelativeSource={RelativeSource Self}, Path=Command,
										Converter={StaticResource CommandToInputGestureTextConverter}}" />
					</Trigger>
				</Style.Triggers>
			</Style>-->
		</ResourceDictionary>
	</Window.Resources>
	<Window.CommandBindings>
		<CommandBinding Command="c:HiyokoCommands.Close" Executed="Close_Executed" CanExecute="Close_CanExecute"/>
		<CommandBinding Command="c:HiyokoCommands.Exit" Executed="Exit_Executed" CanExecute="Exit_CanExecute"/>
		<CommandBinding Command="c:HiyokoCommands.About" Executed="About_Executed" CanExecute="About_CanExecute"/>
		<CommandBinding Command="c:HiyokoCommands.Settings" Executed="Settings_Executed" CanExecute="Settings_CanExecute"/>
		<!--<CommandBinding Command="c:HiyokoCommands.SaveTimeline" Executed="SaveTimeline_Executed" CanExecute="SaveTimeline_CanExecute"/>-->
		<CommandBinding Command="c:HiyokoCommands.OpenTwitterCom" Executed="OpenTwitterCom_Executed" CanExecute="OpenTwitterCom_CanExecute"/>
		<CommandBinding Command="c:HiyokoCommands.OpenMyHome" Executed="OpenMyHome_Executed" CanExecute="OpenMyHome_CanExecute"/>
		<CommandBinding Command="c:HiyokoCommands.AbortCommunication" Executed="AbortCommunication_Executed" CanExecute="AbortCommunication_CanExecute"/>
		<CommandBinding Command="c:HiyokoCommands.Refresh" Executed="CurrentTabItem_Executed" CanExecute="CurrentTabItem_CanExecute"/>
		<CommandBinding Command="c:HiyokoCommands.RefreshAccountInfo" Executed="RefreshAccountInfo_Executed" CanExecute="RefreshAccountInfo_CanExecute"/>
		<CommandBinding Command="c:HiyokoCommands.CheckUpdates" Executed="CheckUpdates_Executed" CanExecute="CheckUpdates_CanExecute"/>
		<!--<CommandBinding Command="c:HiyokoCommands.NextPage" Executed="CurrentTabItem_Executed" CanExecute="CurrentTabItem_CanExecute"/>
		<CommandBinding Command="c:HiyokoCommands.PreviousPage" Executed="CurrentTabItem_Executed" CanExecute="CurrentTabItem_CanExecute"/>
		<CommandBinding Command="c:HiyokoCommands.FirstPage" Executed="CurrentTabItem_Executed" CanExecute="CurrentTabItem_CanExecute"/>-->
	</Window.CommandBindings>
	<!--<WindowsAPICodePackShell:GlassWindow.Style>
		<Style TargetType="WindowsAPICodePackShell:GlassWindow">
			<Style.Triggers>
				<DataTrigger Binding="{Binding ElementName=this, Path=Account.IsVerified}" Value="true">
					<Setter Property="Icon"
						Value="{Binding ElementName=this, Path=Account.User.ProfileImageUrl, Converter={StaticResource UrlToImageSourceConverter}}" />
				</DataTrigger>
			</Style.Triggers>
		</Style>
	</WindowsAPICodePackShell:GlassWindow.Style>-->
	<Grid Background="{DynamicResource WindowBrush}" SnapsToDevicePixels="true">
		<Grid.RowDefinitions>
			<RowDefinition Height="*" />
			<RowDefinition Height="auto" />
			<RowDefinition Height="auto" />
			<RowDefinition Name="outputListRow" Height="64" />
			<RowDefinition Height="auto" />
		</Grid.RowDefinitions>
		
		<TabControl Grid.Row="0" Name="mainTabControl">
			<TabControl.Template>
				<ControlTemplate TargetType="{x:Type TabControl}">
					<Grid KeyboardNavigation.TabNavigation="Local">
						<Grid.RowDefinitions>
							<RowDefinition Height="Auto"/>
							<RowDefinition Height="*"/>
						</Grid.RowDefinitions>
						<Grid Grid.Row="0">
							<Grid.ColumnDefinitions>
								<ColumnDefinition Width="auto" />
								<ColumnDefinition Width="*" />
							</Grid.ColumnDefinitions>
							<Menu>
								<MenuItem Header="ファイル(_F)">
									<MenuItem Header="twitter.comを開く(_T)..." Command="c:HiyokoCommands.OpenTwitterCom" />
									<MenuItem Header="自分のホームを開く(_H)..." Command="c:HiyokoCommands.OpenMyHome" />
									<Separator />
									<!--<MenuItem Header="タイムラインを保存(_A)..." Command="c:HiyokoCommands.SaveTimeline" />
									<Separator/>-->
									<MenuItem Header="設定(_S)..." Command="c:HiyokoCommands.Settings" />
									<Separator/>
									<MenuItem Header="ウインドウを閉じる(_C)" Command="c:HiyokoCommands.Close" />
									<MenuItem Header="終了(_X)" Command="c:HiyokoCommands.Exit" />
								</MenuItem>
								<MenuItem Header="表示(_V)">
									<MenuItem Header="アカウント情報を更新(_I)" Command="c:HiyokoCommands.RefreshAccountInfo" />
									<Separator/>
									<MenuItem Header="更新(_R)" Command="c:HiyokoCommands.Refresh" />
									<Separator/>
									<MenuItem Header="最初のページ(_F)" Command="c:HiyokoCommands.FirstPage" />
									<MenuItem Header="前のページ(_P)" Command="c:HiyokoCommands.PreviousPage" />
									<MenuItem Header="次のページ(_N)" Command="c:HiyokoCommands.NextPage" />
									<Separator/>
									<MenuItem Header="通信を中止する(_C)" Command="c:HiyokoCommands.AbortCommunication" />
								</MenuItem>
								<MenuItem Header="ヘルプ(_H)">
									<MenuItem Header="アップデートを確認(_U)..." Command="c:HiyokoCommands.CheckUpdates" />
									<Separator />
									<MenuItem Header="Hiyokoについて(_A)..." Command="c:HiyokoCommands.About" />
								</MenuItem>
							</Menu>
							<TabPanel
								Name="HeaderPanel" Grid.Column="1" Panel.ZIndex="1" 
								Margin="8,2,4,1" IsItemsHost="True"
								KeyboardNavigation.TabIndex="1"
								Background="Transparent" />
						</Grid>
						<Border 
							Name="Border" Grid.Row="1"
							Background="{Binding ElementName=mainTabControl, Path=Background}"
							KeyboardNavigation.TabNavigation="Local"
							KeyboardNavigation.DirectionalNavigation="Contained"
							KeyboardNavigation.TabIndex="2" >
							<ContentPresenter 
								Name="PART_SelectedContentHost"
								Margin="4"
								ContentSource="SelectedContent" />
						</Border>
					</Grid>
				</ControlTemplate>
			</TabControl.Template>
			<TabItem Name="timelineTabItem">
				<TabItem.Header>
					<AccessText Text="ホーム(_1)" />
				</TabItem.Header>
				<local:MainFormTimelinePanel x:Name="timelinePanel"
					Account="{Binding Path=Account, ElementName=this}"/>
			</TabItem>
			<TabItem Name="usersTabItem">
				<TabItem.Header>
					<AccessText Text="ユーザー(_2)" />
				</TabItem.Header>
				<local:MainFormUsersPanel x:Name="usersPanel"
					Account="{Binding Path=Account, ElementName=this}" />
			</TabItem>
		</TabControl>
		
		<GridSplitter Grid.Row="1" Height="3" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
		
		<Grid Grid.Row="2" Background="{DynamicResource {x:Static SystemColors.InfoBrushKey}}" Visibility="Collapsed" Name="availableUpdatesPanel">
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="*"/>
				<ColumnDefinition Width="auto"/>
				<ColumnDefinition Width="auto"/>
			</Grid.ColumnDefinitions>
			<TextBlock Grid.Column="0" Name="availableUpdatesMessageBlock" VerticalAlignment="Center"/>
			<Button Grid.Column="1" Click="UpdateClick" Margin="4">更新する</Button>
			<Button Grid.Column="2" Click="DontUpdateClick" Margin="4">更新しない</Button>
		</Grid>
		
		<Grid Grid.Row="3" Background="{DynamicResource ControlBrush}">
			<Grid.RowDefinitions>
				<RowDefinition Height="auto" />
				<RowDefinition Height="*" />
			</Grid.RowDefinitions>
			
			<Label Grid.Row="0" Target="{Binding ElementName=outputList}">アウトプット(_O):</Label>
			<ListBox Grid.Row="1" ItemsSource="{Binding}" Name="outputList"
				Style="{DynamicResource outputListBoxStyle}" BorderThickness="0"> 
			</ListBox>
		</Grid>
		<Grid Grid.Row="4" Background="{DynamicResource ControlBrush}">
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="*"/>
				<ColumnDefinition Width="auto"/>
				<ColumnDefinition Width="auto"/>
			</Grid.ColumnDefinitions>
			
			<TextBlock Grid.Column="0" Name="statusBarMessageBlock" Margin="4" VerticalAlignment="Center"/>
			<StackPanel Name="accountStatuses" Grid.Column="1" Orientation="Horizontal" VerticalAlignment="Center">
				<TextBlock Text="フォロー： " />
				<TextBlock Text="{Binding Path=User.FriendsCount}" />
				<TextBlock Margin="8,0,0,0" Text="フォロワー： " />
				<TextBlock Text="{Binding Path=User.FollowersCount}" />
				<TextBlock Margin="8,0,0,0" Text="お気に入り： " />
				<TextBlock Text="{Binding Path=User.FavouritesCount}" />
				<TextBlock Margin="8,0,0,0" Text="現在地： " />
				<TextBlock Text="{Binding Path=User.Location}" />
				<TextBlock Margin="8,0,0,0" Text="タイムゾーン： " />
				<TextBlock Text="{Binding Path=User.TimeZone}" />
			</StackPanel>
			<Grid Grid.Column="2">
				<Grid.Style>
					<Style TargetType="Grid">
						<Style.Triggers>
							<DataTrigger Binding="{Binding Source={StaticResource networkJobServerProvider}, Path=IsBusy}" Value="True">
								<Setter Property="Visibility" Value="Visible" />
							</DataTrigger>
							<DataTrigger Binding="{Binding Source={StaticResource networkJobServerProvider}, Path=IsBusy}" Value="False">
								<Setter Property="Visibility" Value="Hidden" />
							</DataTrigger>
						</Style.Triggers>
					</Style>
				</Grid.Style>
				<ProgressBar Name="NetworkJobServerProgressBar" IsIndeterminate="true" Value="50"></ProgressBar>
				<StackPanel Orientation="Horizontal" Margin="4">
					<TextBlock Text="通信中 残りジョブ数: " />
					<TextBlock Text="{Binding Source={StaticResource networkJobServerProvider}, Path=JobCount}" />
				</StackPanel>
			</Grid>
		</Grid>
	</Grid>
</WindowsAPICodePackShell:GlassWindow>