MSDN Magazine - January 2008 - (Page 29) Now I must get the selected Customer record from the Web service’s GetCustomer Web method. I use the CustomerID that was selected from the previous form and call the GetCustomer Web method. The Customer entity that is returned is then set to the Data source of the customerBindingSource control on the CustomerDetail form. I now test the application again in the emulator, and I see the screen shown in Figure 6. store the Customer entity as a private field of the CustomerDetail form so you can readily access it when you need to pull the data out of the controls and back into the entity. Since bandwidth may be limited and processors on mobile devices are slower than desktop computers, it is important that you only pass the minimum amount of Mobile Binding Options data needed by the application. In my sample applicaIt is very easy to implement automatic binding using tion, I retrieved a list of Customer entities, but only used the BindingSource control in a mobile device applicatwo of the properties of each entity. This wasted a lot of tion. It works similarly to how the BindingSource conbandwidth for the CustomerPicker screen since it had trol works in a Windows Forms application, with the to go and get all of the data for all of the customers. notable exception being the lack of a BindingNavigator Figure 5 Customized A more efficient approach would be to create a method control. Since mobile apps don’t have a BindingNavigator Data Source that retrieves just the CustomerID and CompanyName control, you have to write code for navigating from one record to for each customer. Considerations like these are important to rethe next if you want that functionality. I tend to avoid that type member when tuning your mobile application, as performance isof feature since it is typically used when retrieving a large list of sues like these may not show up in a desktop application. items. This can affect performance in a mobile application, as the mobile device usually has limited bandwidth. So the lack of Final Thoughts a BindingNavigator is not a bad thing since it reminds you to be Before you dive into mobile development, it is important that economical with bandwidth. you get yourself properly set up. You must make sure you have the BindingSource takes the headache out of manually getting the val- right emulator manager version, the appropriate emulators, the corues from the entity and stuffing them into the controls rect SDKs, and the necessary version of ActiveSync on the form. When saving a record, BindingSource or Windows Mobile Device Center. When I ran my also eliminates the hassle of retrieving the values application on Windows Vista, the emulator would from the form’s controls and pulling them back into not communicate with my Web service until I inan entity. The downside of a BindingSource is that stalled the Windows Mobile Device Center 6.1 and loading data can be slightly slower than when loadthe Device Emulator Manager 2. These are imporing data manually. tant updates to the software that must be installed I still recommend using the BindingSource conwhen running in Windows Vista, even when targettrol unless the performance difference is too great ing Windows Mobile 5.0. during your tests. I, however, have often found its If you get an error when trying to get ActiveSync performance to be adequate. The automatic binding to see your emulator, make sure that ActiveSync is you get when you use the BindingSource control is set to communicate through DMA. If you get an also very useful when you need to bind the same set error when trying to access your Web service, make of data to multiple controls. sure the Web service uses your server’s name, as opChanging to manual binding is simple. All it reposed to localhost. Localhost will work fine on your quires is removing the BindingSource control, clearing PC, but when the emulator tries to reconcile localthe Data source settings of the controls on the form, Figure 6 Application host, it will not know that you meant your computand writing some code to manually load each value Running in the Emulator er’s Web server. Another good tip is to make sure you from the entity into the corresponding control, like this: connect and cradle your emulated device so it can communicate with the local PC. using (RemoteService.CustomerWebService svc = new RemoteService.CustomerWebService()) { If you need information about deploying your application to a RemoteService.Customer customer = svc.GetCustomer(_customerID); real mobile device, check out my December 2006 installment of companyNameTextBox.Text = customer.CompanyName; customerIDLabel1.Text = customer.CustomerID; Data Points, “RSS Feeds on a Smartphone” (which is available at } Fine-Tuning Your Mobile App msdn.microsoft.com/msdnmag/issues/06/12/DataPoints). Note that when using a manual technique, you must also account for how to extract the data from the controls when the user wants to save the data. It’s a simple procedure of grabbing the values from the controls and pulling them into an entity, but it is an extra step that you must handle when you want to allow users to save information. A common practice with manual binding is to Code download available at msdn.microsoft.com/msdnmag/code08.aspx. Send your questions and comments for John to mmdata@microsoft.com. John Papa is a Senior .NET Consultant with ASPSOFT (aspsoft.com) and a baseball fanatic who spends most of his summer nights rooting for the Yankees with his family and his faithful dog, Kadi. John, a C# MVP, has authored several books on ADO, XML, and SQL Server. He can often be found speaking at industry conferences, such as VSLive, or blogging at codebetter.com/ blogs/john.papa. Data Points january2008 29 http://msdn.microsoft.com/msdnmag/issues/06/12/DataPoints http://msdn.microsoft.com/msdnmag/code08.aspx http://aspsoft.com http://codebetter.com/blogs/john.papa http://codebetter.com/blogs/john.papa
Table of Contents Feed for the Digital Edition of MSDN Magazine - January 2008 MSDN Magazine - January 2008 Contents Toolbox CLR Inside Out Data Points Advanced Basics Cutting Edge IIS 7.0 - Enhance Your Apps with the Integrated ASP.NET Pipeline World Ready - Around the World with ASP.NET AJAX Applications WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 Wicked Code Foundations Extreme ASP.NET {End Bracket} MSDN Magazine - January 2008 MSDN Magazine - January 2008 - Contents (Page Cover1) MSDN Magazine - January 2008 - Contents (Page Cover2) MSDN Magazine - January 2008 - Contents (Page 1) MSDN Magazine - January 2008 - Contents (Page 2) MSDN Magazine - January 2008 - Contents (Page 3) MSDN Magazine - January 2008 - Contents (Page 4) MSDN Magazine - January 2008 - Contents (Page 5) MSDN Magazine - January 2008 - Contents (Page 6) MSDN Magazine - January 2008 - Contents (Page 7) MSDN Magazine - January 2008 - Contents (Page 8) MSDN Magazine - January 2008 - Contents (Page 9) MSDN Magazine - January 2008 - Contents (Page 10) MSDN Magazine - January 2008 - Toolbox (Page 11) MSDN Magazine - January 2008 - Toolbox (Page 12) MSDN Magazine - January 2008 - Toolbox (Page 13) MSDN Magazine - January 2008 - Toolbox (Page 14) MSDN Magazine - January 2008 - Toolbox (Page 15) MSDN Magazine - January 2008 - Toolbox (Page 16) MSDN Magazine - January 2008 - CLR Inside Out (Page 17) MSDN Magazine - January 2008 - CLR Inside Out (Page 18) MSDN Magazine - January 2008 - CLR Inside Out (Page 19) MSDN Magazine - January 2008 - CLR Inside Out (Page 20) MSDN Magazine - January 2008 - CLR Inside Out (Page 21) MSDN Magazine - January 2008 - CLR Inside Out (Page 22) MSDN Magazine - January 2008 - CLR Inside Out (Page 23) MSDN Magazine - January 2008 - CLR Inside Out (Page 24) MSDN Magazine - January 2008 - CLR Inside Out (Page 25) MSDN Magazine - January 2008 - CLR Inside Out (Page 26) MSDN Magazine - January 2008 - Data Points (Page 27) MSDN Magazine - January 2008 - Data Points (Page 28) MSDN Magazine - January 2008 - Data Points (Page 29) MSDN Magazine - January 2008 - Data Points (Page 30) MSDN Magazine - January 2008 - Data Points (Page 31) MSDN Magazine - January 2008 - Data Points (Page 32) MSDN Magazine - January 2008 - Advanced Basics (Page 33) MSDN Magazine - January 2008 - Advanced Basics (Page 34) MSDN Magazine - January 2008 - Advanced Basics (Page 35) MSDN Magazine - January 2008 - Advanced Basics (Page 36) MSDN Magazine - January 2008 - Advanced Basics (Page 37) MSDN Magazine - January 2008 - Advanced Basics (Page 38) MSDN Magazine - January 2008 - Advanced Basics (Page 39) MSDN Magazine - January 2008 - Advanced Basics (Page 40) MSDN Magazine - January 2008 - Advanced Basics (Page 41) MSDN Magazine - January 2008 - Advanced Basics (Page 42) MSDN Magazine - January 2008 - Cutting Edge (Page 43) MSDN Magazine - January 2008 - Cutting Edge (Page 44) MSDN Magazine - January 2008 - Cutting Edge (Page 45) MSDN Magazine - January 2008 - Cutting Edge (Page 46) MSDN Magazine - January 2008 - Cutting Edge (Page 47) MSDN Magazine - January 2008 - Cutting Edge (Page 48) MSDN Magazine - January 2008 - Cutting Edge (Page 49) MSDN Magazine - January 2008 - Cutting Edge (Page 50) MSDN Magazine - January 2008 - Cutting Edge (Page 51) MSDN Magazine - January 2008 - IIS 7.0 - Enhance Your Apps with the Integrated ASP.NET Pipeline (Page 52) MSDN Magazine - January 2008 - IIS 7.0 - Enhance Your Apps with the Integrated ASP.NET Pipeline (Page 53) MSDN Magazine - January 2008 - IIS 7.0 - Enhance Your Apps with the Integrated ASP.NET Pipeline (Page 54) MSDN Magazine - January 2008 - IIS 7.0 - Enhance Your Apps with the Integrated ASP.NET Pipeline (Page 55) MSDN Magazine - January 2008 - IIS 7.0 - Enhance Your Apps with the Integrated ASP.NET Pipeline (Page 56) MSDN Magazine - January 2008 - IIS 7.0 - Enhance Your Apps with the Integrated ASP.NET Pipeline (Page 57) MSDN Magazine - January 2008 - IIS 7.0 - Enhance Your Apps with the Integrated ASP.NET Pipeline (Page 58) MSDN Magazine - January 2008 - IIS 7.0 - Enhance Your Apps with the Integrated ASP.NET Pipeline (Page 59) MSDN Magazine - January 2008 - IIS 7.0 - Enhance Your Apps with the Integrated ASP.NET Pipeline (Page 60) MSDN Magazine - January 2008 - IIS 7.0 - Enhance Your Apps with the Integrated ASP.NET Pipeline (Page 61) MSDN Magazine - January 2008 - IIS 7.0 - Enhance Your Apps with the Integrated ASP.NET Pipeline (Page 62) MSDN Magazine - January 2008 - IIS 7.0 - Enhance Your Apps with the Integrated ASP.NET Pipeline (Page 63) MSDN Magazine - January 2008 - World Ready - Around the World with ASP.NET AJAX Applications (Page 64) MSDN Magazine - January 2008 - World Ready - Around the World with ASP.NET AJAX Applications (Page 65) MSDN Magazine - January 2008 - World Ready - Around the World with ASP.NET AJAX Applications (Page 66) MSDN Magazine - January 2008 - World Ready - Around the World with ASP.NET AJAX Applications (Page 67) MSDN Magazine - January 2008 - World Ready - Around the World with ASP.NET AJAX Applications (Page 68) MSDN Magazine - January 2008 - World Ready - Around the World with ASP.NET AJAX Applications (Page 69) MSDN Magazine - January 2008 - World Ready - Around the World with ASP.NET AJAX Applications (Page 70) MSDN Magazine - January 2008 - World Ready - Around the World with ASP.NET AJAX Applications (Page 71) MSDN Magazine - January 2008 - World Ready - Around the World with ASP.NET AJAX Applications (Page 72) MSDN Magazine - January 2008 - World Ready - Around the World with ASP.NET AJAX Applications (Page 73) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 74) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 75) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 76) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 77) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 78) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 79) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 80) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 81) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 82) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 83) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 84) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 85) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 86) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 87) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 88) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 89) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 90) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 91) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 92) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 93) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 94) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 95) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 96) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 97) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 98) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 99) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 100) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 101) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 102) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 103) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 104) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 105) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 106) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 107) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 108) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 109) MSDN Magazine - January 2008 - WCF Syndication - HTTP Programming with WCF and the .NET Framework 3.5 (Page 110) MSDN Magazine - January 2008 - Wicked Code (Page 111) MSDN Magazine - January 2008 - Wicked Code (Page 112) MSDN Magazine - January 2008 - Wicked Code (Page 113) MSDN Magazine - January 2008 - Wicked Code (Page 114) MSDN Magazine - January 2008 - Wicked Code (Page 115) MSDN Magazine - January 2008 - Wicked Code (Page 116) MSDN Magazine - January 2008 - Foundations (Page 117) MSDN Magazine - January 2008 - Foundations (Page 118) MSDN Magazine - January 2008 - Foundations (Page 119) MSDN Magazine - January 2008 - Foundations (Page 120) MSDN Magazine - January 2008 - Foundations (Page 121) MSDN Magazine - January 2008 - Foundations (Page 122) MSDN Magazine - January 2008 - Foundations (Page 123) MSDN Magazine - January 2008 - Foundations (Page 124) MSDN Magazine - January 2008 - Foundations (Page 125) MSDN Magazine - January 2008 - Foundations (Page 126) MSDN Magazine - January 2008 - Extreme ASP.NET (Page 127) MSDN Magazine - January 2008 - Extreme ASP.NET (Page 128) MSDN Magazine - January 2008 - Extreme ASP.NET (Page 129) MSDN Magazine - January 2008 - Extreme ASP.NET (Page 130) MSDN Magazine - January 2008 - Extreme ASP.NET (Page 131) MSDN Magazine - January 2008 - Extreme ASP.NET (Page 132) MSDN Magazine - January 2008 - Extreme ASP.NET (Page 133) MSDN Magazine - January 2008 - Extreme ASP.NET (Page 134) MSDN Magazine - January 2008 - Extreme ASP.NET (Page 135) MSDN Magazine - January 2008 - {End Bracket} (Page 136) MSDN Magazine - January 2008 - {End Bracket} (Page Cover3) MSDN Magazine - January 2008 - {End Bracket} (Page Cover4)
For optimal viewing of this digital publication, please enable JavaScript and then refresh the page. If you would like to try to load the digital publication without using Flash Player detection, please click here.