Microsoft 智能手机(Smartphone)C#开发入门

原文地址:http://www.codeproject.com/KB/mobile/SmartphoneIntroCSharp.aspx

ByLogu Krishnan

译者:林七佛

Introduction(引言)

The objective of this article is to provide the prelude to the beginners of SmartPhone programming. This article provides introduction to SmartPhone, its features and APIs. Also, the article discusses on creating a simple program using C# for the SmartPhone.

本文的目的是为智能手机编程开发的初学者介绍一些入门知识。本文将介绍智能手机的一些入门知识,它的一些特征和API。当然,本文还讨论了使用C#创建一个简单的智能手机程序。

In recent days, mobility is getting its momentum and attention both from the public consumers of mobile services and major corporations of the world. Mobility today equips knowledge workers with the power to access information and data from any part of the world.

今天,便携(可移动的,随身携带)设备已经成为大众消费者和世界主要厂商的关注的焦点。如今拥有较高文化层次的工人已经装备了移动设备,这样就可以从世界的任何角落获取信息和数据。

As any other rapid technology evolution, mobility has certainly evolved and its recent form is on Mobile Phones, but be sure that, this mobility would create a whole new world and accessories useful for mankind, starting from a lay man to the richest. And it is also true that soon mobility would take another form and shape, and would become part of our lives.

和其它高速发展的技术一样,现在的便携设备已经进化到最新的移动手机模式,不过毫无疑问的是,这些便携设备将创造一个全新的世界并成为人们有用的附件,无论他是穷人还是富人。便携设备也会很快以其它样式出现,并成为我们生活的一部分。

Fine… But what do I get as a developer on all these happening around me… Actually, there is a whole new exciting world opened up for developers which is definitely a paradigm shift from today’s Desktop and Web Application development. New technology, new challenges, new opportunities, and… new way to earn… $ Money $ ;-)

言归正传,这些到底对身为开发人员到底有什么意义呢?事实上,对开发者而言这将对我们展现一个崭新刺激的世界,从今天的桌面和web程序开发中脱身出来,新的技术、新的挑战和新的机遇,还有新的赚钱的机会(*^__^*)

Mobility Evolution(移动设备的发展)

As part of the evolution, we had various handheld devices, Pocket PCs, PDAs et al. Today’s mobility world is trying to gain advantage by leveraging advantages of successful cellular phones which are truly mobile and is owned by people of all sectors of the world.

我们有各种的手持设备:掌上电脑、PDA(个人数字助理)等。今天的移动世界将要让手机成为真正的便携式电话从而获得其中的好处,并让全世界的人们都可以分享这个成果。

There have been various models of phones available in today’s market. As of today, the market is ruled by Symbion OS embedded on the Nokia Phones and other proprietary phones like Sony, Samsung et al.

今天的市场上有各种型号的电话。内嵌Symbion OSNokia(诺基亚)手机和其他电话如索尼、三星等。

Much like the Web Browser market, Microsoft is a bit late to enter the mobile world. Today Microsoft has its own proprietary operation system, called as Microsoft Windows Mobile 2003, powered by the strong WinCE 4.2 OS. These phones with the Microsoft OS is slowly capturing up the market, and the developers' world.

非常像web浏览器市场,微软进入移动世界的时机有点晚。现在微软已经有他们的操作系统(移动平台),叫做Microsoft Windows Mobile 2003,基于强大的WinCE 4.2操作系统(PS:现在WM 6.0WinCE 5.2.这些使用微软操作系统的手机进入市场和开发人员的时间较迟。

As always, Microsoft provides adequate developer support to program these phones using existing languages and technologies. Microsoft .NET Compact Framework, a subset of the rich .NET Framework, does this magic. One great news is that the .NET CF runtime is now preloaded on the ROM of the Microsoft, which definitely eases the burden during the application deployment.

微软总是给开发人员提供足够的支持来开发这些手机的程序,可以利用现有的语言和技术。Microsoft .NET Compact Framework(微软的.NET 小型框架包)是强大的.net framework的一个子集。一个好消息是.NET CF运行时将在微软的ROMA中预装,这将对这些程序的部署起到简化的作用。

Features(特征)

Microsoft SmartPhone is loaded with a very rich suite of software, which communicates to the user through Voice, Text and Internet capable applications, by leveraging the connectivity options like GSM, GPRS, SMS, PPTP, Bluetooth, USB, and Infrared IrDA.

微软的智能手机已经预装了丰富的软件,可以通过语音通信、处理文本和访问互联网的程序,可以使用GSM, GPRS(目前cn的手机上网方式), SMS, PPTP, Bluetooth(蓝牙), USB和红外线。

下面罗列出微软智能手机已经包含的软件:

Pocket Internet Explorer

用来上网的浏览器

No more plain vanilla WAP Browser on phones, instead a full blown IE 5 is loaded on the phones supporting HTML 3.2, XML, XSL, cHTML, WAP 1.2.1, WML Script, Active Script, ActiveX, SSL, JPEG, GIF etc.

Pocket Outlook

电子邮件

With tools for contacts, calendar, email, tasks and voice notes. Along with support for IMAP4, POP3 and SMS.

MSN Messenger

即时通讯软件

A full blown messenger

Microsoft ActiveSync

和电脑同步的软件

Supports Server and Desktop synchronization.

Windows Media Player

媒体播放器

Plays MP3, WMA, AVI

Voice Notes

录制语音

To quickly record voices

Games

游戏

Variety of Mobilegames.

File Management Utilities

文件管理

File Manager [like Windows Explorer], Task Manager

资源管理器和任务管理器

Wireless Modem

无线猫

Options to connect through USB, IR, COM

MMS Client

短信

Send and receive MMS messages

Camera

相机

Camera support for image capture and video capture

SmartPhone Layout(智能手机的功能键布局)

Microsoft has suggested a standard layout and control structure for the devices. [Ref: SmartPhone SDK]

微软推荐的标准布局和该类设备的控制结构【参考自智能手机 SDK

The placement of soft keys, the Home key, the Back key, and the five-way navigation pad illustrated in the preceding figure is strongly recommended. All the hardware controls (soft keys, and so on) must be present; however, a device manufacturer is free to deviate from the design.

左软键、主页键、返回键和五维按键的布局是强烈推荐的(感觉这款手机好难看啊)。所有的硬件控制都必须有;尽管如此,设备制造商还是有自由设计的空间。

Recently, Microsoft launched the Microsoft Windows Mobile 2003 Second Edition, and the following developer tools are available, based on its open Win32 development environment and an SDK for SmartPhone [can be downloaded].

  • Embedded VC++ 4.0
  • Visual Studio .NET – C#, VB.NET

近来,微软发布了Microsoft Windows Mobile 2003第二版,还有下面的开发工具,基于win32开发环境和智能手机SDK

A Simple Hello World Program(一个简单的Hello world程序)

Now, let’s get into business. Let us write a simple Hello World program. The first and foremost activity we need to do for programming the SmartPhone using Visual Studio 2003 is to download the SmartPhone 2003 SDK. Upon installing the SDK, the smart device extensions are extended with support for SmartPhone development along with the SmartPhone emulator.

现在,让我们切入正题。写个简单的Hello World程序。首先也是最重要的是我们需要一VS2003(并下载Smartphone 2003 SDK,其实你用vs2005都自带了,不过我现在用vs2008)来开发智能手机程序。当安装SDK后,就可以利用模拟器并支持智能手机开发扩张。

After the SDK is installed, launch Visual Studio, choose Smart Device Application under project templates, and give a name for your application, and click OK. Now, you should see a screen as below:

当安装好SDK后,启动VS,在工程模板下选择智能设备程序,给程序命名并点击OK。接下来你可以看到下面的屏幕:

注意:为简单明了起见,下面简化一些。和原文不同

当新建工程后,你会发现下面就自动加入一个菜单控件,我们桌面程序的菜单一般在窗体上面,而只能手机是在下面的。

这些菜单控件的使用方法和其他程序差不多,可以很方便的添加。你只要现场折腾一下就会了。

随意添加几个,下面双击菜单的其中那个Say Hello的项目,加入代码如下:

privatevoidmenuItem2_Click(objectsender,System.EventArgs e)
{
MessageBox.Show("Hello Logu!");
}

上面这个是跳出一个提示对话框!

下面这个代码是退出程序的:

privatevoidmenuItem3_Click(objectsender, System.EventArgs e)
{
this.Close();

}

是不是非常简单?现在要运行了,这里通过模拟器来执行:

F5运行,会让你选择模拟器,Smartphone 2003 Emulator (Virtual Radio) (Default)”, and hit “Deploy”.

你可以选择上面写的那个,并单击部署!

这样模拟器就会运行,会显示一个手机,你写的程序会在program下面,自己到处看看,会找到的。

我是用vs2005/vs2008都写过,令我惊讶的是,这些程序也一样可以直接在电脑上运行(手机上还有其他exe程序曾经拷贝到电脑却不行,提示不是有效的win32程序)。

还有要说的是那个模拟器似乎效率低下,我双核4400+ 2G内存都觉得很慢。所以还是直接拷贝到手机上运行快很多。

下面再简要看看提供的API(现在我急需这些API文档,希望SDK中有,正在下载中)

  • ActiveSync API
  • Bluetooth API
  • CE Messaging API
  • Device Management API
  • Home Screen API
  • Object Exchange (OBEX)
  • Pocket Outlook Object Model (POOM)
  • Speech Recognizer
    • Telephony - TAPI
    • Accessing the SIM card
    • P/Invoke to native SIM Toolkit APIs
  • RAPI – Remote API to connect to the desktops programmatically
  • GAPI – To develop Mobilegames
  • Vibrate API
  • Voice Recorder Controls

我也是刚接触这个,所以一切都是new的,呵呵!

Microsoft 智能手机(Smartphone)C#开发入门相关推荐

  1. Microsoft .NET Compact Framework 开发常见问题解答

    这个 FAQ 有部分是通过编辑公共 .NET Compact Framework 新闻组 (microsoft.public.dotnet.framework.compactframework) 贴出 ...

  2. [转贴]Symbian开发入门 - UIQ开发教程

    文章作者:无双: 原发处:loveunix.net 欢迎转载,但是保留原作者与发表网站 保留版权声明 文章作者:无双: 原发处:loveunix.net 欢迎转载,但是保留原作者与发表网站 保留版权声 ...

  3. Kinect for Windows SDK开发入门

    Kinect for Windows SDK开发入门(一):开发环境配置 首先来看一下Kinect设备: 1. Kinect设备 黑色的Kinect设备如下图:基座和感应器之间有一个电动的马达,通过程 ...

  4. Microsoft .NET Compact Framework 开发常见问题解答 - 专注.NET技术及其相关应用开发! - 博客园...

    Microsoft .NET Compact Framework 开发常见问题解答 发布日期: 3/30/2005 | 更新日期: 3/30/2005 Microsoft .NET Compact F ...

  5. 5G 时代的 Android App 开发入门与项目实战

    随着移动互联网的持续发展,Android系统从智能手机逐步拓展到平板电脑.智能电视.车载大屏.智能家居.智能手表等诸多设备,Android开发依然是前景可期的IT岗位. 当然,整个社会正在迈向5G时代 ...

  6. 《Android应用开发入门经典(第3版)》——导读

    本节书摘来自异步社区<Android应用开发入门经典(第3版)>一书中的目录,作者 [美]Carmen Delessio , Lauren Darcey , Shane Conder,更多 ...

  7. 无责任Windows Azure SDK .NET开发入门(二):使用Azure AD 进行身份验证

    <編者按>本篇为系列文章,带领读者轻松进入Windows Azure SDK .NET开发平台.本文为第二篇,将教导读者使用Azure AD进行身分验证.也推荐读者阅读无责任Windows ...

  8. WPF PRISM开发入门一( 初始化PRISM WPF程序)

    原文:WPF PRISM开发入门一( 初始化PRISM WPF程序) 这篇博客将介绍在WPF项目中引入PRISM框架进行开发的一些基础知识.目前最新的PRISM的版本是Prism 6.1.0,可以在G ...

  9. OWIN的理解和实践(三) –Middleware开发入门

    原文:OWIN的理解和实践(三) –Middleware开发入门 上篇我们谈了Host和Server的建立,但Host和Server无法产出任何有实际意义的内容,真正的内容来自于加载于Server的M ...

最新文章

  1. 【OpenCV 4开发详解】图像像素统计
  2. 分享这篇耗子叔的-《请玉伯一起来聊一聊“所向无敌的土方法”》
  3. Linux下如何释放内存
  4. 怀旧服新开服务器最新,暴雪官方发大招,怀旧服新开11个新服务器
  5. 搭建WordPress个人网站
  6. 多线程与高并发(四):LockSupport,高频面试题,AQS源码,以及源码阅读方法论
  7. 论文浅尝 | PairRE: 通过成对的关系向量实现知识图谱嵌入
  8. ======第三章处理机调度与死锁======
  9. JAVA大数据习题Week2
  10. 开源GIS(二十)——CAD数据添加属性转GIS数据
  11. opencv用python进行物体识别_教你用Python+opencv来识别物体的轮廓并标识显示
  12. VB调用周立功CAN接口卡接口库函数
  13. WGS84经纬度坐标转化成UTM坐标
  14. Ubuntu Core介绍及其使用
  15. 中南财经政法大学2014-2015学年学生奖励汇总表
  16. 后处理安装_“国六”提前实施,尾气后处理技术如何再升级?
  17. 关于计算机英语演讲ppt模板,英语演讲ppt模板(英语演讲8分钟ppt模板) 最新免费版...
  18. PAT/PTA甲级2020春季题目【满分】弃坑贴
  19. 牛客刷题:放苹果(编程题)
  20. 网页劫持防御方法,网页被劫持怎么办?

热门文章

  1. [20130106]关于不同字符集下clob字段的存储问题.txt
  2. mysql查询语句speed select
  3. 使用缓冲字符流进行文档排序
  4. 国内主流CMS、SNS、商城等建站系统汇总
  5. jira 切换 语言_JIRA中的标记语言的语法参考
  6. skype8.34 新版本不能启动/打开
  7. 从零开始设计RISC-V处理器——单周期处理器的设计
  8. 使用gpio_direction_output()无法设置GPIO原因分析
  9. python 投掷骰子实验
  10. 7.1 UiPath 用UiPath自动发送邮件