Hands-On Lab: Mobile Communication Developing Mobile Application with .NET Dr. Liers, Dr. Ritter, Tian --PR MC SS02-- http://www.inf.fu-berlin.de/inst/ag-tech/teaching/LehreFUSeiten/SS02/19592-P/index.html Demo How to Create a Web Service with VS.NET Use http://localhost/...... as server Dr. Liers, Dr. Ritter, Tian --PR MC SS02-- http://www.inf.fu-berlin.de/inst/ag-tech/teaching/LehreFUSeiten/SS02/19592-P/index.html Demo How to Create a Mobile Web Application with MMIT Use http://localhost/...... as server Dr. Liers, Dr. Ritter, Tian --PR MC SS02-- http://www.inf.fu-berlin.de/inst/ag-tech/teaching/LehreFUSeiten/SS02/19592-P/index.html GUI Programming With Multiple Forms 1/4 Handle forms like classes Form1.cs public class Form1() {…} Form2.cs public class Form2() {…} Dr. Liers, Dr. Ritter, Tian --PR MC SS02-- http://www.inf.fu-berlin.de/inst/ag-tech/teaching/LehreFUSeiten/SS02/19592-P/index.html GUI Programming With Multiple Forms 2/4 The initial form has a main() method Assuming: Form1 is the initial form: public class Form1 : System.Windows.Forms.Form { ... [STAThread] static void Main() { Application.Run(new Form1()); } ... } Dr. Liers, Dr. Ritter, Tian --PR MC SS02-- http://www.inf.fu-berlin.de/inst/ag-tech/teaching/LehreFUSeiten/SS02/19592-P/index.html GUI Programming With Multiple Forms 3/4 Create an instance of other forms before displaying it or working with any controls or properties public class Form1 : System.Windows.Forms.Form { Form2 form2 = new Form2(); ... form2.setSomeProperty(value); Value v = form2.getSomeProperty(); ... form2.show(); ... } Dr. Liers, Dr. Ritter, Tian --PR MC SS02-- http://www.inf.fu-berlin.de/inst/ag-tech/teaching/LehreFUSeiten/SS02/19592-P/index.html GUI Programming With Multiple Forms 4/4 Pass the reference of your form to any code that needs access to your form Assuming: Form2 needs to set some property in Form1: public class Form2 : System.Windows.Forms.Form { private Form1 form1=null; public void setForm1(Form1 form) { this.form1= form; } /*this method is called by Form1 like this: private void goToF2Button_Click(object sender, System.EventArgs e) { f2.setValueOnForm2(this.textBox1.Text); f2.setForm1(this); f2.Show(); }*/ private void goToF1button_Click(...) { if (form1 == null) {Error(); return;} form1.setPropertyOnForm(value); form1.Show(); } } Dr. Liers, Dr. Ritter, Tian --PR MC SS02-- http://www.inf.fu-berlin.de/inst/ag-tech/teaching/LehreFUSeiten/SS02/19592-P/index.html API A listing of .NET framework classes you might use is available on the web page for this hands-on lab No socket programming necessary Dr. Liers, Dr. Ritter, Tian --PR MC SS02-- http://www.inf.fu-berlin.de/inst/ag-tech/teaching/LehreFUSeiten/SS02/19592-P/index.html Using help and docs Using built-in Docs and Helps in VS.NET VS .NET Documentation http://msdn.microsoft.com/ www.google.de A lot of example code available in the documentations Demo (XmlDocument) Dr. Liers, Dr. Ritter, Tian --PR MC SS02-- http://www.inf.fu-berlin.de/inst/ag-tech/teaching/LehreFUSeiten/SS02/19592-P/index.html Pay Attention Please do not install any software on the computers in the lab without permission Don’t forget to backup your files Dr. Liers, Dr. Ritter, Tian --PR MC SS02-- http://www.inf.fu-berlin.de/inst/ag-tech/teaching/LehreFUSeiten/SS02/19592-P/index.html Developing Mobile Application with .NET Have Fun! Dr. Liers, Dr. Ritter, Tian --PR MC SS02-- http://www.inf.fu-berlin.de/inst/ag-tech/teaching/LehreFUSeiten/SS02/19592-P/index.html