﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:controls="using:WinRTXamlToolkit.Controls"
    xmlns:converters="using:WinRTXamlToolkit.Converters">
    <!-- CameraCaptureControl default style -->
    <Style
        TargetType="controls:CameraCaptureControl">
        <Setter
            Property="Background"
            Value="#FF0C0C0C" />
        <Setter
            Property="Template">
            <Setter.Value>
                <ControlTemplate
                    TargetType="controls:CameraCaptureControl">
                    <Border
                        x:Name="PART_LayoutRoot"
                        BorderBrush="{TemplateBinding BorderBrush}"
                        BorderThickness="{TemplateBinding BorderThickness}"
                        Background="{TemplateBinding Background}">
                        <Border.Resources>
                            <converters:BooleanToVisibilityConverter
                                x:Key="BooleanToVisibilityConverter" />

                            <Storyboard
                                x:Name="PART_FlashAnimation">
                                <DoubleAnimationUsingKeyFrames
                                    Storyboard.TargetProperty="Opacity"
                                    Storyboard.TargetName="FlashRectangle">
                                    <DiscreteDoubleKeyFrame
                                        KeyTime="0:0:0"
                                        Value="1" />
                                    <EasingDoubleKeyFrame
                                        KeyTime="0:0:0.3"
                                        Value="0">
                                        <EasingDoubleKeyFrame.EasingFunction>
                                            <CubicEase
                                                EasingMode="EaseOut" />
                                        </EasingDoubleKeyFrame.EasingFunction>
                                    </EasingDoubleKeyFrame>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>

                            <Storyboard
                                x:Name="PART_RecordingAnimation">
                                <DoubleAnimationUsingKeyFrames
                                    Storyboard.TargetName="RecordingIcon"
                                    Storyboard.TargetProperty="Opacity"
                                    RepeatBehavior="Forever"
                                    Duration="0:0:2">
                                    <DiscreteDoubleKeyFrame
                                        KeyTime="0"
                                        Value="1.0" />
                                    <DiscreteDoubleKeyFrame
                                        KeyTime="0:0:1"
                                        Value="0.0" />
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                        </Border.Resources>
                        <Grid
                            x:Name="LayoutRoot">
                            <controls:LayoutTransformControl>
                                <controls:LayoutTransformControl.Transform>
                                    <TransformGroup>
                                        <ScaleTransform
                                            x:Name="PART_ScaleTransform"
                                            ScaleX="-1" />
                                        <RotateTransform
                                            x:Name="PART_RotateTransform"
                                            Angle="0" />
                                    </TransformGroup>
                                </controls:LayoutTransformControl.Transform>
                                <CaptureElement
                                    x:Name="PART_CaptureElement"
                                    Stretch="Uniform" />
                            </controls:LayoutTransformControl>
                            <controls:CustomAppBar
                                IsOpen="True"
                                CanDismiss="False">
                                <StackPanel
                                    Orientation="Horizontal"
                                    HorizontalAlignment="Right">
                                    <Button
                                        Style="{StaticResource RepairAppBarButtonStyle}" />
                                    <Button
                                        Style="{StaticResource ClockAppBarButtonStyle}" />
                                    <Button
                                        Style="{StaticResource VideoAppBarButtonStyle}" />
                                </StackPanel>
                            </controls:CustomAppBar>
                            <controls:CountdownControl
                                x:Name="PART_CountdownControl"
                                VerticalAlignment="Center"
                                HorizontalAlignment="Center" />
                            <Grid
                                x:Name="PART_RecordingIndicator"
                                HorizontalAlignment="Right"
                                VerticalAlignment="Top"
                                Margin="25"
                                Visibility="Collapsed">
                                <TextBlock
                                    Foreground="Red"
                                    FontSize="48"
                                    VerticalAlignment="Center"
                                    HorizontalAlignment="Right"
                                    Margin="0,7,60,0"
                                    Text="REC" />
                                <Ellipse
                                    x:Name="RecordingIcon"
                                    HorizontalAlignment="Right"
                                    Width="50"
                                    Height="50"
                                    Fill="Red"
                                    Visibility="Visible" />
                            </Grid>
                            <Popup
                                x:Name="PART_WebCamSelectorPopup"
                                IsOpen="False">
                                <Grid
                                    x:Name="WebCamSelectorGrid"
                                    Background="#80000000"
                                    Width="{Binding ActualWidth, ElementName=LayoutRoot}"
                                    Height="{Binding ActualHeight, ElementName=LayoutRoot}">
                                    <StackPanel
                                        HorizontalAlignment="Center"
                                        VerticalAlignment="Center">
                                        <TextBlock
                                            Text="Select a camera"
                                            FontSize="48"
                                            Margin="10,5" />
                                        <ListBox
                                            x:Name="PART_WebCamSelector"
                                            FontSize="36" />
                                    </StackPanel>
                                </Grid>
                            </Popup>
                            <Rectangle
                                x:Name="FlashRectangle"
                                IsHitTestVisible="False"
                                VerticalAlignment="Stretch"
                                HorizontalAlignment="Stretch"
                                Fill="White"
                                Opacity="0" />
                        </Grid>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>

