<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
		xmlns:ours="clr-namespace:FSClient.Controls" xmlns:local="clr-namespace:FSClient" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:Controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit" mc:Ignorable="d" x:Class="FSClient.MainWindow"
        Title="FSClient" Height="319" Width="666"  WindowStyle="SingleBorderWindow" ResizeMode="CanMinimize" Closing="Window_Closing" Icon="phone.ico">
	<Window.Resources>
		<local:DurationTimeConverter x:Key="DurationTimeConverter"/>
		<local:ShortDateTimeConverter x:Key="ShortDateTimeConverter"/>
		<local:StateConverter x:Key="StateConverter" />
		<local:DirectionConverter x:Key="DirectionConverter" />
		<local:AccountDefaultConverter x:Key="AccountDefaultConverter" />
		<local:EnglishDirectionConverter x:Key="EnglishDirectionConverter" />
		<ToolTip x:Key="mainCallTooltip">
			<Grid>
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="Auto"/>
					<ColumnDefinition Width="*"/>
				</Grid.ColumnDefinitions>
				<Grid.RowDefinitions>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
					<RowDefinition Height="Auto"/>
				</Grid.RowDefinitions>
				<Border HorizontalAlignment="Stretch" BorderThickness="0,0,0,1" BorderBrush="Black" Margin="5"  Grid.Column="0"  Grid.Row="0" Grid.ColumnSpan="2">
					<StackPanel Orientation="Horizontal">
						<TextBlock FontSize="14" Text="{Binding Path=state}" />
						<TextBlock FontSize="14" Margin="5,0,0,0" Text="{Binding is_outgoing, Converter={StaticResource EnglishDirectionConverter}}" />
						<TextBlock FontSize="14" Text=" Call " />
						<TextBlock FontSize="14" Text="{Binding other_party_name}" />
					</StackPanel>
				</Border>
				<TextBlock Grid.Column="0" Grid.Row="1" Margin="10,0,5,0" TextAlignment="Right">Number:</TextBlock>
				<TextBlock Grid.Column="1" Grid.Row="1" FontWeight="Bold" Text="{Binding other_party_number}"/>
				<TextBlock Grid.Column="0" Grid.Row="2" Margin="10,0,5,0" TextAlignment="Right">Start Time:</TextBlock>
				<TextBlock Grid.Column="1" Grid.Row="2" FontWeight="Bold" Text="{Binding start_time, Converter={StaticResource ShortDateTimeConverter}}"/>
				<TextBlock Grid.Column="0" Grid.Row="3" Margin="10,0,5,0" TextAlignment="Right">End Time:</TextBlock>
				<TextBlock Grid.Column="1" Grid.Row="3" FontWeight="Bold" Text="{Binding end_time, Converter={StaticResource ShortDateTimeConverter}}"/>
				<TextBlock Grid.Column="0" Grid.Row="4" Margin="10,0,5,0" TextAlignment="Right">Duration:</TextBlock>
				<TextBlock Grid.Column="1" Grid.Row="4" FontWeight="Bold" Text="{Binding duration, Converter={StaticResource DurationTimeConverter}}"/>
				<TextBlock Grid.Column="0" Grid.Row="5" Margin="10,0,5,0" TextAlignment="Right">Account:</TextBlock>
				<TextBlock Grid.Column="1" Grid.Row="5" FontWeight="Bold" Text="{Binding account}"/>
				<TextBlock Grid.Column="0" Grid.Row="6" Margin="10,0,5,0" TextAlignment="Right">Note:</TextBlock>
				<TextBlock Grid.Column="1" Grid.Row="6" FontWeight="Bold" Text="{Binding note}"/>
				<TextBlock Grid.Column="0" Grid.Row="7" Margin="10,0,5,0" TextAlignment="Right">Keys:</TextBlock>
				<TextBlock Grid.Column="1" Grid.Row="7" FontWeight="Bold" Text="{Binding dtmfs}"/>				
				
			</Grid>
		</ToolTip>

	</Window.Resources>
    <Canvas Background="#FF1A207E" x:Name="mainControl">
		<Border x:Name="borderCalls" BorderThickness="2" BorderBrush="Black" Background="#FF000341" Height="271" Canvas.Left="4" Canvas.Top="12" Width="227" d:LayoutOverrides="VerticalAlignment">
			<Grid d:IsLocked="True">
				<Grid.RowDefinitions>
					<RowDefinition Height="20" />
					<RowDefinition Height="*" />
				</Grid.RowDefinitions>
				<TextBlock Foreground="White" Text="Calls" Margin="5,0,0,0" FontWeight="Bold" FontSize="13.333" />
				<DataGrid Grid.Row="1" x:Name="gridCalls" AutoGenerateColumns="False"  ItemsSource="{Binding Mode=OneWay}" CanUserReorderColumns="False" SelectionMode="Single" MouseDoubleClick="gridCalls_MouseDoubleClick" IsReadOnly="True" Background="#FF5765B2" Foreground="Black" RowBackground="#FF6B77B6" AlternatingRowBackground="#FF919EE5" HeadersVisibility="None" GridLinesVisibility="None">
					<DataGrid.Columns>
						<DataGridTextColumn Header="" Binding="{Binding is_outgoing, Converter={StaticResource DirectionConverter}}" ElementStyle="{DynamicResource CenterAlignStyle}" />
						<DataGridTemplateColumn Header="">
							<DataGridTemplateColumn.CellTemplate>
								<DataTemplate>
									<Button Width="15" Height="15"  Style="{DynamicResource GlassOrbStyle}" Background="{Binding state, Converter={StaticResource StateConverter}}"  />
								</DataTemplate>
							</DataGridTemplateColumn.CellTemplate>
						</DataGridTemplateColumn>
						<DataGridTextColumn Header="Other Party" Width="*" Binding="{Binding other_party_name}" />
					</DataGrid.Columns>
				</DataGrid>
			</Grid>
		</Border>
		<Border x:Name="borderAccounts" BorderThickness="2" BorderBrush="Black" Background="#FF000341" Width="192" Height="249" Canvas.Left="465" Canvas.Top="12" >
			<Grid d:IsLocked="True">
				<Grid.RowDefinitions>
					<RowDefinition Height="20" />
					<RowDefinition Height="*" />
				</Grid.RowDefinitions>
				<TextBlock Grid.Row="0" Foreground="White" Text="Accounts" Margin="5,0,0,0" FontWeight="Bold" FontSize="13.333"/>
				<DataGrid Grid.Row="1" AutoGenerateColumns="False" IsReadOnly="True" ItemsSource="{Binding Mode=OneWay}"  CanUserReorderColumns="False" SelectionMode="Single" x:Name="gridAccounts" HeadersVisibility="Column"  RowBackground="#FF6B77B6" AlternatingRowBackground="#FF919EE5"  Background="#FF5765B2" Foreground="Black" MouseUp="gridAccounts_MouseUp" ContextMenuOpening="gridAccounts_ContextMenuOpening">
					<DataGrid.ContextMenu>
						<ContextMenu>
							<MenuItem Header="Add Account" Click="AccountNew_Click" Name="menuAccountNew" />
							<MenuItem Header="Set Default Account" Click="AccountSetDefault_Click" Name="menuAccountSetDefault" />
							<MenuItem Header="Edit Account" Click="AccountEdit_Click" Name="menuAccountEdit" />
							<MenuItem Header="Delete Account" Click="AccountDelete_Click" Name="menuAccountDelete" />
						</ContextMenu>
					</DataGrid.ContextMenu>

					<DataGrid.Columns>
						<DataGridTextColumn Binding="{Binding gateway_id}" />
						<DataGridCheckBoxColumn Binding="{Binding enabled}"/>
						<DataGridTemplateColumn Header="Name" Width="*">
							<DataGridTemplateColumn.CellTemplate>
								<DataTemplate>
									<TextBlock Text="{Binding name}" Foreground="{Binding is_default_account, Converter={StaticResource AccountDefaultConverter}}" />
									</DataTemplate>
							</DataGridTemplateColumn.CellTemplate>
						</DataGridTemplateColumn>
						<DataGridTextColumn Binding="{Binding state}" Header="Status" Width="80"/>
					</DataGrid.Columns>
				</DataGrid>
			</Grid>
		</Border>
		<Canvas x:Name="canvasPhoneBody"  Canvas.Left="231">
			<StackPanel x:Name="topButtons" Orientation="Horizontal"  Canvas.Left="8" Canvas.Top="93">
				<Button Content="Talk" Height="20" x:Name="btnCall" Width="50" Click="btnCall_Click" Style="{DynamicResource GlassButtonStyle}" Foreground="#FF4EFF00" FontWeight="Bold" />
				<Button Content="Hold" FontWeight="Bold" Foreground="White" Height="20" IsEnabled="False" x:Name="btnHold" Style="{DynamicResource GlassButtonStyle}" Width="40" Click="btnHold_Click" Margin="5,0,0,0" />
				<Button Content="XFER" FontWeight="Bold" Foreground="White" Height="20" Width="40" x:Name="btnTransfer" Style="{DynamicResource GlassButtonStyle}" IsEnabled="False" Margin="25,0,0,0" Click="btnTransfer_Click" />
				<Button Content="End" Height="20" HorizontalAlignment="Left" x:Name="btnHangup" Width="50" Click="btnHangup_Click" Style="{DynamicResource GlassButtonStyle}" Foreground="#FFF50000" Background="{x:Null}" BorderBrush="{x:Null}" FontWeight="Bold" IsEnabled="False" Margin="5,0,0,0" />		
			</StackPanel>
		
			<Grid x:Name="gridPhonePad" Height="140" VerticalAlignment="Top" Width="110" Canvas.Left="63" Canvas.Top="117">
				<Grid.RowDefinitions>
					<RowDefinition Height="0.25*"/>
					<RowDefinition Height="0.25*"/>
					<RowDefinition Height="0.25*"/>
					<RowDefinition Height="0.25*"/>
				</Grid.RowDefinitions>
				<Grid.ColumnDefinitions>
					<ColumnDefinition Width="0.333*"/>
					<ColumnDefinition Width="0.333*"/>
					<ColumnDefinition Width="0.333*"/>
				</Grid.ColumnDefinitions>
				<Button Width="30" Height="30" Content="1" Grid.Row="0" Grid.Column="0" Style="{DynamicResource GlassButtonStyle}" Foreground="White" FontSize="14.667" FontWeight="Bold" Click="btnDialpad_Click" Margin="3.333,2.5" />
				<ours:PhonePadButton Letters="ABC" Number="2" Grid.Row="0" Grid.Column="1" Click="btnDialpad_Click" Margin="3.333,2.5"/>
				<ours:PhonePadButton Letters="DEF" Number="3" Grid.Row="0" Grid.Column="2"  Click="btnDialpad_Click" Margin="3.333,2.5"/>
				<ours:PhonePadButton Letters="GHI" Number="4" Grid.Row="1" Grid.Column="0"  Click="btnDialpad_Click" Margin="3.333,2.5" />
				<ours:PhonePadButton Letters="JKL" Number="5" Grid.Row="1" Grid.Column="1"   Click="btnDialpad_Click" Margin="3.333,2.5"/>
				<ours:PhonePadButton Letters="MNO" Number="6" Grid.Row="1" Grid.Column="2"   Click="btnDialpad_Click" Margin="3.333,2.5"/>
				<ours:PhonePadButton Letters="PQRS" Number="7" Grid.Row="2" Grid.Column="0"  Click="btnDialpad_Click" Margin="3.333,2.5"/>
				<ours:PhonePadButton Letters="TUV" Number="8" Grid.Row="2" Grid.Column="1"    Click="btnDialpad_Click" Margin="3.333,2.5"/>
				<ours:PhonePadButton Letters="WXYZ" Number="9" Grid.Row="2" Grid.Column="2"   Click="btnDialpad_Click" Margin="3.333,2.5"/>
				<Button Width="30" Height="30" Content="*" Grid.Row="3" Grid.Column="0" Style="{DynamicResource GlassButtonStyle}" Foreground="White" FontSize="26.667"   Click="btnDialpad_Click" Margin="3.333,2.5"/>
				<Button Width="30" Height="30" Content="0" Grid.Row="3" Grid.Column="1" Style="{DynamicResource GlassButtonStyle}" Foreground="White" FontSize="14.667" FontWeight="Bold"  Click="btnDialpad_Click" Margin="3.333,2.5"/>
				<Button Width="30" Height="30" Content="#" Grid.Row="3" Grid.Column="2" Style="{DynamicResource GlassButtonStyle}" Foreground="White" FontSize="14.667" FontWeight="Bold"   Click="btnDialpad_Click" Margin="3.333,2.5" />	
			
			</Grid>
			<StackPanel Orientation="Horizontal" Canvas.Left="37" Canvas.Top="261" x:Name="BottomButtons">
				<Button Margin="2,0" Content="Mute" FontWeight="Bold" Foreground="White" Height="20" HorizontalAlignment="Right" x:Name="btnMute" Style="{DynamicResource GlassButtonStyle}" VerticalAlignment="Top" Width="44" Click="btnMute_Click" />
				<!--<Button Margin="2,0" Content="Redial" FontWeight="Bold" Foreground="White" Height="20" x:Name="button2" Style="{DynamicResource GlassButtonStyle}" VerticalAlignment="Top" Width="44" d:LayoutOverrides="HorizontalAlignment, Width" />-->
				<Button Margin="2,0"  Content="DND" FontWeight="Bold" Foreground="White" Height="20" Width="44" x:Name="btnDND" Style="{DynamicResource GlassButtonStyle}" VerticalAlignment="Top" Click="btnDND_Click"  d:LayoutOverrides="HorizontalAlignment, Width" />
				<Button Margin="2,0" Content="Speaker" FontWeight="Bold" Foreground="White" Height="20" x:Name="btnSpeaker" Style="{DynamicResource GlassButtonStyle}" VerticalAlignment="Top" Width="55" d:LayoutOverrides="HorizontalAlignment" Click="btnSpeaker_Click" />			
			</StackPanel>
			<TextBox Height="35" x:Name="txtNumber" Text="" Background="#FF5C60AB" IsReadOnly="True" Foreground="White" VerticalScrollBarVisibility="Auto" TextWrapping="Wrap" Width="215" Canvas.Left="8" Canvas.Top="10" />
			<Border BorderThickness="1" x:Name="CurrentCallInfo" Width="215" Canvas.Left="8" Canvas.Top="49">
				<Border.Effect>
					<DropShadowEffect/>
				</Border.Effect>
				<Border.BorderBrush>
					<LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
						<GradientStop Color="#FF00FFED" Offset="0"/>
						<GradientStop Color="White" Offset="1"/>
					</LinearGradientBrush>
				</Border.BorderBrush>
				<StackPanel  Orientation="Vertical" Margin="2" >
					<StackPanel Orientation="Horizontal">
						<TextBlock Foreground="White" FontSize="13" Text="{Binding state}" />
						<TextBlock Foreground="White" FontSize="13" Margin="5,0,0,0" Text="{Binding is_outgoing, Converter={StaticResource EnglishDirectionConverter}}" />
						<TextBlock Foreground="White" FontSize="13" Text=" Call - " />
						<TextBlock Foreground="White" FontSize="13" Text="{Binding duration, Converter={StaticResource DurationTimeConverter}}"/>
					</StackPanel>
					<StackPanel Orientation="Horizontal">
						<TextBlock Margin="0,0,0,0"  Foreground="White" FontSize="12" Text="{Binding other_party_name}" />
					</StackPanel>

				</StackPanel>
			</Border>
			<Button Content="Options" HorizontalAlignment="Left" x:Name="btnOptions" Width="50" Click="btnOptions_Click" Style="{DynamicResource GlassButtonStyle}" Height="20" Canvas.Left="374" Canvas.Top="266" d:LayoutOverrides="VerticalAlignment" />
		</Canvas>
		<Button Canvas.Left="283" Canvas.Top="21" Content="Send To Voicemail" FontWeight="Bold" Foreground="#FFF5E200" Height="20" Name="btnSendVoicemail" Style="{DynamicResource GlassButtonStyle}" Width="120" Visibility="Hidden" Click="btnSendVoicemail_Click" />

		<ours:OurAutoCompleteBox Canvas.Left="435" Text="Contact Search" Canvas.Top="265" Height="22" Width="164.553" Opacity="0.8" x:Name="txtSearchBox" FilterMode="Contains" GotKeyboardFocus="txtSearchBox_GotKeyboardFocus" LostKeyboardFocus="txtSearchBox_LostKeyboardFocus" DropDownClosing="txtSearchBox_DropDownClosing" FontSize="11">
			<ours:OurAutoCompleteBox.ItemTemplate>
				<DataTemplate>

					<TextBlock Text="{Binding}">
						<TextBlock.ContextMenu>
							<ContextMenu x:Name="contactSearchConextMenu" ItemsSource="{Binding Path=(local:ContactPluginManager.ContactMenuItems)}" IsEnabled="true" Closed="contactSearchConextMenu_Closed" Loaded="contactSearchConextMenu_Loaded" />
						</TextBlock.ContextMenu>
					</TextBlock>
				</DataTemplate>
				</ours:OurAutoCompleteBox.ItemTemplate>
		</ours:OurAutoCompleteBox>
		<Control
            x:Name="busyAnimation" 
            Style="{StaticResource BusyAnimationStyle}"
            Width="{Binding Path=ActualWidth, ElementName=mainControl}" 
            Height="{Binding Path=ActualHeight, ElementName=mainControl}" d:IsHidden="True" 
            />
	</Canvas>
</Window>
