Windows Phone开发教程9
- 格式:doc
- 大小:215.50 KB
- 文档页数:9
本文向你介绍为Windows Phone 创建一个基本的XNA 框架应用,完整的代码可注意:下面的过程以Visual Studio 2010 Express for Windows Phone 开发工具为准。
下面我们开始整个开发过程:一. 创建新项目请使用以下步骤创建新项目:1.2.从开始菜单中启动Visual Studio 2010 Express for Windows Phone ,如果出现了注册窗口,你可以注册或者以后再说。
3.从菜单File 中选择New Project 来创建一个新项目4.如下图所示的新建项目窗口中,展开左边的Visual C# 模板,然后选择 XNA GameStudio 4.0templates.5.选择 Windows Phone Game (4.0) 模板,填写项目名称(随便你填什么)你也可以在这里指定项目存放的路径6.点击确定按钮,将会提示选择Windows Phone 平台,在这里我们选择 Windows Phone7.17.点击确定后将创建一个新的项目,并在Visual Studio 中打开Game1.cs 文件的源码二. 添加内容在这部分中,我们将添加一些图片和声音文件到项目中。
1.首先确认Visual Studio 中的解决方案浏览器可见,如果你找不到可以从菜单中 View |Other Windows | Solution Explorer 中打开2.我们先添加图形文件,在这里我们使用的是 PhoneGameThumb.png 文件,该文件默认存放在WindowsPhoneGame1\WindowsPhoneGame1\WindowsPhoneGame1 目录下。
你也可以使用自己的图片文件,但这个图片的像素必须是64 * 64。
右击内容节点,在这里我们是 WindowsPhoneGame1Content (Content), 然后选择 Add | Existing Item. 找到并打开你的图形文件WindowsPhoneGame1\WindowsPhoneGame1\WindowsPhoneGame1\PhoneGam eThumb.png然后点击添加,这样图形文件就添加到项目中。
part 1 --入门:1. 安装一键完成(注意只支持Windows 7和Vista,不要在XP上浪费时间):/do ... CED31729/vm_web.exe2. Windows Phone sample:/en-us/ ... 4%28v=VS.92%29.aspx3. Visual Studio Expression for Windows Phone提示试用版问题:/thread-47820-1-1.html4. zune为Windows Phone开发必备工具(手机和PC同步用工具,硬件调试必须安装):/zh-hk5. Windows Phone开发必备工具-Windows Phone Device Manager:可以查看文件系统目录,可以在pc和手机之间传送文件(需要先解锁,参考工具6)/en/applications/summary/22/33.html6. Windows Phone手机解锁工具、硬件调试教程:/thread-47838-1-1.html7. Windows Phone 7完整版模拟器/thread-68094-1-1.htmlpart 2 --教程、实例:1. Windows Phone文件系统了解及文件/SD卡操作/thread-62363-1-2.html2. Windows Phone theme Resource系统自定义了很多颜色、brush、字体、文本style等资源,程序可以使用与系统配置相同的高亮色3. silverlight/xna哪些被Windows Phone支持,哪些不支持/en-us/library/ff426931%28VS.96%29.aspx4. Windows Phone类库创建、使用入门教程,相对于android来说创建library要简单很多/thread-47967-1-1.html5. 实现控件倾斜效果:/thread-61951-1-1.html6. ListBox 滚动条的样式如何改变:/thread-62082-1-1.html7. 为Pivot不同的PivotItem定制ApplicationBar :/thread-58034-1-1.html8. Windows Phone中ItemsSource Binding && DataContext在.cs中设置技巧:/thread-67608-1-1.html9. 可用的开源应用项目源码:/thread-59981-1-1.html10. 简易打地鼠源码(熟悉SDK时写的)/thread-60953-1-1.html11. 学习资源共享/thread-59818-1-1.html12. windows phone如何退出你的程序?/thread-65156-1-1.html13. Silverlight App.xaml用途/thread-71826-1-1.htmlpart 3 --经典教程:1. /thread-46869-1-1.html2. /thread-46864-1-1.html3. 中文文档:/zh-cn/ ... oc-c-cn-wp7--DevDiv/zh-cn/ ... oc-c-cn-wp7--DevDiv4. MSDN帮助文档:/en-us/library/ff402535%28VS.92%29.aspx5. 入门系列:/forum.php?mod=viewthread&tid=84&extra=page%3D1 /forum.php?mod=viewthread&tid=82&extra=page%3D1 /forum.php?mod=viewthread&tid=41&extra=page%3D1 /forum.php?mod=viewthread&tid=40&extra=page%3D1有什么不懂的大家可以一起交流哦,wp7开发交流群172765887 卤面网 wp7 开发者论坛。
微软一起学Windows Phone开发视频教程系列课程介绍:Windows Phone7是今年年初才推出的一个全新的移动平台,集成了微软Silverlight和XNA两大优势产品框架在里面,使这个平台与Windowsmobile平台有了很大的区别,由于这种差别的存在,使应用开发也不同于以往的Windowsmobile开发了。
一起学WindowsPhone7开发课程,对 WindowsPhone7各个功能模块开发都有所讨论,是一个由入门到深入的系列课程,是一个面向开发者和对Windows Phone感兴趣人士的课程,通过这个系列课程的学习,可以使您对WindowsPhone7的开发有一个完整的认识,也为您进入更深层次的开发奠定了基础。
课程章节:一起学WindowsPhone7开发系列课程(1):初识WindowsPhone 7今年年初微软发布了最新的移动平台Windows Phone7,也给我们带来了不一样的开发体验。
它的架构是什么、开发环境是怎么样的?本次课程将带您学习这个内容。
一起学WindowsPhone7开发系列课程(2):Silverlight forWindowsPhone 7 WindowsPhone7应用开发,是以Silverlight为基础的,但又有一些不同,那有哪些不同?如何进行开发呢?本次课程将带您学习这个内容。
一起学WindowsPhone7开发系列课程(3):控件开发一控件是Silverlight应用开发的基础,对于用好控件,是Windowsphone7开发的基本功,本次课程将带您学习容器控件、按钮控件等内容。
一起学WindowsPhone7开发系列课程(4):控件开发二在应用开发中,如何输入文字、密码?如何播放视频、声音?如何显示文字?如何使用进度条?本次课程将带您学习这个内容。
一起学WindowsPhone7开发系列课程(5):控件开发三在Silverlight开发中,是没有绘制图形的函数的,那我们如何绘制多边形?应用中,需要地图展示,如何加载地图?如何做标记?本次课程将带您学习这个内容。
Window Phone 平台开发技术就目前来讲,自传统互联网技术普及之后,移动互联网也发展迅猛,如今各种软件大多直接或间接依赖于互联网。
这些软件本质上依然是服务器-客户端结构的。
服务端部署于服务器上、客户端部署在用户终端上。
无论是P2P、B/S、C/S还是其它混合型的结构,本质依然如此。
以前,大多数用户终端设备是PC和笔记本电脑,如今终端更多,又增加了大量的设备,其中普及率最高的是智能手机及平板电脑,除此之外还诞生了车载联网设备等等其它各种终端。
以前软件开发主要为PC开发软件,如今则需要为各种终端开发相应的软件,这在一定程度上加剧了软件开发的复杂度,各种平台拥有各种不同的操作系统、开发环境、开发工具、编程语言以及不同的库、不同的平台特性、不同的输入设备等等,一个人已经很难精通多平台的开发了。
今天聊一聊移动平台的开发及Windows Phone需要掌握的开发技术。
就目前来说,这里所说的移动平台主要指智能手机及平板电脑,因为目前平板电脑搭载的操作系统以及实用方式和手机相似,就不在多说了。
目前在移动平台上开发软件主要基于有以下几种平台:1. iOS2. Andiord3. Windows Phone当然,除了这3种之外还有其它一些平台,不过就目前来说,其它的平台不太被看好,这里主要聊一下这几种。
Andiord是Google开放的系统,优良的系统和开放性使得它成为了目前市场占有率最高的系统,设备数量惊人,但也导致了一定问题,如系统版本混乱、设备规格参差不齐等等,使得开发和维护的难度大大增加。
ios是Apple公司主导的系统,精美的设计使用iphone和ipad大行其道,使ios成为市场占有率第二的操作系统。
而Windows Phone大家都知道,和其它两个平台相比应用数量上不占优势,但是从Windows Phone 7 到Windows Phone 8,市场增长速度迅猛,目前的设备数量已不算低,是公认的最有可能发展壮大和其它两个平台抗衡,微软有着深厚的Windows系统周边资源,包括大量的开发人员,他们都可以很容易过渡到Windows Phone的开发上,新的windows phone 8 采用windows 8的内核,原来windows pc山的软件更换下UI和输入方式,就能方便地移植到windows phone 上运行,成为一款手机应用软件,这也是一种巨大的优势。
今天我们来探讨如何制作一个不同以往的Button控件,姑且称之为:ImageButton。
在编写Windows Phone 7 应用程序的时候,我们经常会遇到这样的需求,就是要制作一些图片型按钮。
相信有些朋友一定尝试过把Image控件当做标准Button控件的Content,但结果如何呢?应该不尽如人意了吧。
最大的问题在于,系统默认的Button的风格,会让按钮在被按下去的时候,让填充的颜色取系统的前景色,造成按钮中的图片不可见,并且有令人不适的“闪烁”效果。
既然这样的需求比较普遍,我们不如专门自定义一个控件出来。
在开始动手之前,我们先看一看实际运行后的效果:整个按钮的效果就是:当用户点击按钮时,按钮图标略微变小、变淡,与此同时,按钮的背景处有另一个图标一边扩散、一边淡出。
接下来,我们就开始动手制作这样一个ImageButton 控件。
第一步:编写自定义控件类制作一个自定义的控件,首先要从编写控件的类开始。
既然我们要做的是一个按钮控件,就让它继承自标准的Button控件,从而获得Button已实现的诸多功能(例如:Button 的Click 事件)。
在Visual Studio里,创建(或打开)一个Windows Phone 7 项目,添加一个类。
代码如下:01 public class ImageButton : Button02 {0 3 public static readonly DependencyPropertyImageSourceProper ty =4DependencyProperty.Register(05 "ImageSource",06 typeof(ImageSource),07 typeof(ImageButton),08 null);0910 public ImageSourceImageSource11 {1 2 get { return (ImageSource)GetValue(ImageSourceProperty ); }13 set { SetValue(ImageSourceProperty, value); }14 }15 }在上面定义的ImageButton 类里,我们只声明了一个属性,就是ImageSource,它是用来为我们的ImageButton 控件指定图片资源的。
WINDOWS PHONES TYLE GUIDE FOR S WEDISHContents1.Goals of This Guide (3)2.The Windows Phone Voice (3)nguage-Specific Guidelines (4)3.1.General Tone & Voice—Share the Message (4)3.2.Style—Help Deliver the Voice (5)age—Sound Natural (6)3.4.Terminology—Be Consistent (7)3.4.1.Naming Guidelines and Trademark Requirements (8)3.5.Handling Fictitious Content (8)3.6.Measurements (9)4.Windows Phone UI Localization Guidelines (10)4.1.How to Translate UI Elements (10)4.1.1.App Bar Icon (10)4.1.2.App List Item (11)4.1.3.Buttons (11)4.1.4.Check Box Label (13)4.1.5.Edit Box Label (14)4.1.6.Group Label (15)4.1.7.Hub Title (16)4.1.8.List Item in Settings (16)4.1.9.Menu Items (17)4.1.10.Message Box (18)4.1.11.Notification Toast (19)4.1.12.Page Title (20)4.1.13.Pane Section Title (20)4.1.14.Phone Control Label (21)4.1.15.Pivot Item (21)4.1.16.Progress Indicator Text (22)4.1.17.Text Box (22)4.1.18.Tile Label (23)4.1.19.Toggle Switch (24)4.2.How to Translate References to UI Elements (25)4.4.Capitalization—Mind the Case (27)4.5.Words—Show as well as Tell (29)4.6.Punctuation—Divide and Conquer (30)4.7.Editing/Screen Review—Fine-Tune the Translation (30)4.8.Handling Input from External Stakeholders (31) (32)5.1.General (32)5.2.Terminology (32)5.3.Elements Specific to (33)5.3.1.Image Captions (33)5.3.2.Topic Titles (33)5.3.3.References to UI Elements (34)5.4.Sample Translations of Texts (35)5.4.1.Marketing Text (35)5.4.2.How-to Text (35)5.5.Fine-Tuning during Editing/Screen Review (37)1.Goals of This GuideThis document describes the tone, style and some specific translation instructions which should be used as reference during the Swedish localization of Windows Phone and its documentation. Windows Phone is a unique project as regards tone, style and terminology usage. The main goal of this guide is to help the translator understand and learn how to deal with all its linguistic and stylistic nuances during localization.There are 4 main focus areas in this guide:1.Windows Phone Voicenguage-specific guidelines on tone, style and terminology3.UI-specific Localization Guidelines—e.g. capitalization, text overflow,punctuation4.UA-specific stylePlease note this style guide is intended to be the main stylistic reference for Windows Phone projects. It is also a live document—it may be updated at certain stages to make sure the examples reflect all the latest information and guidelines.2.The Windows Phone VoiceThe language related to Windows Phone should make consumers (users) feel that they are empowered and supported. Windows Phone should be perceived as genuine, spirited, balanced, and supportive:Genuine•Speak with confidence.•Be an experienced guide.•Be friendly, focusing on the customer’s needs.Spirited•Genuinely express your own enthusiasm.•Express the achievable and talk about the difference it makes.•Reveal the unexpected, the sparkle, the delight.•Express a pleasant, engaging rhythm.Balanced•Be an experienced concierge: personal, friendly, enthusiastic, attentive.•Know when to keep things light, when to get down to facts.•Keep the moment, the audience, and the message in mind.•Don’t overpromise—be quick, clear, concise.Supportive•Lend help where it's needed, when it's needed.•Convey your knowledge like a trusted friend.•Strive to put others at ease.•Frame things positively, with a friendly demeanor.nguage-Specific Guidelines3.1.General Tone & Voice—Share the MessageThe Windows Phone device targets a group of modern, career-oriented people who expect their mobile phone to meet their needs in both their professional and private lives.The general tone needs to be accurate, direct, quick, clear, and concise but at the same time enthusiastic and attentive. The style of the translation should be rather informal, straightforward and to the point, concise, clear and professional. The language should not be too colloquial/slangy/trendy, and neither should it include IT/technology jargon.3.2.Style—Help Deliver the VoiceThe style is direct and personal.Use the Swedish form “du” when translating the English word “you”. Avo id using the impersonal “man”.Examples:When the source uses the first person plural as a voice of the phone speaking to the user, an impersonal structure should be used where it fits better:Example:However, sometimes it is also possible to follow the English source.Example:This can be done when the purpose is to highlight the friendly and direct tone used in the source text.Avoid translating the word “please” with “vänligen” or “var vänlig”. This does not sound natural in Swedish.The “+” sign in the source text can be kept in the Swedish translation. Do not insert extra space around the “+” sign.The “&” characterThe general rule r egarding the “&” character is to replace “&” with “och” (“and”) in the Swedish translation.age—Sound NaturalIn order to transmit a positive and friendly tone, direct speech should be used instead of indirect. This will also help avoid redundancy and improve the fluency of the text. Use active voice and imperative or indicative mood. These forms are easier to understand than the passive voice and subjunctive mood.Examples:3.4.Terminology—Be ConsistentUse terminological options which are easy to understand, up to date and in line with the terminology used by competitors. The focus should not be on following Microsoft standard terminology, but rather on researching and identifying those terms most widely used within the mobile industry of your target country.Always refer to the Windows Phone terminology as priority no. 1. Please note that approved translations for Windows Phone key terms are to be found in the Windows Phone MultiTerm database.When translating Windows Phone for Office applications such as presentations, e-mails, spreadsheets etc., aim for consistency with current Office applications in order to give the user a consistent experience. Please pay special attention to Excel formulas and functions—verify their translation in the latest localized version of Excel and/or in TRES.Microsoft standard terminology should be used in conjunction with other Microsoft products (Xbox, Internet Explorer, etc.) as secondary source of reference. As part of your terminology research, always check what is used in other products in TRES and TermStudio.If needed, please provide feedback on Windows Phone terminology you feel is incorrect (but please do not attempt to change approved terminology before receiving confirmation from the project team).Also contact the project team if you come across a new app, product or feature name that is not included as part of the Windows Phone terminology. Product names are normally not translated (e.g. Windows Phone). Feature names can usually betranslated (e.g. Kid’s Corner, voicemail)—even though there may be some exceptions of features that need to stay in English (e.g. Data Sense). In any case, it is extremely important to always confirm localizability of any such items with the project team.Examples:3.4.1.Naming Guidelines and Trademark RequirementsPlease follow Windows Phone Naming Guideline and Trademark Requirements provided separately.3.5.Handling Fictitious ContentFictitious content is legally sensitive material and as such cannot be handled as a pure localization issue. When dealing with fictitious company and people names in Windows Phone, please use the list of legally approved names provided by the Microsoft Legal department (LCA). The Windows Phone product team representative will be able to provide you with the list of legally approved names managed by LCA. *******************The domain name should be left unlocalized, as it is a globally recognized domain created by the IANA (Internet Corporation for Assigned Names and Numbers) for sample purposes. “Someone” can be replaced with a first name from the Approved People Name list or any common name in the country. For Swedish, please replace ******************* with ****************.3.6.MeasurementsThe EN US source contains measurements in strings such as:Regardless of the spacing in source, please add a blank space between the value (a placeholder like “%s” in the examples above) and the unit of measurement in the translation. Please note that while the source is inconsistent in this regard, the translation should always have a space between a number and a unit of measurement.The unit “KB” (kilobyte) should be translated as “kB” with the letter “k” in lowercase.4.Windows Phone UI Localization Guidelines 4.1.How to Translate UI Elements4.1.1.App Bar Icon4.1.2.App List Item4.1.3.Buttons4.1.3.2.Push Button4.1.3.3.Radio Button4.1.4.Check Box Label4.1.5.Edit Box Label4.1.6.Group Label4.1.7.Hub Title4.1.8.List Item in Settings4.1.9.Menu Items4.1.9.1. Application Menu Item4.1.9.2.Context Menu Item4.1.10. Message Box4.1.10.1. Message Box Body4.1.10.2. Message Box Header4.1.11. Notification Toast4.1.12. Page Title4.1.13. Pane Section Title4.1.14. Phone Control Label4.1.15.Pivot Item4.1.16. Progress Indicator Text4.1.17. Text Box4.1.18. Tile Label4.1.19.Toggle Switch4.1.19.1. Toggle Switch Label4.1.19.2.Toggle Switch TitleNote: Target capitalization follows source capitalization style. For more information on Windows Phone capitalization style, see Capitalization—Mind the Case.4.2.How to Translate References to UI ElementsReferences to UI elements within the UI can be found in error messages, task messages, etc. It is important to have a consistent approach towards the localization of such references. References to UI elements can appear in examples such as the below.Example:SourceMake sure your email address and password are correct, and then tap Sign In. DescriptionThe string above makes a reference to the “sign in“ push button. In the EN US source, push buttons are in all lowercase when appearing on their own as standalone UI options; however, when there is a direct reference to these elements in UI messages, English does not use lowercase, but title casing instead, i.e. the 1st letter of each word is capitalized. This is why in the source example above “Sign In“ appears in title casing.Translation StrategyFor Swedish, references to UI elements within UI strings should be translated using sentence case. As a result, the translation of the source string in the example above would be as follows.TranslationKontrollera att e-postadressen och lösenordet är korrekt och tryck sedan på Logga in.4.3.Text OverflowIn some screens, the text flows out of the screen. This is part of the UI design. Whether text is allowed to flow out of the screen or not depends on where it appears and what type of control it is.For example, some text that is not part of the user interface (generated by a user or coming from an external server) can overflow out of the screen.Titles that come from a previous screen (like the ones from the Settings page) and run out of the screen can be truncated—even if the text is not understandable. That is the behavior in the source UI.Examples:Control—Label with Title1Style4.4.Capitalization—Mind the CaseWindows Phone showcases a very specific capitalization style—and Swedish follows the source in this respect. What follows is a summary of this Windows Phone-specific capitalization style.Lowercase:Lowercase notation is preserved in the translation in order to follow the original marketing design.Lowercase is used in the following user interface (UI) elements:Exceptions:∙If you have a branded name, use the appropriate capitalization.∙Proper nouns are excluded from this rule and should follow the appropriate capitalization.Sentence case:Please always follow source capitalization when sentence case is applied.Title Case:The general rule is that in Swedish only the first word in titles is capitalized; the following words are capitalized only if they are proper nouns or would normally be capitalized when appearing on their own in other contexts.∙Photo Album Titles∙Tiles, Hubs, Cards (Live Tiles, People Hub, Me Card)Examples:People Hub—Hubben KontakterMe Card—Kortet JagALL CAPS:ALL CAPS is used in source for the following UI elements:∙PAGE/APPLICATION TITLE∙DIALPAD LABELExamples:To sum up, all the above product specific capitalization guidelines should be followed during translation into Swedish.4.5.Words—Show as well as Tell∙To show simple and easy, use simple sentences and phrases, minimal text, and everyday words.∙Avoid the use of excessively long words as they can lead to truncations.∙Use the language that customers use.∙Translate colloquial and conversational phrases in a friendly tone and style.∙Interjections (such as Aha! Ooops!, etc.) can be translated with expressions such as “Hoppsan!”, “Oj då!”or “Tyvärr!”. However, if no such expression isappropriate in the context, the interjection can be omitted in Swedish. Examples:4.6.Punctuation—Divide and Conquer∙Do not use abbreviations!∙Do not use semicolons. Two shorter sentences are better and easier to read.∙Don’t overuse exclamation marks. Choose stronger words.∙Like exclamation marks, question marks should be used judiciously.∙An em dash adds fluid emphasis—and it’s more casual than a colon. Examples:4.7.Editing/Screen Review—Fine-Tune the TranslationScreen editing is a key step to detect any style, terminology or other linguistic inconsistencies or errors introduced during translation. Here are some important issues to look out for during your review:∙Strings that include redundant words. Unnecessary repetitions should be avoided.∙Too literal translations. The text needs to be naturally-sounding and appealing in the target language.∙Concordance. Translators are sometimes presented with standalone strings for translation. Some words in English, mainly adjectives, are used in conjunctionwith different words—translating these standalone terms may easily lead toconcordance issues (gender or singular/plural).∙Truncation. In some instances it will be necessary to shorten strings due to length restrictions in the graphical interface. Do not ever abbreviate words; it is preferable to reformulate the strings to shorten them. In some cases, it might be possible to leave out part of the string without losing the meaning. If this is not possible, contact the Product Team to discuss a possible solution.Examples:4.8.Handling Input from External StakeholdersAnalyze the feedback provided by mobile operators, Microsoft subsidiary contacts, and other relevant parties. If any changes are needed to be implemented in the product resulting from external stakeholder feedback (such as a terminology change or any other linguistic change), please discuss the changes with the Microsoft Project Manager first. After getting the approval, the reference material should be updated with the latest approved changes.Please explore the already published pages for Swedish at the following location: /windowsphone/sv-SE/default.aspx.5.1.GeneralThe language used in is intended to make the user feel that this is a system they can depend on. The overall style should be perceived as sincere, enthusiastic, balanced and supportive. The text is intended to be casual and full of energy, with simple, easy-to-understand explanations.The rules concerning the general style and tone of the user interface also apply to the Windows Phone website. This contributes to a consistent look and feel perceived by any user working with the device and browsing the website.Please refer to The Windows Phone Voice section for more information about the individual rules.5.2.TerminologyThe same terminology used for translating the Windows Phone user interface must be applied in the Windows Phone website. UI options must be referenced precisely, as any mismatched terminology might confuse the user and make the website less coherent.To reiterate, please take into account the guidelines already provided in this section as regards vocabulary choices on this project.Also, please note that there is some key terminology specific to the component. Translations for these terms can be found in the Windows Phone MultiTerm database.Other aspects to take into account:Rigid term-to-term approach: Rework for fluency/adherence to basic guidelines of tone and voice. For high-visibility terms, always do a reality check—“Can that sound awkward or incorrect in Swedish? Do people speak like that?” If needed, provide feedback on terminology that you consider incorrect.“Layers” of localization:The style tends to change when localization occurs in phases. Please refer to legacy or earlier translations for specific solutions or guidelines. Correct past mistakes and continue with good solutions. If the legacy translation is not up to the standard, disregard it. However, do not ever change approved terminology. Any inappropriate terminology should be flagged.5.3.Elements Specific to 5.3.1.Image CaptionsImage captions can be found in the text in the following structure:<hhtInlineImage href="/global/windowsphone/en-ww/PublishingImages/howto/wp7/inline/basic-icon-favorites.png" altText="Favorites icon"/>.Only the highlighted text is translatable:<hhtInlineImage href="/global/windowsphone/en-ww/PublishingImages/howto/wp7/inline/basic-icon-favorites.png" altText="ikonen Favoriter"/>.5.3.2.Topic TitlesPlease follow the style of the source. If the source uses an imperative, use the imperative in the translation as well. If the source uses present participle, use the infinitive form (without “att”) in target.5.3.3.References to UI ElementsIn , the EN US source uses sentence casing to indicate references to UI elements. For Swedish, references to UI options should be localized using sentence casing.Examples:5.4.Sample Translations of TextsThe two sample translations included in this section illustrate the approach adopted for the localization of UA sites.Marketing Text5.4.1.5.4.2.How-to TextPress the SearchWith the music playing, hold your phone where you can clearly hear the music, and then tap MusicTryck på knappen SökMedan musiken spelas upp håller du telefonen där du hör musiken tydligt och trycker på5.5.Fine-Tuning during Editing/Screen ReviewThe review stage—either on the file or the screen—is key to verify that the translation is accurate and adheres to the Windows Phone voice and style as well as the approved key terminology. When reviewing, please take particular care on the following linguistic aspects:∙All the main references have been followed, particularly as regards localization of Windows Phone and other related products UI options.∙Image captions and topic titles have been translated consistently.∙The text flows, is straight-forward and appealing to the reader.∙The style follows the agreed Windows Phone tone and voice staples into your language.∙The text is translated consistently. All Windows Phone and key terms have been localized as per approved glossary.。
摘要上一回我们为大家介绍了XNA Framework 支持游戏程序制作的重要类别,做为开发游戏程序的基础知识。
除此之外,我们也利用所介绍的类别实作一个简单的游戏程序,并令其具有能够不断卷动的背景图案。
这一回我们将会介绍更多XNA Framework 支持游戏开发的类别,包括支持输入控制,音效播放,以及背景音乐播放控制的类别等等,让读者能够为所制作的游戏程序加入更丰富的游戏效果。
输入控制游戏程序难免需要和用户互动,让使用者可以藉由输入设备,例如键盘、触控面板、鼠标、或是游戏控制器进行游戏控制,与游戏程序达到互动的效果。
要让用户控制游戏程序的进行,可以利用Keyboard 类别搭配KeyboardState 结构,利用TouchPanel 类别搭配TouchCollection 结构,利用Mouse 类别搭配MouseState 结构,或是利用GamePad 类别搭配GamePadState 结构,对所操作的游戏程序进行控制。
Keyboard 类别的功能很简单,只提供名称为GetState 的方法以取得用户操作键盘的按键状态。
游戏程序可以呼叫Keyboard 类别的GetState 方法取得键盘的状态(型态为KeyboardState 结构的传回值),以判断使用者按了那一个键。
KeyboardState 结构的常用属性请参考表1 的说明:表1:KeyboardState 结构的常用属性KeyboardState 结构的常用方法请参考表2 的说明:表2:KeyboardState 结构的常用方法要判断用户操作鼠标的做法和判断用户操作键盘的操作类别,游戏程序可以先呼叫Mouse 类别的GetState 方法取得鼠标的状态(型态为MouseState 结构的传回值),再透过鼠标的状态判断用户的操作动作。
有关Mouse 类别常用的方法可以参考表3 的说明:表3:Mouse 类别常用的方法MouseState 结构常用的属性请参考表4 的说明:表4:MouseState 结构常用的属性虽然Windows Phone 7 智能型手机并未配备鼠标,但是游戏程序还是仍然能够使用Mouse 类别与MouseState 结构判断用户操作鼠标的动作,其效果相当于使用者对智能型手机进行触控操作。
Windows Phone开发环境的搭建一、开发环境的要求:1、硬件条件:(1)电脑一台(2)64位CPU支持二级地址转换技术(SLAT),这是运行模拟器所必需的,一般I3以上的处理器都能满足要求。
(3)硬盘6.5G可用空间,4 GB RAM2、操作系统类型:Windows 8 64 位 (x64) 客户端版本3、软件需要:Visual studio 2012 Update3或visual studio 2013以上版本注:如何检测CPU是否支持二级地址转换技术?SLAT(Second Level Address Translation)二级地址转换技术,在Intel和AMD处理器中均有所支持,但名称有所不同,Intel叫做EPT(Extended Page Tables),在Nehalem 架构中开始支持;AMD叫做RVI(Rapid Virtualization Indexing),在第三代Opteron处理器Barcelona中才开始支持。
该如何检测CPU是否支技SLAT呢?目前常用的方法是用微软的小工具“Coreinfo”进行检测,其下载地址是:/en-us/sysinternals/cc835722进去后点击Download下载,如下图下载下来以后为压缩文件,解压后把解压出的文件放在某个盘的根目录下,如放在D 盘(放在哪个盘不影响,只是命令变一下)以管理员方式运行CMD(一定要以管理员方式运行,否则出不来结果),假如工具放在D盘,在命令行输入D:\Coreinfo.exe –V按回车后就会得到如下信息:*号表示支持-号表示不支持可以看到这台电脑不支持二级地址转换。
二、开发工具的安装1)首先安装集成开发环境Visual Studio或者Visual Studio Express for Windows Phone 其中Visual Studio Express for Windows Phone是免费的。
Windows Mobile开发新手入门教程一. Windows Mobile开发环境1. Windows Mobile技术的基本开发环境配置:2. 配置开发环境:(一) 安装VS2019 (或VS2019)主要安装VC++以及 Framework(二) 安装VS2019 sp1安装Windows Mobile 6 SDK的前提安装注意事项(1)安装时间会比较长,配置一般的机器可能需要1小时左右。
(2)安装前检查C盘空余空间,官方要求6G,但有人2G也顺利安装了,这主要取决VS自定义安装多少,由于VC比较占空间,所以较保险的方法是把环境变量temp和tmp ,虚拟内存都定位到其它盘上,以腾出空间。
(3)如果此前安装过web application project,先把它卸载,否则可能会安装失败。
(4)VS2019 SP1的补丁包是把你机器上所有单独装过vs2019的版本的补丁都打上,如果机器上同时装了Visual Web Developer Express和Visual Studio team sutie,那么它就要运行安装补丁两次.安装过程常见问题(1) 数字签名认证的问题在2019或XP安装VS2019 SP1。
可能会收到错误信息:错误 1718。
[FileName]文件被数字签名策略拒绝。
(2)C盘空间的问题提示C盘空间不足,不能成功安装,错误代码2908。
问题解决办法问题(1)的解决办法:1)单击“开始”,单击“运行”,键入secpol.msc,然后单击“确定”。
2)打开“安全设置->软件限制策略”。
注意如果未列出软件限制,右击“软件限制策略”,然后单击“新建策略”。
3)打开“对象类型-->强制”。
4)点选“除本地管理员以外的所有用户”, 并单击“确定”。
5)重新启动计算机。
要点:在执行以上步骤之后,本地管理员就可以安装 .msi 包或 .msp 包。
安装了程序包之后,请按照以上步骤重置强制级别。
因为需要在手机上配置IP,我需要一个界面输入IP地址,虽然直接使用TextBox,但是这样不太友好,我希望能够有和Windows网络设置上一样的IP输入框。
所以决定写一个自定义控件。
设计控件外观4个TextBox和3个显示“.”的TextBlock就可以了,结构很简单:XAML代码如下:1 <StackPanel Orientation="Horizontal" Height="72" >2 <TextBox x:Name="TextOctet1"/>3 <TextBlock Text="." />4 <TextBox x:Name="TextOctet2"/>5 <TextBlock Text="." />6 <TextBox x:Name="TextOctet3"/>7 <TextBlock Text="." /><TextBox x:Name="TextOctet4"/>89 </StackPanel>因为IP地址里面只有数字和“.”,而且每位地址最长为3。
为了限制输入将样式设置如下:01 <UserControl.Resources>02 <Style TargetType="TextBox">03 <Setter Property="Width" Value="90"/>04 <Setter Property="MaxLength" Value="3"/><Setter Property="TextAlignment" Value="Right"/> 0506 <Setter Property="InputScope" Value="Number"/>07 </Style>08 <Style TargetType="TextBlock">09 <Setter Property="Margin" Value="5,30,5,0"/>10 </Style>11 </UserControl.Resources>InputScope设置为Number,限制输入数字和.。
Windows Phone笔记(9)使用独立存储(上)在前面的笔记中我们了解到如何在页面间共享数据,但是这些数据是保持在内存中的,当程序被终止时存储的数据就会丢失,在很多时候我们有必要对数据进行持久化,例如,存储程序的配置,启动信息等。
在Windows Phone中我们可以通过独立存储来实现数据的持久化。
但是在这里为了提高系统的安全性,Windows Phone中的应用程序中所有的I/O操作只限于使用独立存储,并且只能访问本应用程序目录下的独立存储。
首先根据要存储的数据类型,Windows Phone的独立存储的使用类型有下面三种,我们会对下面的使用独立存储的类型分别进行介绍,以及如何使用它。
设置:使用IsolatedStorageSettings 类将数据存储为键/值对。
文件和文件夹:使用IsolatedStorageFile 类存储文件和文件夹。
关系数据:使用LINQ to SQL 将关系数据存储在本地数据库中。
使用IsolatedStorageSettings类保存应用程序设置在我们的应用程序中,经常会对应用程序做一些设置,以符合应用程序的需要,或适应自己的操作习惯。
比如说对应用程序更换主题、皮肤,对应用程序的启动设置等等。
要想实现这些功能我们必须对我们队应用程序作出的更改和设置数据进行持久化,即使程序关闭了,下次也一样可以范围这些存储的数据,在Windows Phone中我们使用IsolatedStorageSettings类对应用程序进行设置,该类使用键值对的方式来存储数据。
下面我们通过一个简单示例来演示如何使用IsolatedStorageSetting类来存储数据。
该示例的作用是保存页面退出前的背景色,重写运行程序后加载还原保存的背景色。
只有一个MainPage页面,前台页面的代码不需要修改,这里就这在给出。
首先我们还是需要使用在上一篇笔记中使用过的App类,因为该类的实例存在于整个应用程序的生命周期中的,所有很适合用来在整个应用程序中共享数据,着这里我们在App类中添加一个属性,用来保存背景色,以及添加两个方法,分别用来保存和加载程序的设置,需要注意的使我们的App类是一个分部类(可以将类、结构、接口的定义拆分到两个或多个源文件):1public partial class App : Application2 {3//应用程序设置4public Brush MainPageBackgroundBrush { get; set; }56///<summary>7///加载设置8///</summary>9void LoadSettings()10 {11IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;12 Color mainPageClr;13//检查是否保存了背景色14if (settings.TryGetValue<Color>("MainPageBackgroundColor", out mainPageClr))15 {16this.MainPageBackgroundBrush = new SolidColorBrush(mainPageClr);//加载保存的设置17 }18 }1920///<summary>21///保存设置22///</summary>23void SaveSettings()24 {25IsolatedStorageSettings settings = IsolatedStorageSettings.ApplicationSettings;2627if (this.MainPageBackgroundBrush is SolidColorBrush) 28 {29settings["MainPageBackgroundColor"] = (this.MainPageBackgroundBrush as SolidColorBrush).Color;//保存设置30 }31 settings.Save();3233 }34 }复制代码那么现在就有一个问题了,我们该什么时候保存设置?什么时候又该加载设置呢?我们可以通过利用Windows Phone中应用程序页面的生命周期的特点来编写相关的代码。
在Windows Phone中我们可以利用应用程序状态管理的4个主事件(包含在Application对象中)来完成我们的操作,它们分别是:Launching:当应用程序启动时发生。
Deactivated:当应用程序被取消激活时发生。
Activated:当之前处于休眠状态或被逻辑删除之后应用程序变为活动时发生。
Closing:当应用程序退出时发生。
Windows Phone应用程序的保留状态所必须处理的生命周期、执行流和事件。
十秒原则:如果保存临时状态所花的时间超过10 秒,则系统将终止应用程序。
了解了这四个程序状态管理的事件后,前面的问题我们就很容易的回答了:Launching 事件和Activated事件发生时,我们加载设置;Deactivated事件和Closing事件发生时,我们保持设置。
下面我们把保存和加载设置方法的调用放在,Windows Phone 项目生成的模板中已经添加的这些事件状态管理函数中,下面是App.xaml.cs添加的代码:1//应用程序启动(例如,从“开始”菜单启动)时执行的代码2//此代码在重新激活应用程序时不执行3private void Application_Launching(object sender, LaunchingEventArgs e)4 {5 LoadSettings();//加载设置6 }78//激活应用程序(置于前台)时执行的代码9//此代码在首次启动应用程序时不执行10private void Application_Activated(object sender, ActivatedEventArgs e)11 {12 LoadSettings();//加载设置13 }1415//停用应用程序(发送到后台)时执行的代码16//此代码在应用程序关闭时不执行17private void Application_Deactivated(object sender, DeactivatedEventArgs e)18 {19 SaveSettings();//保存设置20 }2122//应用程序关闭(例如,用户点击“后退”)时执行的代码23//此代码在停用应用程序时不执行24private void Application_Closing(object sender, ClosingEventArgs e)25 {26 SaveSettings();//保存设置27 }复制代码准备工作都已经做好了,那么我们下面给出我们MainPage.xaml.cs的后台处理代码:1public partial class MainPage : PhoneApplicationPage2 {3 Random ran = new Random();4//构造函数5public MainPage()6 {7 InitializeComponent();8//为使用独立存储设置访问App类9Brush brush = (Application.Current as App).MainPageBackgroundBrush;1011if (brush != null)12 {13this.ContentPanel.Background = brush;14 }15 }1617protected override void OnManipulationStarted(ManipulationStartedEventArgs e)18 {19SolidColorBrush brush = new SolidColorBrush(Color.FromArgb20 (255, (byte)ran.Next(255), (byte)ran.Next(255), (byte)ran.Next(255)));21this.ContentPanel.Background = brush;2223//为使用独立存储设置,保存到App类24 (Application.Current as App).MainPageBackgroundBrush = brush;2526base.OnManipulationStarted(e);27 }28 }复制代码编译运行程序:运行程序随机生成一个背景色,然后点击手机的"Back","Start"按钮,重新回到我们的应用程序,我们可以看到背景色已经被加载为上次程序退出时保持的设置。
好,那么这里我们已经知道了如何通过使用IsolatedStorageSettings 类来保持应用程序的设置,在后面的笔记中我们学习如何使用IsolatedStorageFile 类存储文件和文件夹。
参考资料:/zh-cn/library/ff817008(v=vs.92).aspx(重要)/zh-cn/library/ff967547(v=vs.92).aspx/zh-cn/library/hh307995.aspx(重要)/zh-cn/library/ff967548(v=vs.92).aspx《Programming Windows Phone 7 Microsoft Silverlight Edition》作者:晴天猪出处:/IPrograming本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,否则保留追究法律责任的权利。