Progress bar using timing statistics.

This commit is contained in:
2015-06-28 17:41:59 +02:00
parent 5bd8c87f27
commit 47ca2920d7
3 changed files with 67 additions and 5 deletions

View File

@@ -24,3 +24,41 @@ function Element_ToggleVisibility(element){
}
}
function DropDown_GetValue(dropdown){
return dropdown.options[dropdown.selectedIndex].value;
}
function ShowProgressDialog(){
var divLoadBack=GetElement("divLoadBack");
var divLoading=GetElement("divLoading");
var hidScanDevice=GetElement("hidScanDevice");
var ddlResolution=GetElement("ddlResolution");
var ddlFormat=GetElement("ddlFormat");
var ddlSize=GetElement("ddlSize");
Element_SetVisibility("divLoadBack",true);
var keyValue=
hidScanDevice.value+"_"+
DropDown_GetValue(ddlResolution)+"_"+
DropDown_GetValue(ddlFormat)+"_"+
DropDown_GetValue(ddlSize);
var startTime=new Date().getTime() / 1000;
var estimatedTime=0;
if(timings.hasOwnProperty(keyValue)){
estimatedTime=timings[keyValue];
}
var divProgressBar=GetElement("divProgressBar");
var timerFunction=function(){
var timeNow=new Date().getTime() / 1000;
var value=(timeNow-startTime)/estimatedTime;
if(value>1.0){value=1.0;}
if(value<0){value=0;}
divProgressBar.style.width=parseInt(value*100)+"%";
window.setTimeout(timerFunction,300);
};
window.setTimeout(timerFunction,300);
}