Ask for help translated into the new. NET Framework JAVASCRIT script syntax expansion

Q

qq2005

Hello,
The following JS FILE(ProgressBar.js) is the original code for ASP.NET Atlas
about the progress ,
Now I would like to use it in ASP.NET AJAX1.0 ¡£
Because I do not know how new. NET Framework JAVASCRIT script syntax
expansion¡£
Ask for help translated into the new. NET Framework JAVASCRIT script syntax
expansion¡£
Thank you!!
Source code(At the same time that pieces(ProgressBar.js)):

Sys.UI.ProgressBar = function(associatedElement) {
Sys.UI.ProgressBar.initializeBase(this, [associatedElement]);

var _timer = new Sys.Timer();
var _progress = 0;
var _serviceURL;
var _serviceMethod;
var _responsePending;
var _tickHandler;
var _obj = this;

this.get_progress = function() {
return _progress;
}

this.set_progress = function(value) {
if (value > = 100) {
_timer.set_enabled(false);
}
_progress = value;
associatedElement.style.width = value + "%";
associatedElement.innerHTML = value == 100 ?
"Done!" : value + "%";
}

this.get_interval = function() {
return _timer.get_interval();
}

this.set_interval = function(value) {
_timer.set_interval(value);
}

this.get_serviceURL = function() {
return _serviceURL;
}

this.set_serviceURL = function(value) {
_serviceURL = value;
}

this.get_serviceMethod = function() {
return _serviceMethod;
}

this.set_serviceMethod = function(value) {
_serviceMethod = value;
}

this.getDescriptor = function() {
var td = Sys.UI.ProgressBar.callBaseMethod(this,
'getDescriptor');
td.addProperty('interval', Number);
td.addProperty('progress', Number);
td.addProperty('serviceURL', String);
td.addProperty('serviceMethod', String);
td.addMethod('start');
td.addMethod('stop');
return des;
}

this.initialize = function() {
Sys.UI.ProgressBar.callBaseMethod(this, 'initialize');
_tickHandler = Function.createDelegate(this,
this._onTimerTick);
_timer.tick.add(_tickHandler);
this.set_progress(0);
}

this.dispose = function() {
if (_timer) {
_timer.tick.remove(_tickHandler);
_tickHandler = null;
_timer.dispose();
}
_timer = null;
associatedElement = null;
_obj = null;

Sys.UI.ProgressBar.callBaseMethod(this, 'dispose');
}

this.start = function() {
_timer.set_enabled(true);
}

this.stop = function() {
_timer.set_enabled(false);
}

this._onTimerTick = function(sender, eventArgs) {
if (!_responsePending) {
_responsePending = true;

// Asynchronously call the service method.
Sys.Net.ServiceMethod.invoke(_serviceURL,
_serviceMethod, null, null, _onMethodComplete);
}
}

function _onMethodComplete(result) {
// Update the progress bar.
_obj.set_progress(result);
_responsePending = false;
}
}
Type.registerSealedClass('Sys.UI.ProgressBar', Sys.UI.Control);
Sys.TypeDescriptor.addType('script','progressBar', Sys.UI.ProgressBar);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top