<UserControl
    x:Class="Sicentury.Core.UserControls.BusyIndicator"
    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:local="clr-namespace:Sicentury.Core.UserControls"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    d:DesignHeight="150"
    d:DesignWidth="230"
    mc:Ignorable="d">
    <UserControl.Resources>
        <Style TargetType="{x:Type local:CirclePointRingLoading}">
            <Setter Property="Foreground" Value="#FFFFFFFF" />
            <Setter Property="IsHitTestVisible" Value="False" />
            <Setter Property="HorizontalAlignment" Value="Center" />
            <Setter Property="VerticalAlignment" Value="Center" />
            <Setter Property="MinHeight" Value="20" />
            <Setter Property="MinWidth" Value="20" />
            <Setter Property="Height" Value="60" />
            <Setter Property="Width" Value="60" />
            <Setter Property="IsTabStop" Value="False" />
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type local:CirclePointRingLoading}">
                        <Border
                            Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">
                            <FrameworkElement.Resources>
                                <ResourceDictionary>
                                    <Style x:Key="ProgressRingEllipseStyle" TargetType="{x:Type Ellipse}">
                                        <Setter Property="Opacity" Value="0" />
                                        <Setter Property="HorizontalAlignment" Value="Left" />
                                        <Setter Property="VerticalAlignment" Value="Top" />
                                    </Style>
                                </ResourceDictionary>
                            </FrameworkElement.Resources>
                            <Grid
                                Name="Ring"
                                MaxWidth="{Binding MaxSideLength, RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                MaxHeight="{Binding MaxSideLength, RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                Margin="{TemplateBinding Padding}"
                                FlowDirection="LeftToRight"
                                RenderTransformOrigin=".5,.5"
                                Visibility="Visible">
                                <Canvas RenderTransformOrigin=".5,.5">
                                    <UIElement.RenderTransform>
                                        <RotateTransform x:Name="E1R" />
                                    </UIElement.RenderTransform>
                                    <Ellipse
                                        Name="E1"
                                        Width="{Binding EllipseDiameter, RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                        Height="{Binding EllipseDiameter, RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                        Margin="{Binding EllipseOffset, RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                        Fill="{TemplateBinding Foreground}"
                                        Style="{StaticResource ProgressRingEllipseStyle}" />
                                </Canvas>
                                <Canvas RenderTransformOrigin=".5,.5">
                                    <UIElement.RenderTransform>
                                        <RotateTransform x:Name="E2R" />
                                    </UIElement.RenderTransform>
                                    <Ellipse
                                        Name="E2"
                                        Width="{Binding EllipseDiameter, RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                        Height="{Binding EllipseDiameter, RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                        Margin="{Binding EllipseOffset, RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                        Fill="{TemplateBinding Foreground}"
                                        Style="{StaticResource ProgressRingEllipseStyle}" />
                                </Canvas>
                                <Canvas RenderTransformOrigin=".5,.5">
                                    <UIElement.RenderTransform>
                                        <RotateTransform x:Name="E3R" />
                                    </UIElement.RenderTransform>
                                    <Ellipse
                                        Name="E3"
                                        Width="{Binding EllipseDiameter, RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                        Height="{Binding EllipseDiameter, RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                        Margin="{Binding EllipseOffset, RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                        Fill="{TemplateBinding Foreground}"
                                        Style="{StaticResource ProgressRingEllipseStyle}" />
                                </Canvas>
                                <Canvas RenderTransformOrigin=".5,.5">
                                    <UIElement.RenderTransform>
                                        <RotateTransform x:Name="E4R" />
                                    </UIElement.RenderTransform>
                                    <Ellipse
                                        Name="E4"
                                        Width="{Binding EllipseDiameter, RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                        Height="{Binding EllipseDiameter, RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                        Margin="{Binding EllipseOffset, RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                        Fill="{TemplateBinding Foreground}"
                                        Style="{StaticResource ProgressRingEllipseStyle}" />
                                </Canvas>
                                <Canvas RenderTransformOrigin=".5,.5">
                                    <UIElement.RenderTransform>
                                        <RotateTransform x:Name="E5R" />
                                    </UIElement.RenderTransform>
                                    <Ellipse
                                        Name="E5"
                                        Width="{Binding EllipseDiameter, RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                        Height="{Binding EllipseDiameter, RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                        Margin="{Binding EllipseOffset, RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                        Fill="{TemplateBinding Foreground}"
                                        Style="{StaticResource ProgressRingEllipseStyle}" />
                                </Canvas>
                                <Canvas
                                    Name="SixthCircle"
                                    RenderTransformOrigin=".5,.5"
                                    Visibility="Collapsed">
                                    <UIElement.RenderTransform>
                                        <RotateTransform x:Name="E6R" />
                                    </UIElement.RenderTransform>
                                    <Ellipse
                                        Name="E6"
                                        Width="{Binding EllipseDiameter, RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                        Height="{Binding EllipseDiameter, RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                        Margin="{Binding EllipseOffset, RelativeSource={RelativeSource Mode=TemplatedParent}}"
                                        Fill="{TemplateBinding Foreground}"
                                        Style="{StaticResource ProgressRingEllipseStyle}" />
                                </Canvas>
                            </Grid>
                            <VisualStateManager.VisualStateGroups>
                                <VisualStateGroup x:Name="SizeStates">
                                    <VisualState x:Name="Large">
                                        <Storyboard>
                                            <ObjectAnimationUsingKeyFrames
                                                Storyboard.TargetName="SixthCircle"
                                                Storyboard.TargetProperty="Visibility"
                                                Duration="0">
                                                <DiscreteObjectKeyFrame KeyTime="0">
                                                    <ObjectKeyFrame.Value>
                                                        <Visibility>Visible</Visibility>
                                                    </ObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                    <VisualState x:Name="Small" />
                                </VisualStateGroup>
                                <VisualStateGroup x:Name="ActiveStates">
                                    <VisualState x:Name="Inactive" />
                                    <VisualState x:Name="Active">
                                        <Storyboard RepeatBehavior="Forever">
                                            <ObjectAnimationUsingKeyFrames
                                                Storyboard.TargetName="Ring"
                                                Storyboard.TargetProperty="Visibility"
                                                Duration="0">
                                                <DiscreteObjectKeyFrame KeyTime="0">
                                                    <ObjectKeyFrame.Value>
                                                        <Visibility>Visible</Visibility>
                                                    </ObjectKeyFrame.Value>
                                                </DiscreteObjectKeyFrame>
                                            </ObjectAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames
                                                BeginTime="0"
                                                Storyboard.TargetName="E1"
                                                Storyboard.TargetProperty="Opacity">
                                                <DiscreteDoubleKeyFrame KeyTime="0" Value="1" />
                                                <DiscreteDoubleKeyFrame KeyTime="0:0:3.21" Value="1" />
                                                <DiscreteDoubleKeyFrame KeyTime="0:0:3.22" Value="0" />
                                                <DiscreteDoubleKeyFrame KeyTime="0:0:3.47" Value="0" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames
                                                BeginTime="00:00:00.167"
                                                Storyboard.TargetName="E2"
                                                Storyboard.TargetProperty="Opacity">
                                                <DiscreteDoubleKeyFrame KeyTime="0" Value="1" />
                                                <DiscreteDoubleKeyFrame KeyTime="0:0:3.21" Value="1" />
                                                <DiscreteDoubleKeyFrame KeyTime="0:0:3.22" Value="0" />
                                                <DiscreteDoubleKeyFrame KeyTime="0:0:3.47" Value="0" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames
                                                BeginTime="00:00:00.334"
                                                Storyboard.TargetName="E3"
                                                Storyboard.TargetProperty="Opacity">
                                                <DiscreteDoubleKeyFrame KeyTime="0" Value="1" />
                                                <DiscreteDoubleKeyFrame KeyTime="0:0:3.21" Value="1" />
                                                <DiscreteDoubleKeyFrame KeyTime="0:0:3.22" Value="0" />
                                                <DiscreteDoubleKeyFrame KeyTime="0:0:3.47" Value="0" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames
                                                BeginTime="00:00:00.501"
                                                Storyboard.TargetName="E4"
                                                Storyboard.TargetProperty="Opacity">
                                                <DiscreteDoubleKeyFrame KeyTime="0" Value="1" />
                                                <DiscreteDoubleKeyFrame KeyTime="0:0:3.21" Value="1" />
                                                <DiscreteDoubleKeyFrame KeyTime="0:0:3.22" Value="0" />
                                                <DiscreteDoubleKeyFrame KeyTime="0:0:3.47" Value="0" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames
                                                BeginTime="00:00:00.668"
                                                Storyboard.TargetName="E5"
                                                Storyboard.TargetProperty="Opacity">
                                                <DiscreteDoubleKeyFrame KeyTime="0" Value="1" />
                                                <DiscreteDoubleKeyFrame KeyTime="0:0:3.21" Value="1" />
                                                <DiscreteDoubleKeyFrame KeyTime="0:0:3.22" Value="0" />
                                                <DiscreteDoubleKeyFrame KeyTime="0:0:3.47" Value="0" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames
                                                BeginTime="00:00:00.835"
                                                Storyboard.TargetName="E6"
                                                Storyboard.TargetProperty="Opacity">
                                                <DiscreteDoubleKeyFrame KeyTime="0" Value="1" />
                                                <DiscreteDoubleKeyFrame KeyTime="0:0:3.21" Value="1" />
                                                <DiscreteDoubleKeyFrame KeyTime="0:0:3.22" Value="0" />
                                                <DiscreteDoubleKeyFrame KeyTime="0:0:3.47" Value="0" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames
                                                BeginTime="0"
                                                Storyboard.TargetName="E1R"
                                                Storyboard.TargetProperty="Angle">
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0.13,0.21,0.1,0.7"
                                                    KeyTime="0"
                                                    Value="-110" />
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0.02,0.33,0.38,0.77"
                                                    KeyTime="0:0:0.433"
                                                    Value="10" />
                                                <SplineDoubleKeyFrame KeyTime="0:0:1.2" Value="93" />
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0.57,0.17,0.95,0.75"
                                                    KeyTime="0:0:1.617"
                                                    Value="205" />
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0,0.19,0.07,0.72"
                                                    KeyTime="0:0:2.017"
                                                    Value="357" />
                                                <SplineDoubleKeyFrame KeyTime="0:0:2.783" Value="439" />
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0,0,0.95,0.37"
                                                    KeyTime="0:0:3.217"
                                                    Value="585" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames
                                                BeginTime="00:00:00.167"
                                                Storyboard.TargetName="E2R"
                                                Storyboard.TargetProperty="Angle">
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0.13,0.21,0.1,0.7"
                                                    KeyTime="0"
                                                    Value="-116" />
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0.02,0.33,0.38,0.77"
                                                    KeyTime="0:0:0.433"
                                                    Value="4" />
                                                <SplineDoubleKeyFrame KeyTime="0:0:1.2" Value="87" />
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0.57,0.17,0.95,0.75"
                                                    KeyTime="0:0:1.617"
                                                    Value="199" />
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0,0.19,0.07,0.72"
                                                    KeyTime="0:0:2.017"
                                                    Value="351" />
                                                <SplineDoubleKeyFrame KeyTime="0:0:2.783" Value="433" />
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0,0,0.95,0.37"
                                                    KeyTime="0:0:3.217"
                                                    Value="579" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames
                                                BeginTime="00:00:00.334"
                                                Storyboard.TargetName="E3R"
                                                Storyboard.TargetProperty="Angle">
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0.13,0.21,0.1,0.7"
                                                    KeyTime="0"
                                                    Value="-122" />
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0.02,0.33,0.38,0.77"
                                                    KeyTime="0:0:0.433"
                                                    Value="-2" />
                                                <SplineDoubleKeyFrame KeyTime="0:0:1.2" Value="81" />
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0.57,0.17,0.95,0.75"
                                                    KeyTime="0:0:1.617"
                                                    Value="193" />
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0,0.19,0.07,0.72"
                                                    KeyTime="0:0:2.017"
                                                    Value="345" />
                                                <SplineDoubleKeyFrame KeyTime="0:0:2.783" Value="427" />
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0,0,0.95,0.37"
                                                    KeyTime="0:0:3.217"
                                                    Value="573" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames
                                                BeginTime="00:00:00.501"
                                                Storyboard.TargetName="E4R"
                                                Storyboard.TargetProperty="Angle">
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0.13,0.21,0.1,0.7"
                                                    KeyTime="0"
                                                    Value="-128" />
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0.02,0.33,0.38,0.77"
                                                    KeyTime="0:0:0.433"
                                                    Value="-8" />
                                                <SplineDoubleKeyFrame KeyTime="0:0:1.2" Value="75" />
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0.57,0.17,0.95,0.75"
                                                    KeyTime="0:0:1.617"
                                                    Value="187" />
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0,0.19,0.07,0.72"
                                                    KeyTime="0:0:2.017"
                                                    Value="339" />
                                                <SplineDoubleKeyFrame KeyTime="0:0:2.783" Value="421" />
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0,0,0.95,0.37"
                                                    KeyTime="0:0:3.217"
                                                    Value="567" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames
                                                BeginTime="00:00:00.668"
                                                Storyboard.TargetName="E5R"
                                                Storyboard.TargetProperty="Angle">
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0.13,0.21,0.1,0.7"
                                                    KeyTime="0"
                                                    Value="-134" />
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0.02,0.33,0.38,0.77"
                                                    KeyTime="0:0:0.433"
                                                    Value="-14" />
                                                <SplineDoubleKeyFrame KeyTime="0:0:1.2" Value="69" />
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0.57,0.17,0.95,0.75"
                                                    KeyTime="0:0:1.617"
                                                    Value="181" />
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0,0.19,0.07,0.72"
                                                    KeyTime="0:0:2.017"
                                                    Value="331" />
                                                <SplineDoubleKeyFrame KeyTime="0:0:2.783" Value="415" />
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0,0,0.95,0.37"
                                                    KeyTime="0:0:3.217"
                                                    Value="561" />
                                            </DoubleAnimationUsingKeyFrames>
                                            <DoubleAnimationUsingKeyFrames
                                                BeginTime="00:00:00.835"
                                                Storyboard.TargetName="E6R"
                                                Storyboard.TargetProperty="Angle">
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0.13,0.21,0.1,0.7"
                                                    KeyTime="0"
                                                    Value="-140" />
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0.02,0.33,0.38,0.77"
                                                    KeyTime="0:0:0.433"
                                                    Value="-20" />
                                                <SplineDoubleKeyFrame KeyTime="0:0:1.2" Value="63" />
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0.57,0.17,0.95,0.75"
                                                    KeyTime="0:0:1.617"
                                                    Value="175" />
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0,0.19,0.07,0.72"
                                                    KeyTime="0:0:2.017"
                                                    Value="325" />
                                                <SplineDoubleKeyFrame KeyTime="0:0:2.783" Value="409" />
                                                <SplineDoubleKeyFrame
                                                    KeySpline="0,0,0.95,0.37"
                                                    KeyTime="0:0:3.217"
                                                    Value="555" />
                                            </DoubleAnimationUsingKeyFrames>
                                        </Storyboard>
                                    </VisualState>
                                </VisualStateGroup>
                            </VisualStateManager.VisualStateGroups>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
    </UserControl.Resources>
    <Border>
        <Grid>
            <Grid.RowDefinitions>
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>
            <StackPanel HorizontalAlignment="Center" Orientation="Horizontal">
                <local:CirclePointRingLoading
                    Width="20"
                    Height="20"
                    HorizontalAlignment="Left"
                    EllipseDiameter="3"
                    Foreground="#3ca9fe"
                    IsActive="True"
                    IsLarge="True"
                    Visibility="{Binding RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=Visibility}" />
                <StackPanel>
                    <TextBlock
                        Margin="10,0,0,0"
                        HorizontalAlignment="Left"
                        VerticalAlignment="Center"
                        FontSize="10"
                        Text="{Binding RelativeSource={RelativeSource AncestorType=UserControl, Mode=FindAncestor}, Path=Message}" />
                </StackPanel>
            </StackPanel>
            <Button
                x:Name="btnCancel"
                Grid.Row="1"
                Width="60"
                Height="25"
                Margin="0,5,0,0"
                HorizontalAlignment="Center"
                VerticalAlignment="Top"
                Click="BtnCancel_OnClick"
                Content="Cancel"
                FontSize="8" />
        </Grid>
    </Border>
</UserControl>
