Dispose() public method

public Dispose ( ) : void
return void
        /// <summary>Downloads the resources defined for the package.</summary>
        /// <param name="onScriptsDownloaded">Invoked when the scripts have completed downloading.</param>
        /// <param name="onTimedOut">Invoked when/if the operation times out (NB: 'onScriptsDownloaded' is never called if the operation times out).</param>
        protected void DownloadInternal(Action onScriptsDownloaded, Action onTimedOut)
        {
            // Setup initial conditions.
            TimedOut = false;
            IsLoading = true;

            // Insert resources.
            InsertCssLinks();
            // TODO - Extend to include all resource types (images + CSS).

            // Setup failure timeout.
            DelayedAction timeout = new DelayedAction(DownloadTimeout, delegate
                                    {
                                        TimedOut = true;
                                        IsLoading = false;
                                        Helper.Invoke(onTimedOut);
                                    });
            timeout.Start();

            // Download the scripts
            DownloadScripts(delegate
                                {
                                    if (!TimedOut) // Only invoke if the timeout hasn't elapsed before this callback.
                                    {
                                        Helper.Invoke(onScriptsDownloaded);
                                    }
                                    timeout.Dispose();
                                    IsLoading = false;
                                });
        }