Jump to content
  • Advertisement
Sign in to follow this  
kappa

connecting the PDA to a webservice?

This topic is 5097 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

ok, I have this code that worked as a windows application, aka it connected to the WebService and did what it was supposed to do. But I wanted to port the same thing to a PDA and I can't get it to connect, I keep getting a webexeption when I run it.
public class Form1 : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Timer timer1;
		private System.Windows.Forms.MainMenu mainMenu1;
		static public localhost.Service1 ws = new localhost.Service1();
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.TextBox AdressField;
		private System.Windows.Forms.Label linkStatus;
		private System.Windows.Forms.Panel panel1;
		
		bool start = false;

		public Form1()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}
		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			base.Dispose( disposing );
		}
		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.mainMenu1 = new System.Windows.Forms.MainMenu();
			this.AdressField = new System.Windows.Forms.TextBox();
			this.label1 = new System.Windows.Forms.Label();
			this.timer1 = new System.Windows.Forms.Timer();
			this.button1 = new System.Windows.Forms.Button();
			this.linkStatus = new System.Windows.Forms.Label();
			this.panel1 = new System.Windows.Forms.Panel();
			// 
			// AdressField
			// 
			this.AdressField.Location = new System.Drawing.Point(72, 16);
			this.AdressField.Size = new System.Drawing.Size(160, 20);
			this.AdressField.Text = "http://laptop/Service1/";
			this.AdressField.TextChanged += new System.EventHandler(this.AdressField_TextChanged);
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(8, 16);
			this.label1.Size = new System.Drawing.Size(64, 20);
			this.label1.Text = "Service url:";
			// 
			// timer1
			// 
			this.timer1.Enabled = true;
			this.timer1.Interval = 10000;
			this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(160, 8);
			this.button1.Text = "ok";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// linkStatus
			// 
			this.linkStatus.Location = new System.Drawing.Point(16, 8);
			this.linkStatus.Text = "linkStatus";
			// 
			// panel1
			// 
			this.panel1.BackColor = System.Drawing.Color.RoyalBlue;
			this.panel1.Controls.Add(this.button1);
			this.panel1.Controls.Add(this.linkStatus);
			this.panel1.Location = new System.Drawing.Point(0, 48);
			this.panel1.Size = new System.Drawing.Size(248, 224);
			// 
			// Form1
			// 
			this.Controls.Add(this.panel1);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.AdressField);
			this.Menu = this.mainMenu1;
			this.Text = "Form1";
			this.Load += new System.EventHandler(this.Form1_Load);

		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>

		static void Main() 
		{
			Application.Run(new Form1());
		}

		private void Form1_Load(object sender, System.EventArgs e)
		{
			//MessageBox.Show( "Filen " + " har laddats ned." , "En utav dina filer har laddats ned." );
		}

		private void timer1_Tick(object sender, System.EventArgs e)
		{
			if( start )
			{
				if( ws.sendMessage( false ) )
				{
					MessageBox.Show( "Filen " + ws.GetFile() + " har laddats ned." , "En utav dina filer har laddats ned." );
				}
				timer1.Interval = 10000;
			}

		}

		private void button1_Click(object sender, System.EventArgs e)
		{
			string url = ws.Url;

			start = true;
			
			ws.Url = AdressField.Text+"Service1.asmx";

			linkStatus.Text = "Link Status: OK";

			ws.methodUrl( ws.Url );
		}

		private void AdressField_TextChanged(object sender, System.EventArgs e)
		{
		
		}
	}
}
what do I need to do diffrently? (I am running it on the emulator that came with vc2003, I got no real device avaible ).

Share this post


Link to post
Share on other sites
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!