다음을 통해 공유


Windows Phone 7 Series Programming Model

Bidar - Barid Shahi tombs

Just sometime back I posted on the MIX 2010 announcements. One of the major aspects of the announcement was

“The application model supported on Windows Phone 7 series will be managed only and will leverage Silverlight, XNA and the .NET Framework”

That’s a mouthful and includes 3 framework names in once sentence :). This was already disclosed and has resulted in some flutter over the web and twitter. Let me try to explain how these 3 interplays in the application model with the following diagram

image

Managed only

First of all the application model allows users to write only managed code(to repeat native code is not allowed). That means they do not have direct access to any native APIs and cannot use platform-invoke to call into native user or system code. So all resources including phone capabilities have to be accessed using the various managed APIs provided.

Two Flavors of applications (XNA and Silverlight)

There are 2 variants or flavors of applications users can write, XNA Games and Silverlight applications. Obviously the former is for writing games and the later is for your typical phone applications (nothing stops you from writing a Silverlight animation based game though). So you cannot mix-match SL and XNA UI in the same application.

However, do note that the traditional NETCF development using WinForm based UI is not supported.

Common Services available to both

That said, beyond the UI rendering and controls there is the common services which both SL and XNA applications can use. This includes all the phone capabilities like microphone, location, accelerometer, sound, media, networking, etc... Some of these features come from SL and others from XNA but land up in the common pool usable by either types of applications.

Core Runtime is .NET Compact Framework 3.7

The core runtime for both SL and XNA applicationsis .NET Compact Framework (henceforth called NETCF). This is the team I work for.  .NETCF is a highly portable and compact (as in smaller size and footprint) implementation of the .NET specification. It is designed to run on resource constrained devices and on disparate HW and SW configurations.I will have a post later on the detailed architecture or .NETCF.

Over the last two years a lot of work has gone into .NETCF to scale it in terms of features, performance and stress to meet the requirements of Windows Phone and other newer platforms on which it is being targeted. We also added a lot of features which I hope you will enjoy. Some of the features is just to reach parity with the desktop CLR and others are device specific and not available on the desktop.

Over this blog in the course of the coming months I’ll try to share with you what all we did to reach here.

Comments

  • Anonymous
    March 16, 2010
    Firstly, can you confirm applications running on Compact Framework 3.5 cannot run on Phone 7 ? Secondly, how does an enterprise deploy a LOB application on Windows Phone 7? For many enterprise LOB applications it simply wouldn't be appropriate to deploy the application via a Marketplace portal open to the general public.

  • Anonymous
    March 16, 2010
    NETCF 3.5 applications will not run on the Windows Phone 7. Recarding #2, that is outside my area of expertise. It is however, being discussed in the forum http://social.msdn.microsoft.com/Forums/en-US/windowsphone7series/thread/71769792-db5b-45df-a498-49a0f21bf9c6

  • Anonymous
    March 16, 2010
    Will NETCF 3.7 be released as a stand alone release for platform builders? Will I be able to get NETCF3.7 and integrate it on a MIPSII device? the same question apply to SL and XNA. or are these 3 framework only for the Mobile Phones? Thanks, Fowzi

  • Anonymous
    March 16, 2010
    Fowzi, right now NETCF 3.7 is targetted only for Windows Phone 7 series for both the Silverlight and XNA variants. Currently there is no work underway to make it available for integration to other platforms.

  • Anonymous
    March 16, 2010
    Why did you remove features from the NETCF in this release, which were available in previous versions of the CF, such as XmlDocument or HttpWebRequest.GetResponse()?

  • Anonymous
    March 17, 2010
    System.IO.Compression was an important block. Why remove it from .NET CF 3.7? What's the rationale? Where can we get a clear list of changes between .NET CF 3.5 and 3.7?

  • Anonymous
    March 17, 2010
    Martin, I do not think approaching WP programming model from the pre-existing NETCF 3.5 will help. The differences between them are of the same magnitude as the difference between WinForm and Silverlight on desktop. On Windows Phone NETCF provides the runtime and implements Silverlight 3 surface area (with a small delta). If something isn't present in Silverlight it's not present in Windows Phone. There is no list comparing NETCF 3.5 with WP7 programming model as we didn't approach it that way. On WP you need to target the silverlight surface area and there are documentation around the delta between Silverlight and WP7. I do understand your pain. Please do understand that the current bits are early preview bits. Hopefully soon we will have guidance for existing NETCF customers to move to the new programming model.

  • Anonymous
    March 17, 2010
    Its good to know that WP7 development can be done using managed code. However, where can I find APIs to deal with POOM? Previously, it was in WM SDK. Now, will it be available in (may be) next version of WP7 SDK? Apart from this, how can I handle calls, sms (Phone.Talk() kind of)? Where can I find tool like Cellular Emulator? I know, these are too many questions, but its pretty exciting to work on WP development.

  • Anonymous
    March 29, 2010
    The comment has been removed

  • Anonymous
    March 29, 2010
    Rene sorry for the experience you had. However, did you see the MIX demos? We actually have realtime 2D/3D games and a lot of very resource hungry apps running over this. Traditionally large SQLCE based apps also run well on NETCF. NETCF is JITted and not interpreted byte code. I think that you should've contacted us when you ran into the problem you mention so that we could've helped you in fixing your code so that it worked correctly.

  • Anonymous
    March 30, 2010
    Hi abhinaba, Thank you for your reply, and I wish I DID ask for your help at the time.  Besides the slow performance of NETCF, I had a bad experience with SQLCE too. My original app was written in eVC++ with a CEDB database.  Performance was fine, but ActiveSync would crash if I inserted more than 2400 records into a single Pocket Access table.   The SQLCE format allowed more records, but my 380kb .cdb database grew to more than 800kb in .sdf format, which is unacceptable. Also, data replication with SQL Server was buggy.  A later (incompatible) version of SQLCE fixed this bug, but required .netcf2! The DB size was still too bloated though. When I dumped .netcf and switched to FreePascal, I wrote my own little database engine, which is faster, and stores the same data in just 46kb. SQLCE's .sdf database is a very bloated format indeed. To be honest, much of my trouble was probably due to the fact that I was using an early version of SQLCE, with .NETCF 1.0, and the Delphi for .NNET Compact Framework preview compiler.  Maybe things have improved since those days, but for now I'll rather play it safe and switch to Android. (iPhone's SDK EULA is too restrictive.) Both iPhone and Android started off banning native code too, but they both came to their senses, and eventually released a native code SDK.  Maybe Microsoft will too?

  • Anonymous
    April 04, 2010
    Hi abhinaba, Currently I'm using OMA Client Provisioning for device management in WM6. Can I use it in WM7? Thanks.

  • Anonymous
    April 04, 2010
    Sorry Panam I have no idea about OMA please post the query on the WP7 forums

  • Anonymous
    April 09, 2010
    Hi abhinaba, I'm still a bit reluctant to abandon WinCE in favour of Android.  It would be a shame to lose the OpenGL ES and eVC++ skills I learned on WinCE. Although I think .netCF is too slow, I know that Android's Java is even slower. But, at least Android has OpenGL ES, SQLite and allows native C++ for speed critical code. Will OpenGL ES and native C++ be available for WP7 some time in the future, or will it remain .netCF and XNA only? I learned the hard way to avoid Mobile DirectX, .netCF and SQLCE on WinCE. There would have to be some major improvements to all three if they are to stand a chance.

  • Anonymous
    April 09, 2010
    Rene the last time you used .NETCF was 1.0? That was like 10 years ago. Today on WP7 we are successfully running 3D XNA games with great performance. I'd suggest you actually give this a spin before making up your mind

  • Anonymous
    April 09, 2010
    Thank you abahinaba, My .NetCF 1.1 project was 6 years ago, so I'll take your advice and give it another try. However just last year I was involved in a major project to convert an evC++ Mobile DirectX application to use OpenGL ES, since mobile DirectX was performing poorly and seemed to be abandoned by Microsoft.  Its too late to switch back now, hence my frustration. Our GPU/hardware manufacturer also insists that OpenGL ES is the way to go, and no longer support mobile DirectX on their latest GPU's. OpenGL ES certantly is easier to use too.

  • Anonymous
    April 21, 2010
    Unbelievable that Microsoft completely abandoned its entire corporate base.  The tons of time and resources spent on NETCF/SQCE applications will be a complete waste in a year or so when WM6.5 phones are no longer available.  Silverlight is worthless for secure data-intensive business apps.  

  • Anonymous
    April 26, 2010
    @Dave - the corporate base hasn't been eliminated. Microsoft's approach for this operating system was to focus on the features most important for a good consumer experience. Corporate needs will be addressed later. Keep in mind the first release of Windows Phone will not be a feature complete release. Also unlike previous versions of Windows Mobile you'll find that Windows Phone 7 will be getting updates. On Windows Mobile a device was pretty much feature locked when you received it. If you were lucky you may have gotten one firmware update but beyond that the capabilities of the OS on the day you got your device would never change. Since Microsoft will be pushing updates with WP7 features that are missing at launch may be available later.

  • Anonymous
    September 01, 2010
    Is it possible to connect windows server 2003/2008 active directory using windows phone 7(without web service/wcf)? i tried, but i didn't get any solution for that.

  • Anonymous
    October 13, 2010
    The comment has been removed

  • Anonymous
    October 13, 2010
    The comment has been removed

  • Anonymous
    February 27, 2011
    Hi Abhinaba; We have an application that is developed using Win32 SDK ( C++ ) for Windows Smart phone (5 to 6.5)  which interacts with API that gives us various events such as, Call has ended and details of it, SMS sent / received and its details , addition of custom menu in POUTLOOK for accessing the email and inter process communication using Win32 SDK message passing etc. For this to happen the application runs constantly in the background. Whats the possibility of porting this application to Windows Phone 7  ? From the above post is seems its not possible (at least for now ! or never !!! ). Waiting for your reply.....Thanks and Regards, Kaiwalya Joshi...

  • Anonymous
    March 10, 2011
    The comment has been removed