﻿function onSourceDownloadProgressChanged(sender, eventArgs) 
{
    var totalWidth = document.body.clientWidth;
    var totalHeight = document.body.clientHeight;

    var loaderWidth = 280;
    var loaderHeight = 240;

    var loader = sender.getHost().content.findName("loader");
    loader.setValue("Canvas.Left", Math.round((totalWidth - loaderWidth) / 2));
    loader.setValue("Canvas.Top", Math.round((totalHeight - loaderHeight) / 2));
    
    sender.getHost().content.findName("StatusText").Text = Math.round((eventArgs.progress * 1000)) / 10 + "%";
    //sender.getHost().content.findName("ProgressBarTransform").ScaleY = eventArgs.progress * 158;
}

function OnBackgroundImageDownLoadProgressChanged(sender, args) {
    if (sender.DownloadProgress >= 1) {
        var sl = document.getElementById("Xaml1");
        sl.setAttribute("align", "center");
        sl.setAttribute("vertical-align", "middle");
        
        if (document.body.SplashScreenAnimationStarted == undefined) {
            document.body.SplashScreenAnimationStarted = true;
            var CycleAnimation = sl.content.findName("_Animation");
            CycleAnimation.Begin();
        }
    }
}
