private static async void OnLineNumbersVisiblePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            // Unpack the parameters and lock the UI
            Hilite_meHighlightStylePreviewControl @this = d.To <Hilite_meHighlightStylePreviewControl>();
            await @this.AnimationSemaphore.WaitAsync();

            // Update the preview
            if (@this.ReadLocalValue(HighlightStyleProperty) != DependencyProperty.UnsetValue)
            {
                bool light = LightStyles.Contains(@this.HighlightStyle);
                @this.FadeCanvas.Background             = new SolidColorBrush(light ? Colors.White : Colors.Black);
                @this.WebControl.DefaultBackgroundColor = light ? Colors.White : Colors.Black;
                String preview = await @this.LoadHTMLPreviewAsync();

                @this.WebControl.NavigateToString(preview);
            }
            @this.AnimationSemaphore.Release();
        }
        private static async void OnHighlightStylePropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            // Unpack the parameters and lock the UI
            Hilite_meHighlightStylePreviewControl @this = d.To <Hilite_meHighlightStylePreviewControl>();
            await @this.AnimationSemaphore.WaitAsync();

            SyntaxHighlightStyle style = e.NewValue.To <SyntaxHighlightStyle>();

            // Check if there's a background transition
            HighlightTransitionType transition = HighlightTransitionType.None;

            if (e.OldValue != DependencyProperty.UnsetValue && e.OldValue != null)
            {
                SyntaxHighlightStyle old = e.OldValue.To <SyntaxHighlightStyle>();
                if (LightStyles.Contains(style) && !LightStyles.Contains(old))
                {
                    // Dark to light transition needed
                    transition = HighlightTransitionType.DarkToLight;
                }
                else if (!LightStyles.Contains(style) && LightStyles.Contains(old))
                {
                    // Light to dark transition
                    transition = HighlightTransitionType.LightToDark;
                }
            }
            else
            {
                bool light = LightStyles.Contains(style);
                @this.FadeCanvas.Background             = new SolidColorBrush(light ? Colors.White : Colors.Black);
                @this.WebControl.DefaultBackgroundColor = light ? Colors.White : Colors.Black;
            }

            // Function to load the sample HTML
            Task <String> htmlTask = @this.LoadHTMLPreviewAsync();

            // Await the out animations and the HTML loading
            List <Task> outTasks = new List <Task>
            {
                @this.BlurAsync(20, TimeSpan.FromMilliseconds(AnimationDuration)),
                htmlTask
            };

            if (transition != HighlightTransitionType.None)
            {
                @this.FadeCanvas.Background = new SolidColorBrush(transition == HighlightTransitionType.LightToDark ? Colors.Black : Colors.White);
                outTasks.Add(
                    @this.WebControl.StartCompositionFadeScaleAnimationAsync(1, 0.4f, 1, 1.05f, AnimationDuration, null, null, EasingFunctionNames.Linear));
            }
            else
            {
                outTasks.Add(
                    @this.WebControl.StartCompositionScaleAnimationAsync(1, 1.05f, AnimationDuration, null, EasingFunctionNames.Linear));
            }
            await Task.WhenAll(outTasks);

            // Show the HTML, animate back in and then release the semaphore
            @this.WebControl.SetVisualOpacity(1);
            @this.WebControl.NavigateToString(htmlTask.Result);
            await Task.WhenAll(
                @this.WebControl.StartCompositionScaleAnimationAsync(1.05f, 1, AnimationDuration, null, EasingFunctionNames.Linear),
                @this.BlurAsync(0, TimeSpan.FromMilliseconds(AnimationDuration)));

            if (@this.LoadingRing.Visibility == Visibility.Visible)
            {
                @this.LoadingRing.Visibility = Visibility.Collapsed;
            }
            @this.AnimationSemaphore.Release();
        }