Desktop end mobile operation (1)

zhaozj2021-02-11  187

Desktop-end mobile operation

Larry ROOF

March 2004

Applies TO: Microsoft® .NET Compact Framework Windows MobileTM -BASED POCKET PCS Windows Mobile-Based Smartphones Microsoft ActiveSync®

Summary: Learn about Remote API files, and how to use .NET Compact Framework to integrate it into application development.

Introduction

In my last article, I introduced the situation about mobile computing. In that article, I have focused on the storage options for a specific Pocket Access database, and how they are integrated into the .NET Compact Framework application development.

In this article, we continue to topics about the options. I will introduce you to the mobile operation of the desktop, which is often ignored by the initiator of mobile development. Many developers' attention is attracted by the appearance of mobile applications, so that Ignore how to make a desktop or server application a part of the mobile solution. Obviously, most of a mobile solution is based on devices, but almost all schemes will eventually import or export data in the device. This includes data aggregation of the device, data delivery, constructive data, and slippage application update. In this article, I will demonstrate the Remote API through a simple desktop program:

? Span style = "font: 7pt 'Times New Roman'"> Copy or copy the file from the device.

? Span style = "font: 7pt 'Times New Roman'"> files on your mobile device.

? Span style = "font: 7pt 'Times New Roman'"> Delete files on the device.

SPAN style = "font: 7pt 'Times New Roman'"> Start an application on the device.

? Span style = "font: 7pt 'Times New Roman'"> Get system information of the device.

The beginning of the article is part of the "Two for Road" column, which will be displayed into Microsoft Visual C # ® .NET and Visual Basic® .NET.

The Remote API Library

The sample program this month demonstrates the power of Remote API (RAPI). These APIs are the main components of ActiveSync. RAPI is a library containing a set of functions that can be used to manage devices in a desktop application, including folders, registry, and system information.

In order to simply access the Remote API, we will use the OpenNetCF organization, an open source resource that can be obtained from OpenNetcf Website. This class library encapsulates all the features of the RAPI, providing a way to include all features of RAPI.

Classes Provided THROUGH THE Communication Namespace

Opennetcf.desktop.communication Namespace provides the following categories:

Table 1. Classes Offered in The opennetcf.desktop.communication namespace

Class

Description

ActiveSync

Provides a function of accessing the Microsoft ActiveSync.

AutoStartApps

When an ActiveSync session begins, provide information and formulates the running application.

FILEINFORMATION

The file information structure returned by the FindfirstFile and the FindNextFile method.

FileList

A collection of FileinFormation class. The query used by the desktop app and manages the file structure of a connection device.

RAPI

Provides a package based on the RAPI function.

Rapiexception

Define an exception thrown by the RAPI class.

Registry

Provide access to the basic RegistryKey class, which can be used to access and modify the values ​​and primary keys in the connection device registry.

RegistryKey

Define a primary key node in the connected device registry.

From the table above, OpenNetcf.Desktop.communication provides a large number of desktop functions, more details require a separate article to explain. For this article, I will pay attention to the RAPI class, especially paying attention to the main parts of this class:

SPAN style = "font: 7pt 'Times New Roman'"> Manage the device of the device and file.

SPAN Style = "Font: 7pt 'Times New Roman'"> Start an application on the device.

? Span style = "font: 7pt 'Times New Roman'"> Get system information of the device.

The reason why I choose these three characteristics is because I found that these three characteristics have a lot for the developers of mobile solutions.

Working with OpenNetcf's Communication Library

OpenNetcf Communication Library is provided by an OpenNetcf.desktop.communication.dll file. You need to include a reference to your desktop application. Add this reference, you need the following steps:

1. In the Solution Explorer window, right click on the References folder and a pop-up menu will be displayed.

2. Select Add Reference in the menu.

3. The Add Reference dialog displays. Select the OpenNetcf.desktop.communication component.

Click the OK button to add the selected components to your project.

The Rapi Class

Table 2 provides a list of RAPI methods, which are most useful for mobile transfer program development.

Table 2. USEful Rapi Class Methods for Developing Mobile Applications

Method

Description

<

转载请注明原文地址:https://www.9cbs.com/read-5030.html

New Post(0)