﻿Type.registerNamespace("AjaxControlToolkit.Threading");AjaxControlToolkit.DeferredOperation=function(A,B,C){this._delay=A;this._context=B;this._callback=C;this._completeCallback=null;this._errorCallback=null;this._timer=null;this._callArgs=null;this._isComplete=false;this._completedSynchronously=false;this._asyncResult=null;this._exception=null;this._throwExceptions=true;this._oncomplete$delegate=Function.createDelegate(this,this._oncomplete);this.post=Function.createDelegate(this,this.post)};AjaxControlToolkit.DeferredOperation.prototype={get_isPending:function(){return(this._timer!=null)},get_isComplete:function(){return this._isComplete},get_completedSynchronously:function(){return this._completedSynchronously},get_exception:function(){return this._exception},get_throwExceptions:function(){return this._throwExceptions},set_throwExceptions:function(A){this._throwExceptions=A},get_delay:function(){return this._delay},set_delay:function(A){this._delay=A},post:function(B){var A=[];for(var C=0;C<arguments.length;C++){A[C]=arguments[C]}this.beginPost(A,null,null)},beginPost:function(B,C,A){this.cancel();this._callArgs=Array.clone(B||[]);this._completeCallback=C;this._errorCallback=A;if(this._delay==-1){this._oncomplete();this._completedSynchronously=true}else{this._timer=setTimeout(this._oncomplete$delegate,this._delay)}},cancel:function(){if(this._timer){clearTimeout(this._timer);this._timer=null}this._callArgs=null;this._isComplete=false;this._asyncResult=null;this._completeCallback=null;this._errorCallback=null;this._exception=null;this._completedSynchronously=false},complete:function(){if(this._timer){try{this._oncomplete()}finally{this._completedSynchronously=true}return this._asyncResult}else{if(this._isComplete){return this._asyncResult}}},_oncomplete:function(){var B=this._callArgs;var C=this._completeCallback;var A=this._errorCallback;this.cancel();try{if(B){this._asyncResult=this._callback.apply(this._context,B)}else{this._asyncResult=this._callback.call(this._context)}this._isComplete=true;this._completedSynchronously=false;if(C){C(this)}}catch(D){this._isComplete=true;this._completedSynchronously=false;this._exception=D;if(A){if(A(this)){return }}if(this._throwExceptions){throw D}}}};AjaxControlToolkit.DeferredOperation.registerClass("AjaxControlToolkit.DeferredOperation");
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();