Mobile Demo Script

Document Sample
Mobile Demo Script Powered By Docstoc
					Building Mobile Applications using Visual
Studio 2008 & .NETCF 3.5
Demo Script
Prepared by: [Demo/Script Owner(s)]   Version: 1.1                       2007-08-06

                                                     Now you can do more than ever before when you are on the GO with Windows
                                                     Mobile 6. Now you can retrieve e-mail, keep track of your schedule and your
                                                     contacts, browse the Internet, and manage business documents using mobile
                                                     versions of familiar Microsoft applications like Outlook, Office*, and Windows
                                                     Live™ for Windows Mobile*. Plus with security, scalability and manageability
                                                     enhancements, businesses now find it easier to make their mobile workforce more
Key Messages:
    1.    Unit testing is now available to mobile developers
    2.    Developers have told us that testing mobile applications is time consuming and costly. Visual Studio 2008 enables automated functional testing of
          managed code to reduce that burden
    3.    Latest Device Emulator (version 3.0)
    4.    You can now automate testing scenarios in the device emulator allowing you to simulate real world changes in device state – signal drop-off, battery
          running dead etc
    5.    .NET Compact Framework 3.5 introduces new features like LINQ as well as an implementation of the Windows Communication Foundation enabling
          device to device and device to server communication over the Exchange ActiveSync transport
    6.    Designer support for SQL Server 3.5 Compact Edition
    7.    You can now build SQL Server 3.5 Compact Edition applications using the Visual Studio 2008 designer experience

Key Technologies:
The following technologies are utilized within this demo:

 Technology / Product                                 Version                          Link

     1.    Visual Studio 2008                         RTM

     2.    NET Compact Framework                      3.5

     3.    Windows Mobile Device Center               6.1 or later           

     4.    Windows Mobile Standard &                  6                      
           Professional SDK                                                            a651-4745-88ef-3d48091a390b&displaylang=en

Opening Statement
The question is “what we could possibly see in eight demos when the device is so small?” They are very small, and they are getting smaller every day. Is sort of
ironic that the smaller they get, the more good stuff is in there

Step-by-step Walkthrough
Estimated time to complete the demo: 90 minutes.

Creating a Managed Application
 Action                                             Script                                              Screenshot

 1.   Launch Visual Studio 2008. Set it full            So, make sense here to start with the very
      screen                                             beginning.
 2.   Click File | New Project                          What I want to do is to just show you some
                                                         of the improvements we’ve made that help
                                                         getting you up and running faster, and kind
                                                         of the elegance on creating new Projects
                                                         and Solutions.

3.   Select the Smart Device tab (under Visual      So once you’ve created a new project you
     C#)                                             will see Smart Devices projects for each of
                                                     the relevant languages, and we’ve cleaned
                                                     this up a bit.
                                                    If you are familiar with doing Mobile
                                                     Development in Visual Studio 2005, you
                                                     should have seen a lot of different choices
                                                     here. This was kind of overwhelming when
                                                     performing your first task while creating a

4.   Select the Smart Device Project template       We can create a Smart Device Project,
                                                     takes to a second page here.
5.   Expand the Target platform combo and
     choose Windows Mobile 5.0 Smartphone           You start to get a few more of these
     SDK                                             options but at least there is one device
                                                     application that depends on many other
6.   Expand the .NET Compact Framework
     version combo and choose .NET Compact           options. Previously we have a lot of choices
                                                     in here.
     Framework Version 3.5
                                                    Let’s change the Target Platform; we will
                                                     pick Windows Mobile 5 Smartphone SDK.
                                                    You can choose your .NET Compact
                                                     Framework version as well.

7.   Click OK                                      So click OK, goes through create our
                                                    solution and take us right into the very nice
8.   Drag and Drop a Label and a PictureBox
                                                    form designer.
     from the ToolBox onto the Phone designer
                                                   And from here you are ready to go; all the
                                                    controls are available and ready to be
                                                    dragged and dropped.

9.   Right-click Form1.cs in the Solution          You can start building your application and
     Explorer and select View Code                  of course at some point, then go in and
                                                    start coding into it.

10. Close the solution by clicking File | Close      Let’s take a jump forward and look the
    Solution                                          application that has been built.
11. Click File | Open and select
12. Browse the directory “1- Create a
    Managed App” and open the Piano.sln
    solution file

13. Right-click Form1.cs in the Solution             So we have this great little piano
    Explorer and select View Code                     application. It’s basically a piano emulator
                                                      for your phone.
14. Show the methods
                                                     Really what I want to show you is how easy
                                                      is to manage those controls that act as
                                                      piano keys. Let’s view the code to see that
                                                      all they are actually doing is receiving those
                                                      click events and playing various system
                                                     The other thing it is doing in the button six
                                                      is playing a sound from the file system
                                                      using the new sound functions introduced
                                                      as part of .NETCF 3.5.

15. Press F5                                        We will actually deploy this into an
                                                     emulator and play a couple of these tunes.
16. In the Deploy Piano dialog, select
    Windows Mobile 6 Professional Emulator          So we start debugging and we will pick the
    and click Deploy                                 Windows Mobile 6 Professional Emulator.
                                                    It’s going to deploy NETCF 3.5 first, and
                                                     then it will deploy our application.

17. Press the Calendar button in the emulator.      We have deployed successfully. One of the
                                                     first things you will notice is it that this
                                                     application was designed in landscape
                                                     mode and the emulator is running in
                                                     portrait mode.
                                                    Hopefully, the calendar button in the
                                                     emulator allows you to rotate dynamically.

18. Click the piano keys                          So, we have now rotated. Let’s see, when I
                                                   click a piano key it sounds; that means it
                                                   works, it’s a great sign.
            Clicking at the piano key
            number six will make the
            application to throw an
 exception. Possibly the specific sound is
 not present in the emulator.

Create and run unit tests using NETCF 3.5 Test Project
Action                                         Script                                           Screenshot

1.   Close the previously opened solution by      Look very briefly at what this look like
     clicking File | Close Solution
                                                  So, create a new solution here
2.   Click File | New Project

3.   From Project Types area, select Smart         Create a new smart device project
     Device Project
4.   From Templates area, select Visual C# ->
     Smart Device
5.   Name the project “UnitTestDemo”
6.   Hit OK

7.   Select Class Library                          Let´s do a class library here
8.   Hit OK

9.   Write the following code inside Class1        Let´s add a complex math function

 public int foo(int a, int b)                      So we have done some complex math there
 {                                                 A fully functional math helper class if you
 return a + b;                                      will

10. Right click over the “foo” method name           Now, we are going to make sure that we
    and select Create Unit Test                       have a good test coverage for it
                                                     Simple right click and Create Unit Tests

11. Select the “foo” method checkbox                 It brings up a selection dialog where you
                                                      can pick the specifically the things you are
12. Hit OK
                                                      interested in testing in
                                                     We want to test the “foo” method

13. Let the default values and click the CREATE      This creates a new test project in our
    button                                            solution

14. Show Projects in Solution Explorer         So, now we have two projects. One is our

15. Go to the “fooTest” method inside the      We can go down to our “foo” test
    Class1Test.cs file

16. Change the variables values to a=3 and      Let´s go in here and put in something more
    b=2                                          interesting than zero and zero.
17. Change expected=9                           My math is a little beat off; so three and
                                                 two, if I remember is 9
18. Comment last line of code
    “Assert.Inconclusive…”                      Comment down this reminder here

19. Click Test->Run->All Tests in Solution      Let´s run it

20. The Test Result appears                     So, our tests are running and… oh my God!,
                                                 they failed

21. Change expected=5                               So, AreEqual is failed.
                                                    I don´t have a calculator with me but I´m
                                                     pretty sure that´s the reason ( the expected
                                                     variable value)

22. Click Test->Run->All Tests in Solution          Let just verify that.

23. Test pass successfully                          Now we pass and we are ready for a
24. Ensure to make a deployment of the CF in
    the emulated device if the test does not        So, unit testing is just like on the desktop,
    pass. The simple way to do so is to add a        tight integration with the device, you could
    device application project that deploys in       at this point, if you were not content, pop-
    the device and build it.                         up another emulator and run the test in
                                                     landscape mode, run the test under
                                                     different security configurations and
                                                     promote your environment, and it really
                                                     make sure its gaining back a good coverage

Device Configuration Manager
Action                                             Script                                             Screenshot

1.   Open the Solution, File -> Open ->               So we have this “secureIDE” project
2.   Select the solution inside “3- Device
     Configuration Manager” folder

3.   In Solution Explorer, double click on Form1      It`s a very simple application
                                                      Basically it will ask you to sign in

4.   Switch to Code View                              Singing here, menuItem1_Click is that
                                                       singing button
5.   Scroll down to show menuItem1_Click
     event                                            Signing will be pretty elementary, not
                                                       probably the best security model in the
                                                      It is simply going to sign you in by writing
                                                       your name to the registry.
                                                      Now, the registry in Windows Mobile is one
                                                       of those things that can be protected at a
                                                       couple of different levels

                                               So, this is a great but not the best example
                                                of writing a good secure application
                                               It is a good example of showing you how
                                                different security configuration can affect
                                                higher application run.

6.   Click Tools->Device Security Manager      Before I deploy this, I am going to the
                                                Device Security Manager

7.   Show security options                     We have this nice tool that opens up with a
                                                bunch of a default configuration
                                               So we range from a “security off” to totally
                                                “lock down”
                                               With our “one tier” model and “two tiers”
                                                model and between and then “”third
                                                party” signed

8.   Select connect to a device                 Let’s now connect to a mobile device
9.   Select the “windows mobile 6 standard
     emulator” and connect to it

10. Close the Connecting Window                 Now we close this

11. Select “Security Off”                       We have a standard emulator that pops up
12. Select “Deploy to Device” option            We will start with “Security Off”
                                                We deploy that configuration to the device

13. In Visual Studio show the Output window,      We run the solution
    from View -> Output
                                                  So we are able to sign in successfully with
14. Run the solution                               the wide open device
15. Deploy on the “windows mobile 6               We can see that it is coming in a Security
    standard emulator”                             Off
16. Click the “Sign In” button                    It is great, we have everything we need

17. Close the emulator                            We are going to completely close this just
                                                   to make sure we have a completely clean
18. Click OK if the VS makes a warning that
    the connection has been lost

19. From the Device Security Manager right        Refresh that
    panel, right click the device and select

20. Select connect to a device              
21. Select the “windows mobile 6 standard
    emulator” and connect to it

22. Close the Connecting Window                Now we close this

23. Select “Prompt Two tier”                   We have a standard emulator that pops up
24. Select “Deploy to Device” option           We will start with “Security Off”
                                               We deploy that configuration to the device

                                        Let`s do a “prompt two tiers”

25. Show the yellow bar on top          This bar shows the progress
                                        And shows that the deployment was done

26. Scroll down to show “Settings”      You see that the “Security Model” is “Two
                                        You see the “Prompt” is turned on here
                                        You see that “Unsigned CAB” are using
                                         “Authorized Users”
                                        Unsigned “Application Execution” is
                                        “RAPI Access” is restricted which allows to
                                         call functions from the desktop to the
                                         device. It will be restricted on this mode

27. Switch to “code view” of Form1                So, go back to our solution
28. Run the solution and select to deploy in      Deploy again to the standard emulator
    “Windows Mobile 6 Standard Emulator”

29. (Emulator pops-up)                            What we should see here is that we start to
                                                   hit some of those security restrictions
30. (A confirm dialog appears)
                                                  So already we are getting a security
                                                   warning about unknown publishers

31. Click Yes on the emulator                     Click through and we are getting exceptions
32. Click the left button on the telephone
    emulator to try to sing in                    Because we are trying to hit a restricted
                                                  The windows mobile can come with
                                                   different security settings and the device
                                                   security manager allows you to Test under
                                                   different conditions

33. Close the device emulator (do not save its      We will look briefly at the certificate
    state)                                           management
34. From Device Security Manager tab, select
    Certificate Management

35. Click “Refresh”                                 This time it would be a QVGA emulator
36. Connect to the Windows Mobile 6 QVGA
    Standard Emulator
37. Close the connection window

38. (Certificates appear)                           There we are
                                                    So we can see the various certificates on
                                                     the device

39. Right click on a Certificate and select          We can see the properties
                                                     Remove and add certificates

40. Close all

Using Managed Core Connectivity
Action                                            Script                                        Screenshot

1.   Open Device Explorer Solution from File ->      This is actually a desktop application
     Open -> Project/Solution
2.   Browse to DeviceExplorer.sln solution file
     in the “5- ManagedCoreCon” folder

3.   If Solution Explorer is not open, open it       What we are going to do is basically go
     from View -> Solution Explorer                   through the store of emulators on your
                                                     We are going to enumerate them
                                                     We are going to allow you to watch the

4.   Show Code of Form1 file.                    We have added this reference
5.   Show SmartDevice.Connectivity

6.   Show the Form constructor method            We have initialized our data store
                                                 The store of emulators is there

7.   Scroll down to the Form1_Load method        We are going to iterate through each
                                                  emulator and display them

8.   Run the solution, pressing F5               You can see the list of emulators

9.   Select one Emulator from the list           We can pick one of those and connect
10. Click the Connect button
11. If fails, try choosing another emulator      So, the emulator pops-up
    from the list

Device Emulator Manger Automation Support
Action                                         Script                                          Screenshot

19. In Visual Studio, select Tools -> Device      This is the device emulator manager
    Emulator Manager

20. Show the Device Emulator Manager              Not all of the emulators may work

21. Select an Emulator from the list              You can choose a specific emulator
22. Right click on the selected emulator          Right click on it
23. Select “Connect”                              Connect to the emulator

24. Show the play button image                    Once your are connected you have a little
                                                   green play go button to show that it is

25. Right click on the emulator in the list         You have expanded options
                                                    So at this point you can cradle, you can
                                                     shut down, you can save state and you can

26. In the device emulator window, select File      Let´s start with the configuration options
    -> Configure
                                                    Let`s see some things you can do with your
27. Select the General tab                           emulator

28. Show Shared Folder                              You can set a shared folder which basically
                                                     emulates having a storage card
                                                    You can select a directory in your desktop
                                                     that will appear as the store card, If you
                                                     have another resources you need to access
                                                    Some of this options are tilt down, because
                                                     they need to be set before the emulator

29. Select the Display tab                         You can change your skins
                                                   You can change your video settings
                                                   We can force it to be on top
                                                   You can zoom your emulator which is
                                                    useful for presentations

30. Select the Network tab                         The emulator supports networking
                                                   You can have your emulator hooked up and
                                                    use the network connection of your

31. Select the Peripherals tab                     You can have your emulator hooked up to
                                                    various peripherals

32. In the Device Manager Emulator, right          Finally what I want to show is saving this
    click on the running one and select “Save       configuration
    As” option
33. Save configuration to a file

34. Open the saved configuration file with a      This are simple xml files
    text editor
                                                  You can see it is capturing all the settings
                                                   that we just went through

35. Close the text editor and the emulator

DE Battery Emulator
Action                                         Script                                             Screenshot

1.   Launch Visual Studio 2008. Set it full       What I want to show you now is how we
     screen                                        can work with the emulator and actually
                                                   change the runtime state, in this case the
2.   Click File | Open and select
                                                   battery state.
3.   Browse the directory “7- DE Battery          I’ll show you some of the functionalities
     Emulator” and open the                        Windows Mobile has around catching those
     WindowsApplication2.sln solution file         events.

4.   Add a reference to DEMComInterface.dll
     located in the Assets folder.

5.   Press F5                           This is a very simple desktop application
                                         that allows you to launch the emulator and
6.   Click Connect
                                         then programmatically set the battery
                                        Let’s launch it and connect to an emulator.

7.   Click “Start” in the emulator      Let’s navigate through the emulator
                                         settings and see if we can find the battery
8.   Click “Settings”
9.   Select the “System” tab

10. Click “Power”                       We can see a hundred percent, that’s good

11. Switch to “Automate Device Emulator”            Let`s go back to the Device Emulator
    window                                           window

12. Scroll down the “Slide to control Battery”      We scroll down and we can see this starts
    progress bar gradually                           to decrease, and decrease until it gets
                                                     really low (4%). We start to get low battery
                                                    From the emulator’s perspective it’s a real
                                                     physical device that is draining.

13. Scroll up the “Slide to control Battery”        The other thing this demo demonstrates is
    progress bar to 100%                             a situation where you can turn the Drain
                                                     mode on and have it programmatically
14. Click “Drain” button
                                                     draining over time.
                                                    So here we have a draining about one
                                                     percent every second.
                                                    One of the areas where this is useful is
                                                     having your application be aware of the
                                                     battery state and do intelligent things.

15. Click the “End” button                          We will end the draining

Cellular Emulator
Action                                         Script                                              Screenshot

1.   Open Device Emulator Manager from            So here is our Cellular Emulator
     Tools -> Device Emulator Manager
2.   Open Cellular Emulator from Start | All
     Programs | Windows Mobile 6 SDK | Tools
     | Cellular Emulator

3.   Show the Cellular Emulator                   It has very different tabs for every piece of
4.   Take note of the COM port at the bottom
     left                                         When you first watch it the first thing you
                                                   should do is take note in the bottom left
                                                   corner of the COM port in use.

5.   Press the Refresh button from the Device        Then we are going to launch our emulator
     Emulator Manager

6.   Right click on the Windows Mobile 6             Let`s use the Standard Emulator
     Standard Emulator, select Connect
                                                     So, we will connect to that

7.   In the device emulator window, select File      You need to configure it and map the serial
     -> Configure                                     port

8.   Go to Peripherals tab                       So, we map the port
9.   Put the COM port you have taken note
     before and click OK.

10. Do a Soft Reset in the Device Emulator,      So, the configuration settings should persist
    from File -> Reset ->Soft
                                                 So we pick up that fake radio network

11. In the Cellular Emulator, set the Phone      Something we can do is to call up the
    Number to 1234 and click Dial                 device
                                                 And we have got a call coming in

12. Answer it with the left button of the        We can answer it
13. Then end the communication hanging off

14. In the Cellular emulator notice the busy      We can make calls and we get a busy
    number                                         answer
15. Male a call from the Device Emulator to       Notice the numbers we can call to get a
    that number                                    busy answer, a reject or no answer

16. Call the device twice from the Cellular       We will call again
                                                  Other thing we can do is to emulate
                                                   simultaneous calls

17. In the Device Emulator, switch to the         We can switch to various network types
    Network tab

18. Click the network buttons                     Notice in the phone emulator on the top,
                                                   how the network changes
19. Show the Device Emulator and how the
    network icon changes

20. Switch to the SMS tab                       We can send a SMS
21. Write and send a SMS                        And determine from which number it will
                                                 be came from

22. Receive the message in the Device           We have got the SMS

23. Re-play the message back writing some       We can re-play back
                                                You can type in your keyboard, this is
                                                 another thing why the emulator is great

24. (The SMS is received on SMS tab in the      Look how we receive the message
    grid at bottom)

 25. Switch to the Injection tab                      We can do injection of the AT commands
                                                      We can send event to the device

 26. Switch to the Configuration tab                  We can change the configuration of this
                                                      We can simulate using a different SIM

 27. Switch to the AT log tab                         We can inspect the log of the control

 28. END                                              So it is a really powerful application when
                                                       you are developing and testing.

You have seen how to create a managed application and run unit tests. You have also seen the Device Configuration Manager tool, the Cellular Emulator tool.


Shared By: