Ejemplo n.º 1
0
        public void Start()
        {
            lock (SyncRoot) {
                if (request != null || async_begin_result != null)
                {
                    throw new InvalidOperationException("HttpDownloader is already active");
                }

                State = new HttpDownloaderState()
                {
                    Buffer = new Buffer()
                    {
                        Data = new byte[BufferSize]
                    }
                };

                request            = CreateRequest();
                async_begin_result = request.BeginGetResponse(OnRequestResponse, this);

                State.StartTime = DateTime.Now;
                State.Working   = true;
                OnStarted();
            }
        }
Ejemplo n.º 2
0
        public void Start ()
        {
            lock (SyncRoot) {
                if (request != null || async_begin_result != null) {
                    throw new InvalidOperationException ("HttpDownloader is already active");
                }
                
                State = new HttpDownloaderState () {
                    Buffer = new Buffer () {
                        Data = new byte[BufferSize]
                    }
                };

                request = CreateRequest ();
                async_begin_result = request.BeginGetResponse (OnRequestResponse, this);

                State.StartTime = DateTime.Now;
                State.Working = true;
                OnStarted ();
            }
        }