Other controls The control mentioned in this section is only a small part. In addition to the controls mentioned here,. NET Compact Framework 2.0 also includes many other controls, including statusbar controls, DataGrid controls for smartphone, and custom controls derived from usercontrol. Support for differences in the appearance and shape of devices Windows Mobile devices have many different appearances, and new appearances are constantly emerging. To ensure the applicationProgramYou can work smoothly on Windows Mobile devices. You need to design the application user interface to adapt to the differences in the screen size, shape, and resolution of the device. To reduce your workload on the trivial transactions involved in processing these device differences ,. NET Compact Framework 2.0 provides several new features to simplify the creation of adaptive application user interfaces. Among these new functions, the most noteworthy is that the control dock and Control Positioning functions are added. Control dock and Control Positioning help to make your application user interface more adaptable, because by using the dock and positioning functions, you can provide the control's response to display the default behavior of regional changes. When the control is docked, the control is aligned with the edge of its parent control. For example, if you configure a control to dock to the left edge of its parent control, the control is positioned on the left edge of the parent control and fills the entire area along the left edge of the parent control, 11. When the size of the parent widget changes due to differences in the appearance and shape of the device, the docked widget automatically adjusts its own size to maintain alignment with the left edge of the parent widget. Figure 11. Controls displayed on the horizontal screen and vertical screen at the top edge of their parent controls The positioning control indicates that one or more edges of the control should be at a fixed distance from the corresponding edges of its parent control. The difference in the device screen size will automatically adjust the widget's size and position (if necessary) to keep the specified distance between the positioning edge and the parent control edge. Figure 12 shows the Textbox Control located at the left, right, top, and bottom edges of the parent control. Figure 12. Controls on the left, right, top, and bottom edges of the parent widget displayed on the horizontal screen and vertical screen In some cases, it may be impractical for an application to adjust its control size or move its control to adapt to the differences in the size of the device's screen area. This is usually the case when an application has a large number of controls and the size of the control may become too small for users to interact with it in an appropriate way. In this case, a better solution is to allow users to scroll through the display area of the Application to view controls outside the edges of the screen. When using. NET Compact Framework 2.0, you do not need to perform any special work to integrate the rolling feature into the application. When an application is displayed,. NET Compact Framework 2.0 automatically checks whether there are any controls that are limited by the display size and cannot be seen, and adds a scroll bar to the application form if necessary .. NET Compact Framework 2.0 also provides all the scroll bar processing functions. Therefore, applications can view hidden controls through scrolling forms without any special processing. The display size and resolution of the device are different. If these resolution differences are not taken into consideration, applications originally designed for 96-inch dot (DPI) display will be very small and squashed on 192 DPI devices. For normal display, the control needs to be scaled to adapt to the new display resolution. Use. NET Compact Framework 2.0, processing these resolution differences will become simple, because. NET Compact Framework 2.0 automatically scales all controls to consider differences between design-time resolutions and runtime resolutions. Keyboard interaction and keyboard-based navigation An important improvement in. NET Compact Framework 2.0 is to provide better support for devices equipped with a keypad or keyboard. In. NET Compact Framework 2.0, all controls now receive keyup, keydown, and keypress events, allowing you to integrate custom keyboard processing functions in applications. With the newly added form. keypreview attribute, you can also choose whether to send Keyboard Events to various controls or send all control Keyboard Events to the forms containing these controls. . NET Compact Framework 2.0 also supports setting the control as a tab and the tab key order of the control. In this way, users who use devices that support the keyboard do not need to use a pen, but use the tab key to move between application controls. Enhanced Data Functions In essence, lob applications spend a lot of time managing data and interacting with data. For developers who create lob applications, efficient and easy-to-use data classes are essential. By adding SQL Server compact edition to the Rom, Windows Mobile 6 provides lob application developers with the full relational database support they need. With the help of SQL Server compact edition in Rom, you can use the functions and capabilities of the locally installed Relational Database SQL Server compact edition without adding the database installation component to application deployment. Whether you use the dataset class and SQL Server compact edition to process relational data, or the XML class to process hierarchical data ,. NET Compact Framework 2.0 provides the required easy-to-use, efficient, and rich functions to reduce programming workload and improve application performance. Note: In addition to the many outstanding new features described in this section, you can also refer to the improved data class runtime performance in the "higher performance, higher resource management efficiency" section below. Link data A relational data class provided by. NET Compact Framework 2.0 has the greatest impact on applications. It is the newly added sqlceresultset class. The sqlceresultset class provides a cursor pointing directly to the SQL Server compact edition database, which can be updated and rolled. The sqlceresultset class does not copy a large amount of database data in the memory like the dataset class, but directly cooperates with the SQL Server compact edition database engine, therefore, you do not need to copy data to provide data update and cursor scrolling functions. Compared with the dataset class, the sqlceresultset class architecture can greatly reduce the amount of memory occupied by applications. In many cases, sqlceresultset can reduce the amount of memory required by the application by several megabytes. In addition to reducing memory consumption, sqlceresultset is much faster than dataset. The speed of sqlceresultset is usually three to five times that of the dataset class. XML . NET Compact Framework 2.0 provides several enhancements for processing XML-based data. These changes simplify the use of XML APIs and greatly improve the consistency of XML APIs with the functions provided by the complete. NET Framework. As part of these enhancements ,. NET Compact Framework 2.0 adds support for the XML query language XPath. XPath can greatly reduce the programming workload required for navigation XML data, and compared with the explicit navigation API, the efficiency of navigation XML data is usually higher. The XMLSCHEMA class and related classes are added so that the XML schema can be processed and created programmatically. One of the most popular features (XML serialization) is now available .. NET Compact Framework 2.0 is now added to the xmlserializer class and related classes, such as xmlelement and xmlattribute classes. With these classes added, you can now easily retain and restore application objects in XML format. The new xmlserializer class replaces the Web Service XML serialization implementation used in. NET Compact Framework 1.0. XML serialization and deserialization of all Web services are now executed through the new xmlserializer class. The speed of the new xmlserializer class can be stably maintained at two to three times the XML serialization implementation speed of the web service in. NET Compact Framework 1.0. Thanks to the new xmlserializer class, the application starts from. the total time it takes for a net Compact Framework 2.0 application to call a Web Service is far less. the time it takes for the NET Compact Framework 1.0 application to perform the same call. Higher performance and higher resource management efficiencyWindows Mobile 6 has added. NET Compact Framework 2.0 to Rom, which improves the performance of hosted applications .. NET Compact Framework 2.0 has made significant performance improvements based on. NET Compact Framework 1.0. Performance improvements affect almost every aspect of application execution, including application resource recovery. To improve performance,. NET Compact Framework 2.0 performs comprehensive review and rework at runtime. The effort paid off. Although it is difficult to determine the impact of performance enhancement on any specific application. NET Compact Framework 2.0 may run at a speed close to that in many regions. in NET Compact Framework 1.0, the execution speed of the corresponding operations is doubled and half. The improvements made in other regions are more significant, such as virtual or non-virtual method scheduling. In many cases, the speed is almost twice and half of. NET Compact Framework 1.0. In addition to the overall runtime performance improvement, we also paid special attention to improving the performance of data classes .. NET Compact Framework 2.0 the data loading speed of the dataset class is three to four times that of. NET Compact Framework 1.0. The xmltextreader class performs similar performance improvements, and now it reads almost three times as much content as. NET Compact Framework 1.0. In addition to performance improvements for many applications,. NET Compact Framework 2.0 also significantly improves the performance of the garbage collector. In general, the. NET Compact Framework 2.0 Garbage Collector restores Memory seven times faster than. NET Compact Framework 1.0. The management and recovery of Large Object allocation are separated from other memory allocations, although the speed is. NET Compact Framework 1.0 is already very fast ,. NET Compact Framework 2.0 is four times faster than the garbage collector. Table 3 provides an overview of. NET Compact Framework 2.0 performance improvement.
Table 3.. NET Compact Framework 2.0 Performance Improvement overview Based on. NET Compact Framework 1.0 |
Task |
. Net CF 2.0 performance improvement compared with. Net CF 1.0 |
Overall run-time execution |
Speed doubled and a half (average) |
Method Scheduling |
Fast, double, and half |
Dataset Loading |
Three to four times faster |
Xmltextreader reading |
Speed three times faster |
Garbage Collector memory recovery |
Speed seven times faster |
Large Object recovery of the Garbage Collector |
Speed up to four times |
Not only are applications in use. NET Compact Framework 2.0 is used. NET Compact Framework 1.0 has higher performance and runs on Windows Mobile 6. the. NET Compact Framework 2.0 application runs the same as that on earlier Windows Mobile devices. compared with the NET Compact Framework 2.0 application, the former starts 25% faster than the latter. Windows Mobile 6 device startup time is shortened because. NET Compact Framework 2.0 is installed in the device Rom. Compared with installing. NET Compact Framework 2.0 on a device in Ram, simply installing. NET Compact Framework 2.0 in the device Rom increases the application startup speed by 25%. All these performance improvements not only mean that users are more satisfied with your applications that are faster and more responsive, but also accelerate application development because you now have less time to wait. The application starts and runs faster, and the time to obtain the application test results is shorter. Local Machine Code Reconstruction of interoperability . NET Compact Framework 2.0 adds many new features based on the existing features of. NET Compact Framework 1.0. With so many new features added,. NET Compact Framework 2.0 applications only use managed code to perform much more work than they can do in. NET Compact Framework 1.0 applications. Even with these many new features, hosted applications sometimes need to interact with local code. And. compared to NET Compact Framework 1.0 ,. the local code interoperability implementation provided by NET Compact Framework 2.0 has been significantly improved, greatly simplifying the interaction between the hosted application code and the local code and reducing confusion. . NET Compact Framework 2.0 adds support for the Component Object Model (COM) so that hosted applications can directly call the COM component. You do not have to create a custom library to make the COM Object accessible as required by. NET Compact Framework 1.0. The Code sending layer of the local machine has been improved to support much more data types than in the past .. Most of the data sending restrictions in NET Compact Framework 1.0 do not exist. Most parameters can now be passed directly from the hosted application to the local code without any special programming; this includes classes and structures that contain embedded types (such as strings and arrays .. NET Compact Framework 2.0 also provides custom parameter messages through the financialas attribute. For developers who need to process native functions that require window handles, all. NET Compact Framework 2.0 Windows Forms controls now provide the handle attribute. The handle attribute exposes the local window handle of the basic window of the control. You can pass this attribute to the local method that requires the use of the window handle. SQL Server 2005 compact Edition All Windows Mobile 6 devices Install SQL Server compact edition (an enterprise quality Relational Database) in Rom. This applies to both Pocket PCs and smartphone devices. With the help of SQL Server compact edition in ROM, applications can make full use of local full relational databases (SQL Server compact edition) without adding database installation components to application deployment. This reduces the time and cost of deployment support. Note: The existing database files created using SQL Server 2005 mobile edition are fully compatible with SQL Server 2005 compact edition and can be used without modifying the database files. Rich Functions SQL Server compact edition is a fully functional relational database that provides complete SQL syntax, including internal connections, external connections, and subqueries. SQL Server compact edition provides complete transaction consistency, which ensures that the database remains consistent, even when the application crashes or the device is completely powered off. SQL Server compact edition provides record-level, page-level, and database-level locking functions, which ensures the integrity of the database, this is true even when multiple threads or applications are simultaneously accessed and updated. An important function for LOB applications is that SQL Server compact edition supports up to 4 GB databases. Sense of intimacySQL Server compact edition provides a rich subset of SQL Server 2005 SQL implementations, allowing you to take full advantage of existing SQL Server skills. You can also take full advantage of existing database programming skills, because SQL Server compact edition provides an ADO for hosting applications. net Library, and provides an oledb library for local applications, both of which are consistent with the corresponding database of SQL Server 2005. SQL Server compact edition is fully integrated with SQL Server Management studio and Visual Studio 2005. With SQL Server Management studio, you can create a new SQL Server compact edition database, view database objects, create tables, modify tables, and execute interactive queries. Figure 13 shows the list of tables, columns, and table indexes in the SQL Server compact edition database. Figure 13. SQL Server compact edition database tables, table columns, and table indexes viewed in SQL Server Management Studio Visual Studio 2005 fully supports SQL Server compact edition. Its data-oriented functions are the same as those provided for other databases. When you use Visual Studio 2005, you can add the SQL Server compact edition database as a data source to the project. When you add an SQL Server compact edition data source, Visual Studio 2005 performs the same behavior as SQL Server 2005 databases. It generates a class derived from a strongly Typed Dataset, and add the database table to the "Data Source" Pane of Visual Studio 2005. You can drag tables and columns from the data source pane to the Application Form exactly as you did when using SQL Server 2005, visual Studio 2005 automatically generates the corresponding control and data binding code. Figure 14 shows the SQL Server compact edition database table in the data source pane. Figure 14. SQL Server compact edition database table in the "Data Source" Pane of Visual Studio 2005 With Visual Studio 2005 Server Explorer, you can open the SQL Server compact edition database and view the database content interactively. You can also open database tables through Server Explorer to view, add, modify, and delete records. Built-in data synchronization support One of the most important issues that must be addressed when designing mobile lob applications is Data Synchronization policies. When data is replicated from an enterprise database to a mobile device for the first time, both the device and the enterprise database have the same information. However, the information of these two databases will be different soon. User Activities may change the data on the device. Similarly, activities in other places of the enterprise may change the data in the enterprise database. You need to determine how the application synchronizes the Device database with the enterprise database to restore the two databases to a consistent state. No policy applies to all applications, which is why SQL Server compact edition directly supports several different data synchronization mechanisms. If most of the data changes are performed on copies of the device (for example, the public utility reader that collects information, SQL Server compact edition provides remote data access (RDA) for such applications ). RDA is a lightweight data synchronization utility used to track changes to the device database and apply the same changes to the enterprise database in the future. In more complex cases, SQL Server compact edition provides merge replication. Merge replication is a cooperative data synchronization utility that tracks changes made to device and enterprise data copies. During data synchronization, both the Device database and the enterprise database exchange their respective data change history to make the two databases consistent. As part of the data synchronization process, the merger and replication process goes through a change coordination phase during which changes will be reviewed by both parties to determine the specific data to be exchanged. The change coordination phase automatically detects any conflicting data changes that may have occurred and takes appropriate measures. Merging and copying are completely configurable and can be customized. Merge replication also includes some advanced data synchronization functions that cannot be used by RDA: background data synchronization (also called asynchronous replication) and progress events. You can use the background data synchronization function to start the merge replication process and run it on the background thread. This allows the main application thread to maintain a timely response to the user interface. Progress events provide regular updates to applications related to the state of the data synchronization process (including the switching time for each table change and the change coordination progress. RDA and merge replication are performed through the Web server for data synchronization. Data changes are transmitted through Hypertext Transfer Protocol (HTTP) or Secure Hypertext Transfer Protocol (https. Data Synchronization on the Web server brings great flexibility, because the SQL Server compact edition database can be synchronized with the enterprise database when the device can connect to the Internet, this is true for high-speed connections like wifi or slow mobile phone connections. If the data is stored in a separate database on the user's desktop computer, rather than in the enterprise database, SQL Server compact edition provides SQL Server compact edition Access Database synchronizer (ADS) for such application environments ). Through ads, you can use the data in the user's desktop access database to fill the SQL Server compact edition database on the device. The SQL Server compact edition database automatically tracks changes made to the device database. When the device is inserted into the base, SQL Server compact edition will use ads to apply the Device database changes to the access database. Security The portability requirements of mobile devices follow security practices to ensure that the security of important information is not compromised. To ensure data security in the SQL Server compact edition database, SQL Server compact edition supports password to protect the database and encrypt the database content. When creating a database, you can easily set the password for protecting and encrypting the database. The following is an SQL statement. It creates a database named safedata. SDF on the C drive, sets the password to P @ ssw0rd, and configures the database to encrypt all data. Create Database "C: \ safedata. SDF" databasepassword 'P @ ssw0rd 'encryption on All data stored in the database is encrypted. The only way to successfully access the database content is to provide the correct password when you open the database. The following example shows how to programmatically create a password-protected encrypted database file in the C # program. Sqlceengine dbengine = new sqlceengine (@ "Data Source = \ My Documents ents \ safedata. SDF; Password = P @ ssw0rd; encrypt database = true"); dbengine. createdatabase ();
In addition to providing secure database content, SQL Server compact edition also provides secure data exchange when synchronizing data with enterprise databases using RDA or merged replication. Both RDA and merge replication allow you to Use https to encrypt historical data when you exchange data with backend databases over the Internet. Ajax Windows Mobile 6 has an updated version of Microsoft Internet Explorer Mobile, which includes xml dom and JavaScript support required to run BASIC Ajax applications. This allows you to use existing ASP. NET, XML, and JavaScript skills to build browser-based applications running on Windows Mobile 6 devices. Note: The Windows Mobile 6 SDK refresh, to be released in May 1, 2007, includes a Windows Mobile 6 simulator image that supports basic Ajax applications. Back to Top Simplify Application DeploymentAfter deploying the application to the end user, you can say that it is successful. Deploying an application is time-consuming to support the deployment process and may significantly affect the time that can be used to develop new features and applications. Many of the enhancements added to Windows Mobile 6 Reduce your time and effort in managing and supporting application deployment. These enhancements reduce the total cost of application deployment by reducing the time you spend managing and supporting application deployment, windows Mobile 6 gives you more time to add features and create new applications for your applications. Fewer software to be installed Windows Mobile 6 simplifies the deployment of hosted applications and self-use applications by adding. NET Compact Framework 2.0 SP1 and SQL Server 2005 compact edition to the ROM of each Windows Mobile 6 device. Provided in Rom. NET Compact Framework 2.0 SP1 and SQL Server compact edition greatly simplify application deployment and reduce the level of support that must be provided to end users for successful application installation. There are many benefits for providing. NET Compact Framework 2.0 SP1 and SQL Server compact edition in Rom. You have a well-defined target platform that ensures that these core software components always exist and are correctly installed. The overall size of the application installation package is still small because it only contains application components. The download and installation time of small installation packages are short, which simplifies application distribution and application update distribution. A short period of installation and download time also creates conditions for improving user experience. In addition to user, deployment, and support Experience Improvement, install the software in the device Rom. NET Compact Framework 2.0 SP1 and SQL Server compact edition also create conditions for applications to provide a better runtime environment. Install. NET Compact Framework 2.0 SP1 and SQL Server compact edition in the device Rom so that they do not occupy the device Ram space. Reducing software installed in Ram allows more RAM space for applications to store data. Support for URL-based Deployment Adding basic Ajax support for Internet Explorer mobile on Windows Mobile 6 provides a new way to distribute applications. For scenarios that are suitable for Ajax-based solutions, you only need to email the corresponding URL to deploy the application. When you receive a URL, you only need to use Internet Explorer mobile to browse the URL, instead of installing other software on the device, internet Explorer mobile has all the conditions required to run the basic Ajax program. Code signing is simplified An important aspect of Windows Mobile Security Policy is the use of certificates to sign application executable files and installation files. In large applications, the process of correctly signing application executable files and installation files may be lengthy. The new codesigntool utility (as mentioned earlier in this article) allows you to sign all necessary files by executing a command, significantly reducing the workload of signing application installation files. |