Ejemplo n.º 1
0
		private void loHttp_OnReceiveData(object sender, wwHttp.OnReceiveDataEventArgs e) 
		{
			if (e.Done)
				MessageBox.Show("Download Complete!");
			else if (e.CurrentByteCount >  2000000) {
				MessageBox.Show("Cancelling... download too large.");
				e.Cancel = true;
			}
			else 
				this.oStatus.Panels[0].Text = e.CurrentByteCount.ToString() + " of " + 
					e.TotalBytes.ToString() + " read";
		}
Ejemplo n.º 2
0
		public void OnReceiveData(object sender, wwHttp.OnReceiveDataEventArgs e) 
		{
			if (this.Instance == 1) 
			{
				this.ParentForm.lblResult.Text = e.CurrentByteCount.ToString() + " of " + 
					e.TotalBytes.ToString() + " bytes";
				if (e.TotalBytes > 0) 
				{
					this.ParentForm.oProgress.Value = Convert.ToInt32((double) e.CurrentByteCount/(double) e.TotalBytes * 100 );
				}

			}
			else 
			{
				this.ParentForm.lblResult2.Text = e.CurrentByteCount.ToString() + " of " + 
					e.TotalBytes.ToString() + " bytes";
				if (e.TotalBytes > 0) 
				{
					this.ParentForm.oProgress2.Value = Convert.ToInt32((double) e.CurrentByteCount/(double) e.TotalBytes * 100 );
				}
			}
		}
Ejemplo n.º 3
0
		private void cmdGo_Click(object sender, System.EventArgs e)
		{

			if ( this.oHttp == null)
				this.oHttp = new wwHttp();

			wwHttp loHttp = this.oHttp;
			
//			loHttp.PostMode = 2;  // UrlEncoded
//			loHttp.HandleCookies = true;
//			if (this.txtPostData.Text.Length > 0)
//				loHttp.AddPostKey(this.txtPostData.Text);
//
//			loHttp.AddPostKey("Name","Rick Strahl ¢");
//			// loHttp.AddPostFile("TestFile",@"d:\temp\test.txt");
//			loHttp.AddPostKey("Company","West Wind Technologies");
//			if (!loHttp.AddPostFile("filename",@"D:\installs\Distribution CD\Products\wwwc_415.exe") )
//			{
//				MessageBox.Show( loHttp.ErrorMsg);
//				return;
//			}


			loHttp.OnReceiveData += new wwHttp.OnReceiveDataHandler(this.loHttp_OnReceiveData);

			// *** 
	        //string lcHtml = loHttp.GetUrl(this.txtUrl.Text.TrimEnd());

			// *** Get data with events using a 4k buffer
		    string lcHtml = loHttp.GetUrlEvents(this.txtUrl.Text.TrimEnd(),4096);
							int lnSize = lcHtml.Length;
		
			if (loHttp.Error) 
			{
				this.txtHTML.Text = loHttp.ErrorMsg;
				this.txtResponseHeaders.Text = "";
				this.txtRequestHeaders.Text = "";
			}
			else 
			{
				
				this.txtHTML.Text = lcHtml;
			   lnSize = lcHtml.Length;
				lnSize = this.txtHTML.Text.Length;
				this.txtRequestHeaders.Text = loHttp.WebRequest.Headers.ToString();
				this.txtResponseHeaders.Text = loHttp.WebResponse.Headers.ToString();
			}

			loHttp.OnReceiveData -= new wwHttp.OnReceiveDataHandler(this.loHttp_OnReceiveData);

		}
Ejemplo n.º 4
0
		public void FireUrls() 
		{
			wwHttp oHttp = new wwHttp();
			oHttp.OnReceiveData += new wwHttp.OnReceiveDataHandler(this.OnReceiveData);
			oHttp.Timeout=5;
			string lcHTML = oHttp.GetUrlEvents(this.Url,4096);
			if (oHttp.Error)
				this.ParentForm.lblResult.Text = oHttp.ErrorMsg;
		}