Win32 Vs .NetCF Vs Silverlight
Windows 32 Programming
Win32 is the core API of Microsoft Windows CE. If the operating system supports a feature, it must by definition be supported in Win32. It is portable to a wide range of Windows CE platforms, such as a device driver, using Win32 makes a lot of sense.
- The Win32 API, does not have binary portability. It needs to be rebuild for the co-responding platforms say ARM, MIPS and etc.
- Win32 has source-code portability, so the same source code can be used to build executable files for various platforms say MIPS, ARM and etc…
- Win32 the best choice for low-level components that must run on many different configurations of Windows CE.
- Executables are light weight and fastest.
- Supports real-time application with great extern.
- Source code (inter-platform) portability.
- Win32 are extensively used to create device drivers.
- Control panel applets are extensively written using Win32.
- Highly Secured.
- Building Simple Object Access Protocol (SOAP) for Web Servers.
Challenges of Native Code
Lacking OOP support, Win32 is a function-oriented API. Arcane function names are not the worst of Win32 problems. Of more concern is that the API is prone to memory leaks. The term “memory leak” refers to memory that is allocated but not cleaned up correctly. Memory leaks create problems on all systems, but such problems are emphasized on Windows Mobile devices with their small amount of RAM (compared to desktop systems) and the standard practice of having problems continually running for weeks and months. Under these constraints, memory leaks may cause devices to lock up.
Applications that create certain operating system objects must make sure to also delete these objects or risk leaking memory. Whereas most objects are cleaned up when a process stops, this still creates a problem for processes which must run continuously. Such processes must be carefully crafted and tested to make sure that they are free from memory leaks.
Generally, developers who write managed code do not have to worry about leaking Win32 objects. Microsoft managed libraries do allocate Win32 objects. But the “managed wrappers” are built to make sure that the underlying Win32 objects are cleaned up correctly.
A device requires real time performance with light weight UI, can opt Win32/GDI programming, specifically in medical/Industrial devices requires to showing graphs/readings in a real time manner.
.NET Compact Framework
.NET Compact Framework is a hardware-independent environment that supports building and running managed applications on resource-constrained computing devices. The .NET Compact Framework inherits the full .NET Framework architecture of the common language run-time and managed code execution, supports a subset of the .NET Framework class library, and contains classes designed exclusively for the .NET Compact Framework. The .NET Compact Framework supports Visual Basic and Visual C# development, but does not currently support Managed C++ development.
- .NET CF available for the devices based on Windows Mobile for Pocket PC, Windows Mobile for Smartphone and Windows CE platforms
- .NET CF is a Managed Code
- Not require any special prerequisites other than .NET Compact Framework
- User Interface explicit redrawing by using paint event and images over the controls and forms
- Animations can’t be done simply
- Gradients can be applied through code for the rich UI design but doesn’t support Opacity on Win CE.
- It does not support any type of coordinate transformations, and in particular there is no support for the rotation of bitmaps
- It supports built-in layouts with Panel, Container, Group Box classes and etc.
- Customization cab be done by creating custom controls by which we can define additional or override properties, methods, and events on common controls, build a compound control and define how a control responds to user actions.
- .NET CF – is much easier and faster to develop a stable application especially when developing an application using communication and/or database functions, .NET CF saves us enormous on development time.
- The .NET Compact Framework provides the ability to build a dialog-style user interface by using one of two languages: C# or Microsoft Visual Basic .NET.
- Traditional graphical user interface (GUI) applications that are not dialog-box style by processing input can be developed and drawing onto the application’s main window (called a “form” in .NET).
- There is great support for database management in the .NET Compact Framework, especially for Microsoft SQL Server CE.
- There is also great support for creating in-memory databases, otherwise known as DataSet and DataTable, by using Microsoft ADO.NET.
- Manipulating extensible Markup Language (XML) data, or create a Web Service client.NET Compact Framework would be the best choice.
A device requires a reasonable UI with custom UI controls and not expecting a real time UI responses and also a lesser coding efforts.
Silverlight For Windows Embedded
Silverlight Architecture Diagram
Silverlight for Windows Embedded is a native code (Visual C++) UI development framework for embedded devices and is based on Microsoft Silverlight 3 for the desktop browser. It delivers impressive graphics with optimized performance on embedded devices. The UI framework is designed to build UI shells and core applications for devices and can handle tasks such as events, initializing, and manipulating visual elements, and runs very efficiently on specialized embedded hardware. Hardware acceleration can be utilized if a graphics processing unit (GPU) is available on the device and other requirements are met. With this technology, the UI of an application can be described using XAML, an XML-based language, and can be designed using visual tools like Expression Blend. This allows UI designers to work on embedded devices using the same tools, they use on the desktop and it lets embedded developers concentrate on the core application features and not on the design of the UI.
Silverlight for Windows Embedded Features
- Used for developing user interfaces for shells and applications that run on a Windows Embedded Compact powered device.
- Silverlight for Windows Embedded is an unmanaged code.
- Silverlight requires Prerequisites like Source (XAML), SYSGEN variables, Headers and LIBS (provided in SDK).
- Silverlight UI explicitly redraw by Setting Visible property or calling InvalidateArrange & UpdateLayout.
- Complex animations can be done with great ease using XAML Storyboard.
- Gradient and Opacity is incorporated through XAML and code for the rich UI.
- Supports transformations through classes such as IXRCompositeTransform, IXRMatrixTransform, IXRRotateTransform, IXRScaleTransform, IXRSkewTransform, IXRTransformGroup and IXRTranslateTransform derived from IXRTransform.
- Provide build-in layouts like Canvas, StackPanel and Grid for the placement and alignment of the controls.
- Customization can be done by creating styles, templates and apply them to controls to define a consistent look for specific types of controls.
- Supports code-behind that is written in Visual C++ only.
- Data Bindings can be used through IXRPropertyBag & TPropertyBag classes to register properties and setting values to them from the C++.
- Hosts the object tree in a visual host that has an underlying Win32 window.
- Supports event binding in Visual C++ by attaching event handlers to UI objects.
- Supports float type values instead of double type values. The equivalent object of each XAML element that represents a double value actually represents a float and includes “double” in its name only to maintain parity with the name of its equivalent XAML element.
- Parses color codes from the source XAML markup. You can also define new colors in Visual C++.
- Supports the COLORREF type, which can be generated by using the RGB or RGBA macros. These macros accept byte values instead of hexadecimal values.
- Supports data binding from a Visual C++ data source object that implements IXRPropertyBag to a native Visual C++ UI control.
- XAML for Windows Embedded supports only the Path and Mode data binding properties. The Path property is required.
- Supports XAML elements in the System.Windows and System.Windows.Controls namespace and provides many equivalent Visual C++ classes. Supports only built-in controls in this namespace, and not extended controls.
- Even though C++ simply is a cumbersome language as compared to .NET, separation of UI and presentation logic can be achieved.
Devices has GPU support and requires a rich UI (UI with animated controls and effects) with a moderate UI responses.