<Page
	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:System="clr-namespace:System;assembly=mscorlib"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
    xmlns:local="clr-namespace:ForzaUI"
    mc:Ignorable="d"
	x:Class="ForzaUI.BMW_M5_12">
	
    <Page.Resources>
        <Style x:Key="TextBlockStyle" TargetType="{x:Type TextBlock}">
            <Setter Property="FontFamily" Value="Moire"/>
            <Setter Property="Foreground" Value="White"/>
            <Setter Property="TextWrapping" Value="NoWrap"/>
            <Setter Property="TextAlignment" Value="Right"/>
        </Style>
		
		<local:DigitalGaugeConfig x:Key="Config" HasClock="True" HasExternalTemp="True" UseDegreesF="False" UseMPH="False" UsePsi="True" MaxBoost="13" MinBoost="1" MaxSpeed="120" HasAbsLight="False" HasStmLight="False" HasTcsLight="False" HasGAccelX="False" HasGAccelY="False" HasShiftLights="False" HasTextTach="False" HasLapPlaceInfo="False" HasTextBoost="False" HasTextGAccel="False" HasTextOdometer="True" HasTextFuel="False" MaxFuel="20" MinGear="-1" MaxGear="1" MaxRpm="10000"></local:DigitalGaugeConfig>
		<Storyboard x:Key="Fuel Gauge">
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Width)" Storyboard.TargetName="FuelFill_1">
				<EasingDoubleKeyFrame KeyTime="0" Value="0"/>
				<EasingDoubleKeyFrame KeyTime="0:0:0.1" Value="20"/>
				<EasingDoubleKeyFrame KeyTime="0:0:0.2" Value="40"/>
				<EasingDoubleKeyFrame KeyTime="0:0:0.3" Value="60"/>
				<EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="80"/>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Width)" Storyboard.TargetName="FuelFill_2">
				<EasingDoubleKeyFrame KeyTime="0:0:0.4" Value="0"/>
				<EasingDoubleKeyFrame KeyTime="0:0:0.5" Value="20"/>
				<EasingDoubleKeyFrame KeyTime="0:0:0.6" Value="40"/>
				<EasingDoubleKeyFrame KeyTime="0:0:0.7" Value="60"/>
				<EasingDoubleKeyFrame KeyTime="0:0:0.8" Value="80"/>
			</DoubleAnimationUsingKeyFrames>
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(FrameworkElement.Width)" Storyboard.TargetName="FuelFill_3">
				<EasingDoubleKeyFrame KeyTime="0:0:0.8" Value="0"/>
				<EasingDoubleKeyFrame KeyTime="0:0:0.9" Value="20"/>
				<EasingDoubleKeyFrame KeyTime="0:0:1" Value="42"/>
				<EasingDoubleKeyFrame KeyTime="0:0:1.1" Value="62"/>
				<EasingDoubleKeyFrame KeyTime="0:0:1.2" Value="81"/>
			</DoubleAnimationUsingKeyFrames>
		</Storyboard>
		<Storyboard x:Key="Start Up Animation">
			<DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Opacity)" Storyboard.TargetName="Start_Up_Mask">
				<EasingDoubleKeyFrame KeyTime="0" Value="1"/>
				<EasingDoubleKeyFrame KeyTime="0:0:1" Value="0"/>
			</DoubleAnimationUsingKeyFrames>
		</Storyboard>
		<Storyboard x:Key="Gear Analog">
			<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Gear_R">
				<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Visible}"/>
				<DiscreteObjectKeyFrame KeyTime="0:0:0.5" Value="{x:Static Visibility.Hidden}"/>
			</ObjectAnimationUsingKeyFrames>
			<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Gear_N">
				<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Hidden}"/>
				<DiscreteObjectKeyFrame KeyTime="0:0:0.5" Value="{x:Static Visibility.Visible}"/>
				<DiscreteObjectKeyFrame KeyTime="0:0:0.75" Value="{x:Static Visibility.Hidden}"/>
			</ObjectAnimationUsingKeyFrames>
			<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="Gear_D">
				<DiscreteObjectKeyFrame KeyTime="0" Value="{x:Static Visibility.Hidden}"/>
				<DiscreteObjectKeyFrame KeyTime="0:0:0.75" Value="{x:Static Visibility.Visible}"/>
			</ObjectAnimationUsingKeyFrames>
		</Storyboard>
	</Page.Resources>
	<Page.Triggers>
		<EventTrigger RoutedEvent="FrameworkElement.Loaded">
			<BeginStoryboard Storyboard="{StaticResource Gear Analog}"/>
		</EventTrigger>
	</Page.Triggers>
	  

	<Canvas x:Name="LayoutRoot" Background="Transparent" Width="1280" Height="720">
		<VisualStateManager.VisualStateGroups>
			<VisualStateGroup x:Name="NightDaySplit">
				<VisualState x:Name="Day"/>
				<VisualState x:Name="Night"/>
			</VisualStateGroup>
		</VisualStateManager.VisualStateGroups>
        <Rectangle x:Name="Background_Grey" Fill="Black" Height="720" Width="1280" Canvas.Left="0" Canvas.Top="0"/>
        <Rectangle x:Name="Battery_Fill" Fill="#FF3288E4" Height="100" Canvas.Left="731" Canvas.Top="334" Width="309"/>
        <Canvas x:Name="Fuel" Canvas.Left="213" Canvas.Top="277" Height="224" Width="382">
        	<Rectangle x:Name="FuelFill_1" Fill="#FF3288E4" Height="50" Canvas.Left="72" Canvas.Top="68.5" Width="0" RenderTransformOrigin="0,0.5">
        		<Rectangle.RenderTransform>
        			<TransformGroup>
        				<ScaleTransform/>
        				<SkewTransform/>
        				<RotateTransform Angle="32.93"/>
        				<TranslateTransform/>
        			</TransformGroup>
        		</Rectangle.RenderTransform>
        	</Rectangle>
        	<Rectangle x:Name="FuelFill_2" Fill="#FF3288E4" Height="50" Canvas.Left="146" Canvas.Top="115.5" Width="0" RenderTransformOrigin="0,0.5"/>
        	<Rectangle x:Name="FuelFill_3" Fill="#FF3288E4" Height="50" Canvas.Left="231.5" Canvas.Top="115" Width="0" RenderTransformOrigin="0,0.5">
        		<Rectangle.RenderTransform>
        			<TransformGroup>
        				<ScaleTransform/>
        				<SkewTransform/>
        				<RotateTransform Angle="-27.357"/>
        				<TranslateTransform/>
        			</TransformGroup>
        		</Rectangle.RenderTransform>
        	</Rectangle>
        </Canvas>
        <Rectangle x:Name="FuelMask_Top" Fill="Black" Height="204" Width="995" Canvas.Left="135" Canvas.Top="114"/>
        <Rectangle x:Name="FuelMask_Bottom" Fill="Black" Height="156" Canvas.Left="135" Canvas.Top="444" Width="995"/>
        <Image x:Name="Graphics_Battery" Height="128" Canvas.Left="618" Source="game:/media/cars/BMW_M5_12/UI/Textures/BMW_M5_12_battery_mask.png" Stretch="Fill" Canvas.Top="318" Width="512"/>
        <Image x:Name="Graphics_Fuel" Height="128" Canvas.Left="135" Source="game:/media/cars/BMW_M5_12/UI/Textures/BMW_M5_12_fuel_mask.png" Stretch="Fill" Canvas.Top="316" Width="512"/>
		<Canvas x:Name="Shift_Lights" Height="160" Canvas.Left="557" Canvas.Top="363" Width="180">
			<Image x:Name="Shift_0" Height="44" Canvas.Left="119.334" Source="game:/media/cars/BMW_M5_12/UI/Textures/BMW_M5_12_shift_0.png" Stretch="Fill" Canvas.Top="63" Width="44"/>
			<Image x:Name="Shift_1" Height="44" Canvas.Left="119.334" Source="game:/media/cars/BMW_M5_12/UI/Textures/BMW_M5_12_shift_1.png" Stretch="Fill" Canvas.Top="63" Width="44"/>
			<Image x:Name="Shift_2" Height="44" Canvas.Left="119.334" Source="game:/media/cars/BMW_M5_12/UI/Textures/BMW_M5_12_shift_2.png" Stretch="Fill" Canvas.Top="63" Width="44" Visibility="Hidden"/>
			<Image x:Name="Shift_3" Height="44" Canvas.Left="119.334" Source="game:/media/cars/BMW_M5_12/UI/Textures/BMW_M5_12_shift_3.png" Stretch="Fill" Canvas.Top="63" Width="44" Visibility="Hidden"/>
		</Canvas>
        <Canvas x:Name="Gear_Analog" Height="134.666" Canvas.Left="559" Canvas.Top="372.667" Width="180">
        	<Image x:Name="Gear_R" Height="54" Canvas.Left="60.5" Source="game:/media/cars/BMW_M5_12/UI/Textures/BMW_M5_12_gear_R.png" Stretch="Fill" Canvas.Top="47.333" Width="54"/>
        	<Image x:Name="Gear_N" Height="54" Canvas.Left="60.5" Source="game:/media/cars/BMW_M5_12/UI/Textures/BMW_M5_12_gear_N.png" Stretch="Fill" Canvas.Top="47.333" Width="54" Visibility="Hidden"/>
        	<Image x:Name="Gear_D" Height="54" Canvas.Left="60.5" Source="game:/media/cars/BMW_M5_12/UI/Textures/BMW_M5_12_gear_D.png" Stretch="Fill" Canvas.Top="47.333" Width="54" Visibility="Hidden"/>
        </Canvas>
		<Canvas x:Name="Text" Height="720" Width="1280">
            <TextBlock x:Name="Text_External_Temp" Canvas.Left="872.5" Canvas.Top="543.336" Text="{Binding ExternalTemp}" FontSize="25.333" Style="{StaticResource TextBlockStyle}" FontFamily="DG1_Arial" Width="200"/>
            <Image x:Name="Text_Speedo_Baked" Height="24" Canvas.Left="423.5" Source="game:/media/cars/BMW_M5_12/UI/Textures/BMW_M5_12_txt_speedo.png" Stretch="Fill" Canvas.Top="550" Width="70"/>
            <TextBlock x:Name="Text_Clock" Canvas.Left="147.164" Canvas.Top="543.336" Text="{Binding Time}" FontSize="25.333" Style="{StaticResource TextBlockStyle}" FontFamily="DG1_Arial" Width="150"/>
            <TextBlock x:Name="Text_Speed" Canvas.Left="273.793" Canvas.Top="524.501" Text="{Binding Speed}" Width="160" FontSize="49.333" Style="{StaticResource TextBlockStyle}" RenderTransformOrigin="0.5,0.5">
            	<TextBlock.RenderTransform>
            		<TransformGroup>
            			<ScaleTransform ScaleX="0.8"/>
            			<SkewTransform/>
            			<RotateTransform/>
            			<TranslateTransform/>
            		</TransformGroup>
            	</TextBlock.RenderTransform>
            </TextBlock>
            <TextBlock x:Name="Text_Gear" Canvas.Left="553.543" Canvas.Top="427.959" Text="{Binding Gear}" Width="100" FontSize="42.667" Style="{StaticResource TextBlockStyle}" Foreground="#FFFBFFDD" RenderTransformOrigin="0.5,0.5" TextAlignment="Center" FontFamily="DG1_Arial">
            	<TextBlock.RenderTransform>
            		<TransformGroup>
            			<ScaleTransform ScaleX="0.9"/>
            			<SkewTransform/>
            			<RotateTransform/>
            			<TranslateTransform/>
            		</TransformGroup>
            	</TextBlock.RenderTransform>
            </TextBlock>
            <TextBlock x:Name="Text_Trip_Odo" Canvas.Left="632.192" Canvas.Top="543.336" Text="{Binding TripMeter}" Width="120" FontSize="25.333" Style="{StaticResource TextBlockStyle}" FontFamily="DG1_Arial"/>
            <TextBlock x:Name="Text_Odometer" Canvas.Left="557.793" Canvas.Top="543.336" Text="{Binding Odometer}" Width="160" FontSize="25.333" Style="{StaticResource TextBlockStyle}" FontFamily="DG1_Arial" TextAlignment="Left"/>
		</Canvas>
        <Image x:Name="Graphics_Time" Height="16" Canvas.Left="218" Source="game:/media/cars/BMW_M5_12/UI/Textures/BMW_M5_12_txt_time.png" Stretch="Fill" Canvas.Top="528" Width="80"/>
        <Image x:Name="Graphics_Temperature" Height="44" Canvas.Left="1006" Source="game:/media/cars/BMW_M5_12/UI/Textures/BMW_M5_12_txt_temp.png" Stretch="Fill" Canvas.Top="525" Width="100"/>
        <Image x:Name="Graphics_Odometer" Height="16" Canvas.Left="554" Source="game:/media/cars/BMW_M5_12/UI/Textures/BMW_M5_12_txt_odo.png" Stretch="Fill" Canvas.Top="527" Width="200"/>
        <Rectangle x:Name="Start_Up_Mask" Fill="Black" Height="668" Stroke="Black" Width="1186" Canvas.Left="58" Canvas.Top="53" Opacity="0"/>
		
						<!-- Storyboard binding controllers -->
		<local:StoryboardController SeekPct="{Binding Fuel}" Target="{StaticResource Fuel Gauge}"/>
		<local:StoryboardController SeekPct="{Binding AnalogGear}" Target="{StaticResource Gear Analog}"/>
	</Canvas>
</Page>