Warning, this is long. I'll be frank with you, as I always am. I have an iPhone, a number of iPads and I like them fine. I have a Windows Phone that I use occasionally. I know C# but I do not know Objective-C.

警告,这很长。 我将一如既往地坦诚与您。 我有iPhone,还有许多iPad,我喜欢它们。 我有一个偶尔使用的Windows Phone。 我知道C#,但不了解Objective-C。

TL; DR版本 (TL;DR Version)

I made my first Phone Application. I've spent about 6 hours on it. It's called Lost Phone Screen and it makes nice wallpaper. It's over at http://lostphonescreen.com. It's a simple customizable Windows Phone 7 Lockscreen. It was way easier and more fun to make than I expected. If I make a million bucks with this thing I'm GONE. You'll never see me again. :)

我做了我的第一个电话申请。 我花了大约6个小时。 它被称为“失落的手机屏幕”,它可以制作精美的壁纸。 在http://lostphonescreen.com结束。 这是一个简单的可自定义的Windows Phone 7锁屏。 制作起来比我想象的要容易和有趣得多。 如果我用这个东西赚一百万美元,那我就走了。 你再也见不到我了。 :)

介绍 (Introduction)

I wanted to see how quickly I could make a useful Windows Phone 7 application. I'm not talking about just dragging a button onto a Hello World template and adding "press to fart." I'm talking about an MVP - Minimally Viable Product. It might not be the greatest app in the world, but it will provide value. At least to me.

我想看看我能以多快的速度制作一个有用的Windows Phone 7应用程序。 我不是在谈论将按钮拖到Hello World模板上并添加“按放屁”。 我说的是MVP-最低可行的产品。 它可能不是世界上最伟大的应用程序,但它将提供价值。 至少对我来说。

Disclaimer: I don't work for the Windows Phone Team and don't really know anyone over there. I did this on my own with my personal details, personal account, as an "on the side moonlighting thing." While I work for Microsoft, I work in the Web department, not in Phones.

免责声明:我不是Windows Phone团队的成员,也不真正认识那里的任何人。 我用我的个人详细信息和个人帐户来完成此操作,将其作为“附带条件的东西”。 在Microsoft工作期间,我在Web部门工作,而不是在Phones工作。

I honestly hadn't given the Windows Phone too much thought until the "Mango" release, when things got really interesting.

老实说,直到“ Mango”发布时,我才开始对Windows Phone进行过多考虑,那时事情变得非常有趣。

So, last week I sat down and decided to see how quickly I could come up with an app, write it, market it (make a website) and get it in the Windows Phone Marketplace. I had never done any of this stuff and my machine didn't even have any Phone development tools so I was starting from literally Step, ahem, Zero.

因此,上周我坐下来,决定看看我能以多快的速度提出一个应用程序,进行编写,销售(建立一个网站)并在Windows Phone Marketplace中获得它。 我从来没有做过这些事情,而且我的机器甚至没有任何Phone开发工具,所以我从字面上看是Step,Ahem,Zero。

这个概念 (The Concept)

I am consistently surprised at at how often someone shows me their fancy new phone - no matter what kind of phone they have - and they're using some lame default wallpaper. Folks rarely lock their phones (bad idea) and when they do, there's nothing on the lock screen wallpaper to help them get their phone back if it's ever lost.

有人经常给我看上他们花哨的新手机(无论他们使用哪种手机),而且他们使用的是一些la脚的默认壁纸,这让我一直感到惊讶。 人们很少锁定手机(坏主意),当他们这样做时,锁屏墙纸上没有任何东西可以帮助他们在手机丢失的情况下找回手机。

"But Scott! I can enable this new fangled GPS and track my phone globally!"

“但是,斯科特!我可以启用这种新的有定位功能的GPS并在全球范围内跟踪我的手机!”

Really? That's lovely and I'm sure ever se helpful when your phone is left in a basement pub, office building, subway or any other GPS-friendly locations. But that's not the point. Why make it hard? If your email or alternate phone number was on your lock screen - maybe even with a reward - chances are you'll get your phone back quickly and easily. Why do I say that? Because I've lost my phone twice before and had a dude call me to pick it up twice before.

真? 太好了,当您将手机放在地下室,办公楼,地铁或任何其他GPS友好的地点时,我肯定会对您有所帮助。 但这不是重点。 为什么要加倍努力? 如果您的电子邮件或备用电话号码在锁定屏幕上-甚至可能会有奖励-您很可能会Swift而轻松地将手机取回。 我怎么这么说因为我之前丢失了两次手机,并且有一个家伙打电话给我,所以之前两次将其接听。

I'll make an application that stamps your contact information on custom wallpaper for the Windows Phone 7. My requirements are:

我将制作一个在Windows Phone 7的自定义墙纸上标记您的联系信息的应用程序。我的要求是:

  • Must create lock screen wallpapers that match the Phone's style.

    必须创建与手机风格匹配的锁屏壁纸。

    • The resulting wallpapers must look like a built-in feature 生成的壁纸必须看起来像内置功能
  • Must look actually designed. Correct fonts, alignment, layout.

    必须看起来实际设计。 正确的字体,对齐方式,布局。

    • No garish VB3-on-a-phone-green-background-purple-buttons for me. 对于我来说,在手机绿色背景紫色按钮上没有任何花哨的VB3。

Cool. I will call it LostPhoneScreen and I pay $8 for the domain. Then I get to work.

凉。 我将其称为LostPhoneScreen,并为该域名支付8美元。 然后我开始工作。

步骤0-获取工具 (Step 0 - Get the Tools)

First I go and download the Phone Development Tools. They are free to download, which is cool. To publish an app costs $99 a year though, but I don't have to pay until I decide to publish the app. I can publish up to 100 apps for that $99 and unlimited apps if I pay per app.

首先,我去下载电话开发工具。 它们是免费下载的,很酷。 发布应用的费用为每年99美元,但是在我决定发布应用之前,我不必付费。 如果我为每个应用付费,我最多可以为该99美元发布100个应用,并发布无限的应用。

If I pay (which I did) I make an account at http://create.msdn.com and put in my bank account information  for when the checks come rolling in.

如果我付款(我这样做了),我会在http://create.msdn.com上创建一个帐户,并输入我的银行帐户信息,以了解支票何时结转。

OK, the Windows Phone SDK is installed so I start looking around for best practices. A development environment is only as good as its community and I don't want to write a bunch of stuff myself if someone has already done the work for me.

好的,已安装Windows Phone SDK,因此我开始四处寻找最佳做法。 一个开发环境与其社区一样好,如果有人已经为我完成了工作,我也不想自己写很多东西。

第1步-获取基本的开源库 (Step 1 - Get the Essential Open Source Libraries )

My app  has some requirements and some specific technical requirements. I pick these ones because I'm always irritated when apps don't do these things.

我的应用程序有一些要求和一些特定的技术要求。 我选择这些是因为当应用程序执行这些操作时,我总是很烦。

  • Must support Mango multi-tasking/quick-resuming 必须支持芒果多任务/快速恢复
  • Must look nice and layout like a built-in app 必须看起来不错并且布局像内置的应用程序
  • Must notify (email?) me if a crash happens 如果发生当机,必须通知(电邮给我)
  • Must work with light and dark theme 必须使用浅色和深色主题
  • Must have a nice About Screen with release notes 必须有一个不错的关于屏幕的发行说明
  • Must have a nice website to promote that app 必须有一个不错的网站来推广该应用

I started with these requirements and found these open source libraries and projects to support each requirement.These things are so important that the should have been included in the Phone SDK by default.

我从这些要求入手,发现了满足每个要求的这些开源库和项目。这些东西非常重要,因此默认情况下应将它们包含在Phone SDK中。

小沃森 (LittleWatson)

You know when a Windows app crashes and a crash report is sent? That's done by a system called Dr. Watson. Andy Pennell made a small Error Reporting library for Windows Phone 7 called "Little Watson" that was then extended by Bjorn Kuiper and packaged into Bjorn's excellent Northern Light's WP7 Toolkit. His toolkit includes a bunch of little conveniences for serialization, logging and error handling.

您知道Windows应用程序崩溃并发送崩溃报告吗? 这是通过称为Watson博士的系统完成的。 Andy Pennell为Windows Phone 7创建了一个小的错误报告库,称为“ Little Watson” ,然后由Bjorn Kuiper进行了扩展,并打包到Bjorn出色的Northern Light的WP7工具包中。 他的工具包为序列化,日志记录和错误处理提供了许多便利。

It was extremely important to me as a first time app developer (and frankly, it's just important) to get notifications of crashes. I could setup a web service to catch them via HTTP but for the first version, I'll notify the user and email the call stack to me using Little Watson.

作为我的初次应用开发人员,这对于获得崩溃通知非常重要(坦率地说,这很重要)。 我可以设置一个Web服务以通过HTTP捕获它们,但对于第一个版本,我将通知用户并使用Little Watson通过电子邮件将调用堆栈发送给我。

MetroGridHelper (MetroGridHelper)

I found out very quickly when doing resource on phone apps that coding is only maybe 30% of the work. The rest is design. Then layout, then more design. Even for a "trivial" app.

在手机应用程序上进行资源处理时,我很快发现,编码仅占工作量的30%。 剩下的就是设计。 然后进行布局,然后进行更多设计。 即使是“琐碎”的应用程序。

I'm not a designer, but I can follow the basic "Metro design guide for developers" and I see over and over that alignment is king. You know those apps where you look at them and know something's wrong? But you can't see what? Turns out it's usually font size, layout or alignment just poking at the back of your brain.

我不是设计师,但是我可以遵循基本的“面向开发人员的地铁设计指南”,并且我一遍又一遍地看到,一致性是最重要的。 您知道在看这些应用程序时发现了什么问题吗? 但是你看不到什么? 事实证明,通常它的大小,布局或对齐方式只是戳在脑后。

Jeff Wilcox create a useful debugging assistant that you can just drop into your application with NuGet that will make a set of red squares that are offset 12px from each other with in a page padding of 24px. As you start doing Windows Phone work you'll find that 12px is a magic number and everything looks "right" if it aligns on these boundaries.

Jeff Wilcox创建了一个有用的调试助手,您可以使用NuGet将其放到您的应用程序中,它将创建一组相互偏移12px的红色方块,页面填充为24px。 在开始进行Windows Phone工作时,您会发现12px是一个神奇的数字,并且如果它们在这些边界上对齐,则一切看起来都是“正确的”。

I just need to

我只需要

Install-Package MetroGridHelper

We'll also turn on the FrameRateCounter and only do these things if we are actively debugging.

我们还将打开FrameRateCounter,仅在我们正在积极调试时才执行这些操作。

// Show graphics profiling information while debugging.if (System.Diagnostics.Debugger.IsAttached){    // Display the current frame rate counters.    Application.Current.Host.Settings.EnableFrameRateCounter = true;

    // Display the metro grid helper.    MetroGridHelper.IsVisible = true;...}

This is so useful it should just be there by default. You'll hear me say that a lot.

这是如此有用,默认情况下应该就在那儿。 您会听到我很多话。

Silverlight工具包 (SilverlightToolkit)

The Silverlight Toolkit from Microsoft is up on CodePlex and also easily installed with NuGet.

Microsoft的Silverlight工具包位于CodePlex上,并且可以轻松地与NuGet一起安装。

Install-Package SilverlightToolkitWP

It include a pile of useful controls like DateTimePicker, LongListSelector, ProgressBar (the one I was interested in), Transitions (another that I wanted), and lots, lots more. These should be in the box. They are utterly essential.

它包括一堆有用的控件,例如DateTimePicker,LongListSelector,ProgressBar(我感兴趣的控件),Transitions(我想要的另一个控件)以及很多很多其他控件。 这些应该在框中。 它们是绝对必要的。

墓碑助手 (TombstoneHelper)

Tombstoning is what happens when you app gets navigated away from then navigated back to. It's how you make your app feel like it's been in the background the whole time the user was switching around, even though you were dead and then came back to life.

当您的应用从导航离开然后导航回去时,会发生Tombstoning。 这样一来,即使您已经死了,然后又复活了,也可以使您的应用始终像在整个用户切换时一样一直处于后台。

Install-Package WP7TombstoneHelper

There's a number of ways to save your apps state, but the I found the WP7 Tombstone Helper useful as it will automatically look at your controls and save their state away then put you right back when you're launched again. It isn't right for every scenario, but it was useful to me.

有很多方法可以保存您的应用程序状态,但是我发现WP7逻辑删除帮助程序很有用,因为它会自动查看控件并保存其状态,然后在再次启动时让您返回。 并非每种情况都合适,但这对我很有用。

protected override void OnNavigatingFrom(System.Windows.Navigation.NavigatingCancelEventArgs e){   this.SaveState(e); }

protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e){   this.RestoreState();}

YourLastAboutDialog (YourLastAboutDialog)

If you're not careful, your About dialog can get more complex than your application. I don't want that, but I do like me a tidy About Dialog. I found YLAD - Your Last About Dialog to be the best option for me. It's a single DLL that gives you a generic but highly configurable about dialog. How configurable you ask?

如果您不小心,“关于”对话框可能会比您的应用程序复杂。 我不想要那个,但是我确实喜欢整洁的About Dialog。 我发现YLAD-“您的最后一个关于”对话框对我来说是最佳选择。 它是一个单一的DLL,可为您提供通用的但可高度配置的对话框。 您如何配置?

Look how nice that is!

看起来真好!

It's entirely managed by a single data.xml file that's totally self explanatory. I especially appreciate apps with clear listings of what's changed between versions. Not enough apps do that, probably because it's hard. But no more! Use YLAD.

它完全由一个完全可以自我解释的data.xml文件管理。 我特别感谢能清楚列出各个版本之间变化的应用程序。 没有足够的应用程序执行此操作,可能是因为这很困难。 但没有更多! 使用YLAD 。

Windows Phone电动工具 (Windows Phone Power Tools)

Often you'll want to pull files off your emulator or actual phone directly. Since my app is going to serialize settings, make photos, and the like, I'll want to access the file system directly. The Windows Phone Power Tools were essential for accessing my application's Isolated Storage files. It was useful to simulate upgrades from one version to another and to debug serialization bugs.

通常,您通常希望直接从模拟器或实际电话中提取文件。 由于我的应用程序要序列化设置,制作照片等,因此,我想直接访问文件系统。 Windows Phone Power Tools对于访问应用程序的隔离存储文件至关重要。 模拟从一个版本到另一个版本的升级并调试序列化错误很有用。

Another one to watch is IsoStoreSpy that lets you preview files in the app itself.

另一个值得关注的是IsoStoreSpy ,它允许您预览应用程序本身中的文件。

PNGOut和PNGGauntlet (PNGOut and PNGGauntlet)

You will find yourself making a LOT of PNGs when you are doing mobile development. You'll almost always want to compress them before you ship. I squish the PNGs on my blog and often get compression improvements of 30% or more. I squished all the PNGs in my app to make the resulting XAP deployment file smaller, and the PNGs smaller on the phone itself.

在进行移动开发时,您会发现自己制作了大量的PNG。 在发货之前,您几乎总是要压缩它们。 我在自己的博客上压缩了PNG,并且压缩率通常提高了30%或更多。 我压缩了应用程序中的所有PNG,以使生成的XAP部署文件更小,而PNG在手机上更小。

I highly recommend PNGGauntlet with PNGOut. No quality is lost as PNG is a lossless image format. It's also worth pointing out that I lived in Paint.NET while making this application. It's an all around great app and the best way to work with all these PNGs.

我强烈建议将PNGGauntlet与PNGOut一起使用。 由于PNG是无损图像格式,因此不会损失任何质量。 还值得指出的是,我在制作此应用程序时在Paint.NET中。 它是一款出色的应用程序,是处理所有这些PNG的最佳方法。

便携式图书馆工具 (Portable Library Tools)

If you're going to want to create and use some assemblies between projects, the Portable Class Library project template for Visual Studio can make it a lot easier to share code.

如果您要在项目之间创建和使用某些程序集,Visual Studio的可移植类库项目模板可以使共享代码变得更加容易。

Screenshots.cs (Screenshots.cs)

It's pretty hard to take a screenshot on a Windows Phone. On an iPhone there is a special button combination, but nothing like that exists on a Windows Phone. However, application developers have to take screenshots and submit screenshots all day long. Enter "screenshots.cs" from the crazy-useful Jeff Wilcox.

在Windows Phone上截屏非常困难。 在iPhone上,有一个特殊的按钮组合,但是Windows Phone上没有这样的组合。 但是,应用程序开发人员必须全天拍摄屏幕截图并提交屏幕截图。 输入疯狂有用的Jeff Wilcox的“ screenshots.cs ”。

install-package ScreenShots.cs

When it's running (you don't want leave it running, just have it going when you need screenshots) it will take a screenshot programmatically every 2 seconds. If you leave it running it'll fill up your phone.  ;)

当它运行时(您不希望它继续运行,只需要它在需要屏幕截图时就可以运行),它将以编程方式每2秒拍摄一次屏幕截图。 如果您让它继续运行,它将充满您的手机。 ;)

NotifyPropertyWeaver (NotifyPropertyWeaver)

When making ViewModels for Windows Phone, you'll always end up taking a nice clean class with some properties and end up littering the properties with code like:

在为Windows Phone制作ViewModels时,您总是会得到带有一些属性的漂亮的干净类,并最终使用以下代码乱扔这些属性:

string givenNames;public string GivenNames{    get { return givenNames; }    set    {        if (value != givenNames)        {            givenNames = value;            OnPropertyChanged("GivenNames");            OnPropertyChanged("FullName");        }    }}
And this stresses me out. I don't want to see those OnPropertyChanged and watch my simple class full up with notification boilerplate that I don't need to see. Fortunately 

Simon Cropp agrees with me and created NotifyPropertyWeaver to add this code post-compilation via IL Weaving without the need for attributes, base classes or even a class reference! It's in NuGet: 西蒙·克罗普(Simon Cropp)同意我的观点,并创建了NotifyPropertyWeaver来通过IL Weaving添加此编译后代码,而无需属性,基类甚至类引用! 在NuGet中:

install-package notifyPropertyWeaver

Or, even easier, from the Visual Studio Gallery. NotifyPropertyWeaver adds this MSBuild task automatically in your csproj:

或者,甚至更容易地从Visual Studio Gallery中。 NotifyPropertyWeaver将此MSBuild任务自动添加到您的csproj中:

<UsingTask TaskName="NotifyPropertyWeaverMsBuildTask.WeavingTask"    AssemblyFile="$(SolutionDir)Tools\NotifyPropertyWeaverMsBuildTask.dll" />   <Target Name="AfterCompile">           <NotifyPropertyWeaverMsBuildTask.WeavingTask/>     </Target>

I realize this whole idea is scary, but I can tell you that I added it and didn't think about INotifyPropertyChanged once in the development of my application. You just add properties and he'll take care of the OnPropertyChanged stuff. If you don't believe him (I didn't) then just open your DLL in Reflector and see for yourself.

我意识到整个想法很可怕,但是我可以告诉你,我添加了它,并且在我的应用程序开发中从未考虑过INotifyPropertyChanged。 您只需添加属性,他就会处理OnPropertyChanged内容。 如果您不相信他(我不相信),那么只需在Reflector中打开您的DLL,然后亲自看看。

My ViewModel class is super basic and I only had to implement INotifyPropertyChanged and the weaver did everything else automatically. Very cool and saved me a bunch of hassle. The details are up on the Google Code site for NotifyPropertyWeaver. I found it a very elegant solution to a potentially messy problem.

我的ViewModel类是非常基础的类,我只需要实现INotifyPropertyChanged,编织器就会自动完成其他所有工作。 非常酷,为我省去了很多麻烦。 有关详细信息,请访问NotifyPropertyWeaver的Google Code网站。 我发现这是解决潜在麻烦问题的非常优雅的解决方案。

Coding4Fun Windows Phone工具包 (Coding4Fun Windows Phone Toolkit)

No, the Windows Phone 7 Toolkit isn't enough. Clint and the guys over at Coding4Fun have created a toolkit of their own that adds even more awesomeness (that should have been baked into the thing from the start). Things like Color Pickers, Color Sliders, lots of different buttons and more.

不,Windows Phone 7工具包还不够。 克林特(Clint)和Coding4Fun的家伙们创建了一个自己的工具包,该工具包增加了更多的功能(应该从一开始就将其植入东西中)。 诸如拾色器,彩色滑块,许多不同的按钮等等。

Drink in the awesome over at http://coding4fun.codeplex.com.

敬请前往http://coding4fun.codeplex.com畅饮。

Windows Phone 7模拟器皮肤切换器 (Windows Phone 7 Emulator Skin Switcher)

OK, this one isn't essential but it's totally cool eye candy. Why not change your phone skin with the Windows Phone 7 Emulator Skin Switcher? Live a little. The default one that comes with the emulator is a little meh.

好的,这不是必需的,但它完全是很酷的护眼霜。 为什么不使用Windows Phone 7模拟器皮肤切换器来更改手机皮肤? 坚持一下。 模拟器随附的默认设置为meh。

When you run it, be SURE to scroll to the right as there are LOTS to choose from.

运行它时,请确保向右滚动,因为有很多可供选择。

It's a nice touch.

很好

There's a great list of other tools, libraries and tips over at Bil Simser's The Big Dummies Guide for Windows Phone Developer Resources. Bil helped me over Skype when I had dumb questions. I'm glad he called his guide the "Big Dummie's Guide" and not the Hanselman Guide because that'd make it too obvious that I was clueless when I called. Thanks, Bil!

Bil Simser的“适用于Windows Phone开发人员资源的大傻瓜指南”中提供了大量其他工具,库和技巧。 当我有疑问时,Bil帮助我解决了Skype。 我很高兴他称自己的指南为《大傻瓜指南》,而不是《汉塞尔曼指南》,因为那太明显了,我打电话时一无所知。 谢谢,比尔!

All right. I've got the tools and I've got my idea. Now what?

行。 我有工具,也有想法。 怎么办?

编写申请 (Write The Application)

I know C# as I'm an ASP.NET Web programmer, but I'm not a XAML guy. The last thing I wrote in XAML was BabySmash and let's just say it wasn't rocket science. I started by dragging stuff around on the visual designer, pulling in buttons, text boxes and stuff but the XAML source started getting really messy with absolute pixel values and stuff I didn't like looking at. I stared at it for a while and just decided to write the XAML manually via trial and error, convinced that the the simpler the XAML was that more likely my app was laid out correctly. This turned out to be pretty true. I made a home page and an edit page.

我知道C#,因为我是ASP.NET Web程序员,但我不是XAML专家。 我在XAML中写的最后一件事是BabySmash ,我们只能说这不是火箭科学。 我首先在视觉设计器上拖动东西,拉入按钮,文本框和东西,但是XAML源代码开始对绝对像素值和我不喜欢看的东西变得非常混乱。 我盯着它看了一会儿,才决定通过反复试验手动编写XAML,并确信XAML越简单,就越有可能正确地放置了我的应用程序。 事实证明这是非常正确的。 我做了一个主页和一个编辑页面。

I got the two pages laid out and focused on making sure everything line up on the 12's (remember the MetroGridHelper I mentioned above) and tried to "intuit" when things looked wrong. I also referred to the "Metro design guide for developers" a lot.

我布置了两页,着重于确保所有内容都排列在12位上(记住上面提到的MetroGridHelper),并在出现问题时尝试“暗示”。 我也经常提到《面向开发人员的Metro设计指南》。

添加波兰语 (Adding Polish )

One thing I couldn't get my head around was that the transition between the main screen and the edit screen seemed jarring. It was like "poof." Then I realized there was no animation. Windows Phone apps usually use short but subtle animations to move between screens. Not just any old animations, but ones that involve direction to indicate moving forward or backward.

我无法理解的一件事是主屏幕和编辑屏幕之间的过渡看起来很刺耳。 就像“ po”。 然后我意识到没有动画。 Windows Phone应用程序通常使用简短但微妙的动画在屏幕之间移动。 不仅是任何旧的动画,而且还涉及指示前进或后退的方向的动画。

I remembered the Windows Phone 7 Toolkit above had transitions, so I applied them. The XAML is scary, but I only had to copy/paste. I made a NavigationIn and a NavigationOut for both pages so that they flip cleanly between each other.

我记得上面的Windows Phone 7工具包具有过渡功能,因此我应用了它们。 XAML很可怕,但是我只需要复制/粘贴即可。 我为两个页面都做了一个NavigationIn和NavigationOut,以便它们在彼此之间清晰地翻转。

I changed the PhoneApplicationFrame in App.xaml.cs to a TransitionFrame and the rest was magic. It just worked. Nice.

我将App.xaml.cs中的PhoneApplicationFrame更改为TransitionFrame,其余的都是魔术。 它只是工作。 真好

private void InitializePhoneApplication(){    if (phoneApplicationInitialized)        return;

    //RootFrame = new PhoneApplicationFrame();    RootFrame = new TransitionFrame();

    RootFrame.Navigated += CompleteInitializePhoneApplication;

    // Handle navigation failures    RootFrame.NavigationFailed += RootFrame_NavigationFailed;

    // Ensure we don't initialize again    phoneApplicationInitialized = true;}

Once this was done, if I needed to add other animations, it would be trivial. This small change made the app feel more polished.

一旦完成,如果我需要添加其他动画,那将是微不足道的。 这个小小的变化使应用程序看起来更加优美。

资源(是,更多的PNG) (Resources (Yes, more PNGs))

I needed buttons for the ApplicationBar at the bottom but I'm not a designer. I talked to Jin Yang (a designer) to do the main icon:

我需要在底部的ApplicationBar按钮,但我不是设计师。 我与Jin Yang(设计师)进行了交谈,以制作主要图标:

ASIDE: If you don't understand this icon, it's because it's apparently not universal. In the US when a child was missing in the 80's and 90's they would put their picture on the back of a milk carton. The idea was that you'd be eating your cereal in the morning and you'd notice the picture and it would seep into you brain so you'd be on the alert for that child during the day. Maybe a "missing" flyer with this phone would be more culturally non-specific.

旁白:如果您不了解该图标,那是因为它显然不是通用的。 在美国,当一个孩子在80年代和90年代失踪时,他们会将自己的照片放在牛奶盒的背面。 当时的想法是,您早上会吃谷物,您会注意到照片,它会渗入您的大脑,因此您白天要对那个孩子保持警惕。 也许这部手机的“缺失”传单在文化上更具针对性。

But I didn't need a full-blown expert for the standard black and white icons at the bottom. The Windows Phone SDK comes with 32 basic icons for things like download, save, stop, play, etc. Even better though are the icons at Templarian. These are hundreds of yummy icons for Windows Phone (and other phones) that are released under the Creative Commons license. The designers name is Austin Andrews and he's super talented. I mean, even when he's just drafting ideas he's awesome. If you use his icons, thank him and tell people. If you are a designer, why not join up and improve the pack for the community?

但是,对于底部的标准黑白图标,我不需要成熟的专家。 Windows Phone SDK带有32个基本图标,可进行下载,保存,停止,播放等操作。Templarian的图标甚至更好。 这些是在创用CC许可下发布的用于Windows Phone(和其他手机)的数百个美味图标。 设计师的名字叫Austin Andrews,他很有才华。 我的意思是,即使他只是在起草想法,他也很棒。 如果使用他的图标,请感谢他并告诉别人。 如果您是设计师,为什么不加入并为社区改进配套呢?

UPDATE: The 130 icons from WindowsWiki.info are also amazing and high quality. Another great place for icon inspiration is The Noun Project.

更新: WindowsWiki.info中的130个图标也非常出色且质量很高。 象征灵感的另一个好地方是Noun Project 。

My app was so simple that I ended up only using just four of the icons that came with the SDK, but I'm going to exploit the Templarian Windows Phone Icon pack whenever I can in the future.

我的应用程序是如此简单,以至于我最终只使用了SDK附带的四个图标,但是将来我将尽可能利用Templarian Windows Phone图标包。

有趣的陷阱(实际上是陷阱) (Interesting Gotchas (actually Got-mes))

The first time I submitted the app it was rejected within two days. Turns out that when you popup a Popup - like for my Save Button - the hardware Back button must dismiss the popup. They are really serious about this model that you move forward and the hardware Back button always moves "back."

我第一次提交该应用程序后,两天内被拒绝。 原来,当您弹出一个弹出窗口时(例如我的“保存”按钮),硬件“后退”按钮必须关闭该弹出窗口。 他们对这种模型真的很认真,您会向前移动,而“后退”按钮始终会向后移动。

I ended up having to close my popup like this:

我最终不得不像这样关闭弹出窗口:

protected override void OnBackKeyPress(CancelEventArgs e){    if (theHelpPopup != null && theHelpPopup.IsOpen == true)    {        theHelpPopup.IsOpen = false;        e.Cancel = true;    }}

As I continue to explore Windows Phone Development I'm sure I'll find better (read: less hacky) ways to manage things like this. Frankly, I was surprised that the Popup class didn't handle this for me!

当我继续探索Windows Phone开发时,我确定我会找到更好的方法(阅读:hacky)来管理这样的事情。 坦白说,我很惊讶Popup类没有为我解决这个问题!

轻主题测试 (Test with Light Theme)

Another important thing is to test your app with a light theme. I initially had colors with hard-coded opacity like "CC00000000" for a transparent black. However, when your theme is white-based, rather than black, things start look like crap when you hard code colors. Instead they recommend that you use StaticResources with names that will automatically look correct, regardless of theme:

另一个重要的事情是用一个简单的主题来测试您的应用程序。 最初,我的颜色具有硬编码的不透明度,例如“ CC00000000”代表透明的黑色。 但是,当您的主题是基于白色而不是黑色的主题时,当您对颜色进行硬编码时,事情开始看起来像胡扯。 相反,他们建议您使用StaticResources并使用自动看起来正确的名称,而不管主题如何:

<Grid Height="448" Width="480" x:Name="LayoutRoot"    Background="{StaticResource PhoneBackgroundBrush}"    Opacity="0.8">...

Here I'm using PhoneBackgroundBrush, which means my help Popup looks nice twice!

在这里,我使用的是PhoneBackgroundBrush,这意味着我的帮助Popup看起来不错了两次!

However, notice that the black text at the top is hard to read? More on that later. A feature to help with that will be in the next version, which should be out later this week!

但是,请注意,顶部的黑色文字难以阅读吗? 以后再说。 下一个版本将提供帮助的功能,该功能应在本周晚些时候发布!

提交申请 (Submit the Application)

You log into http://create.msdn.com and go through a detailed but largely straightforward wizard. There's a long checklist but the one I spent the most time going over was the Application Artwork for Windows Phone section. You need two different icons for the phone, three different icons for the Marketplace and a panorama in case you are a Featured App. Remember earlier when I said it was less code and more PNGs? This is where the time was taken up; just making sure all the PNGs were perfect from a large source PNG.

您登录http://create.msdn.com并通过详细但基本直接的向导。 清单很长,但是我花费最多时间的清单是Windows Phone的Application Artwork部分。 您需要两个不同的电话图标,三个不同的市场图标以及一个全景图(如果您是精选应用程序)。 还记得我之前说的更少的代码和更多的PNG吗? 这是花费时间的地方; 只是要确保所有PNG在大型PNG中都是完美的。

After you submit, you wait. I waited 3 days, was rejected, fixed the Back Button issue and Submitted Again.

提交后,您等待。 我等了3天,被拒绝了,解决了“后退按钮”问题,然后再次提交。

Now I've found a few more bugs and will submit an update this week. The cycle will continue.

现在,我发现了一些其他错误,并将在本周提交更新。 该循环将继续。

注意细节 (Attention to Detail)

There's so many little things from misspellings to missed pixels that you need to be on the lookout for. For example, I misspelled "wallpaper" in a screenshot - seriously - because I was working late into the night. Sloppy. And now I'll have to wait almost a week to fix it due to the way the Marketplace works. As a web programmer this will take getting used to as I'm used to "hit refresh, it's fixed" when squashing bugs for my users

从拼写错误到像素丢失,需要注意的事情太多了。 例如,我在屏幕截图中拼写错误了“墙纸”-严重-因为我要工作到深夜。 马虎。 现在,由于Marketplace的工作方式,我将不得不等待近一周的时间来修复它。 作为一名网络程序员,在为用户压缩错误时,我会习惯于“按刷新,它已修复”

Triple check everything, test and test again. Every small mistake means 3 days lost waiting for the marketplace to update. And those days can mean days of unhappy users.

仔细检查所有内容,然后再次测试。 每个小错误都意味着三天的等待市场更新。 那些日子可能意味着用户不满的日子。

制作“营销”网站 (Make the "Marketing" Website)

Time to make myself a nice simple static website to promote my application. I could hire someone or try to make something myself, but I really just have some basic requirements.

是时候让自己成为一个不错的简单静态网站来推广我的应用程序。 我可以雇用一个人或尝试自己做点什么,但实际上我只是有一些基本要求。

  • The site should include screenshots 该网站应包括屏幕截图
  • The site should be mostly static html but feel slightly dynamic (javascript?) 该网站应该主要是静态html,但感觉有些动态(javascript?)
  • The site should work on a mobile device (even iPhones!) using responsive design.

    该网站应使用响应式设计在移动设备(甚至包括iPhone!)上运行。

  • The site should link to the Windows Phone Marketplace 该网站应链接到Windows Phone Marketplace

I didn't want to spend much time on this, but I also didn't want to do my app a disservice with a crappy site. There are lots of mobile templates out there, but a few stand out as they are Windows Phone 7 Specific.

我不想花很多时间在此上,但是我也不想因为一个糟糕的网站而使我的应用程序瘫痪。 有许多移动模板,但由于它们是Windows Phone 7专用的,因此脱颖而出。

One is Wp7JekyllTemplates, which works nice if you are hosting your code and site on GitHub. The other is Wp7AppSite by Nick Harewood. I noticed that Wp7AppSite used the Skeleton Boilerplate, which I am a fan of. I used it on http://speakinghacks.com.  It looks great on mobile so I was sold.

一个是Wp7JekyllTemplates ,如果您将代码和站点托管在GitHub上,则效果很好。 另一个是Nick Harewood的Wp7AppSite 。 我注意到Wp7AppSite使用了我喜欢的Skeleton Boilerplate。 我在http://speakinghacks.com上使用了它。 在手机上看起来很棒,所以我被卖了。

It was stupid-easy to setup. I just pointed my domain my my host, setup index.html as the default document, resized the screenshots, modified the HTML and uploaded. Took about 10 minutes.

设置起来很愚蠢。 我只是将主机指向我的域,将index.html设置为默认文档,调整了屏幕截图的大小,修改了HTML并上传了。 花了大约10分钟。

价钱 (Pricing)

I made it $0.99. I didn't want to make it free because I didn't want to make it free. It costs less than the foam on your latte and it will get nice updates for free. I find it funny that folks will research 99 cent apps for an hour while sipping a $5 latte. ;)

我赚了0.99美元。 我不想让它免费,因为我不想让它免费。 它的成本低于拿铁咖啡上的泡沫,并且将免费提供不错的更新。 我觉得很有趣,人们会在一个小时内研究99美分的应用程序,一边喝着5美元的拿铁咖啡。 ;)

I buy lots of $1 apps because THEY ARE $1 APPS.

我购买了很多$ 1的应用程序,因为它们是$ 1的应用程序。

查找错误 (Find a Bug)

Earlier I mentioned that some wallpapers make it so the text is hard to read depending on the theme. Tim Heuer reported this so I added a feature to invert the text color, as seen in the screenshot below:

早些时候,我提到过一些墙纸可以使文字变得难以阅读,具体取决于主题。 蒂姆·休尔(Tim Heuer)报告了此情况,因此我添加了一个功能来反转文本颜色,如以下屏幕截图所示:

Notice how the A at the bottom in the Application Bar inverts depending on the color of the text. I am very happy with how that turned out.

请注意,应用程序栏底部的A如何根据文本的颜色反转。 我对结果如何感到非常高兴。

提交更新 (Submit the Update)

I also removed the progress bar as it was getting in the way of the screenshot process and fixed a data persistence bug where your settings don't always get saved depending on how you exit the application. This is due to my confusion about how task switching vs. application existing works in Mango. That's fixed and will be out as as a free update soon as they certify it.

我还删除了进度条,因为它妨碍了屏幕截图过程,并修复了数据持久性错误,该错误不会始终根据您退出应用程序的方式保存您的设置。 这是由于我对Mango中的任务切换与应用程序现有的工作方式感到困惑。 这是固定的,一旦获得认证,便会作为免费更新发布。

I'll submit the 1.0.2 update this week that will include the smarter text coloring as seen in the screenshot above. Barring rejection, the Marketplace should notice you'll get the updates!

我将在本周提交1.0.2更新,其中将包括上面的屏幕截图所示的更聪明的文本颜色。 除非拒绝,否则Marketplace会注意到您将获得更新!

You can get Lost Phone Screen on the Windows Phone Marketplace and you can offer feedback and feature request on UserVoice. If you buy it, please review it on the marketplace from the About Screen.

您可以在Windows Phone Marketplace上获得“丢失的电话屏幕”,并且可以在UserVoice上提供反馈和功能请求。 如果您购买了它,请在“关于”屏幕上的市场上对其进行检查。

更新:评论 (UPDATE: Reviews)

Bad Reviews hurt, even for a silly little application like mine. I've already released the 1.0.2 update with bug fixes that address many major issues folks have had with the app. Here's what you should do to keep on top of feedback and reviews:

即使对于像我这样的愚蠢的小应用程序,不良评论也会带来伤害。 我已经发布了1.0.2更新,其中包含一些错误修复程序,这些错误修复程序解决了人们对该应用程序遇到的许多主要问题。 您应该采取以下措施来保持反馈和评论的基础:

  • Make sure you have a way to give feedback from the app directly (rather than via a review). My http://lostphonescreen.com site has a feedback tab that goes directly to User Voice. That's been great for new features.

    确保您有直接从应用程序提供反馈的方式(而不是通过评论)。 我的http://lostphonescreen.com网站上有一个“反馈”选项卡,直接转到“用户语音”。 这对于新功能非常有用。

  • Install the zTop Silverlight OOB application and pin your apps. You can view your app in Zune or the browser and see how you are doing. zTop links nicely to...

    安装zTop Silverlight OOB应用程序并固定您的应用程序。 您可以在Zune或浏览器中查看您的应用程序,然后查看运行情况。 zTop很好地链接到...

    • Tom Verhoeff's excellent "Windows Phone 7 App Reviews" application to view Reviews without having to log into the AppHub. You can even reach out to reviewers with Zune and let them know you've fixed their issue.

      Tom Verhoeff出色的“ Windows Phone 7应用程序评论”应用程序无需登录AppHub即可查看评论。 您甚至可以使用Zune与审阅者联系,并让他们知道您已解决他们的问题。

    Install the zTop Silverlight OOB application and pin your apps. You can view your app in Zune or the browser and see how you are doing. zTop links nicely to...

    安装zTop Silverlight OOB应用程序并固定您的应用程序。 您可以在Zune或浏览器中查看您的应用程序,然后查看运行情况。 zTop很好地链接到...

  • There is also Rudi Grobler's Windows Phone Dashboard which is especially polished and useful if you have many applications in the marketplace.

    还有Rudi Grobler的Windows Phone仪表板,如果您在市场上有许多应用程序,则它特别优美且实用。

I'll update this post with more info as I learn more. I haven't got download stats yet and I've only just released my first update.

当我了解更多信息时,我将用更多信息更新此帖子。 我还没有下载统计信息,我只发布了我的第一个更新。

结论 (Conclusion)

I was pleasantly surprised how easy it was to get into Windows Phone 7 programming. I was also thrilled with the amount of great open source libraries, creative commons art and other resources that are available for the beginner. The marketplace process and website are still a little confusing and rough, and I don't like waiting days to find out how my app is doing, but I guess that's life with a marketplace.

我很惊讶地发现进入Windows Phone 7编程是如此容易。 令我感到无比兴奋的是,初学者可以使用大量的开放源代码库,知识共享艺术和其他资源。 市场流程和网站仍然有些混乱和粗糙,我不希望等待几天来了解我的应用程序的运行情况,但是我想这就是市场的生命。

Big thanks to Jin Yang for the Icon and Bil Simser for Skyping with me.

非常感谢Jin Yang的图标和Bil Simser与我一起的Skyping。

I'll keep updating my little app and trying to think of ideas for my Next App.

我将继续更新我的小应用程序,并尝试为下一个应用程序考虑一些想法。

Enjoy!

请享用!

相关链接 (Related Links)

  • Bil Simser's The Big Dummies Guide for Windows Phone Developer Resources

    Bil Simser的Windows Phone开发人员资源大傻瓜指南

  • The initial stock photo wallpaper is by Thomas Pentenrieder. It's used under the Creative Commons License with Attribution. You can see more of Thomas' excellent Windows Phone 7 Wallpapers on Flickr at http://flic.kr/photos/pentenrieder.

    最初的图片墙纸由Thomas Pentenrieder创作。 它在具有署名的知识共享许可下使用。 您可以在http://flic.kr/photos/pentenrieder上的Flickr上查看Thomas的出色Windows Phone 7墙纸。

翻译自: https://www.hanselman.com/blog/from-concept-to-code-in-6-hours-shipping-my-first-windows-phone-app

从概念到代码在6个小时内:交付我的第一个Windows Phone应用相关推荐

  1. ML与math:机器学习与高等数学基础概念、代码实现、案例应用之详细攻略——基础篇

    ML与math:机器学习与高等数学基础概念.代码实现.案例应用之详细攻略--基础篇 目录 一.ML与高等数学 0.基础数学 1.导数.方向导数.梯度 1.1.概念简介 1.2.代码实现 2.Taylo ...

  2. 域 嵌入图像显示不出来_如何(以及为什么)将域概念嵌入代码中

    域 嵌入图像显示不出来 Code should clearly reflect the problem it's solving, and thus openly expose that proble ...

  3. 一文详解循环神经网络的基本概念(代码版)

    作者 | 李理 目前就职于环信,即时通讯云平台和全媒体智能客服平台,在环信从事智能客服和智能机器人相关工作,致力于用深度学习来提高智能机器人的性能. 写在前面 由于工作太忙,这个系列文章有一年多没有更 ...

  4. ML与math:机器学习与高等数学基础概念、代码实现、案例应用之详细攻略——进阶篇

    ML与math:机器学习与高等数学基础概念.代码实现.案例应用之详细攻略--进阶篇 目录 人工智能数学基础综合 人工智能数学基础之高等数学 1.哈夫曼编码Huffman Coding简介及代码实现 人 ...

  5. Python中最常用的 14 种数据可视化类型的概念与代码

    写在前面 收集数据后,需要对其进行解释和分析,以深入了解数据所蕴含的深意.而这个含义可以是关于模式.趋势或变量之间的关系. 数据解释是通过明确定义的方法审查数据的过程,数据解释有助于为数据赋予意义并得 ...

  6. 微软hackathon_Hackathon报告:30小时内您可以编写什么代码? 非常多!

    微软hackathon by Ajay NS 由Ajay NS Hackathon报告:30小时内您可以编写什么代码? 非常多! (Hackathon Report: What can you cod ...

  7. python 线程 (概念+示例代码)

    目录 1. 线程的概念 1.1 主线程 1.2 子线程 1.3 单线程与多线程基本示例代码 2. 线程的数量 3. 线程的参数 4. 守护线程 5. 并行和并发 5.1 多任务的概念 5.2 并发和并 ...

  8. 安卓应用开发期末与面试概念冲刺(概念与代码,from hitwh)

    安卓应用开发概念冲刺(概念与代码) 前三章 安卓整体体系结构(四个)以及其中包含什么 安卓将()和()分离? intent和Service的用处.ContentProvider用处 安卓四大核心组件 ...

  9. 我如何在20小时内为AWS ML专业课程做好准备并进行破解

    I am a great fan of how Tesla is executing the problem of gathering data from the fleet of cars to t ...

  10. 创建react应用程序_通过构建电影搜索应用程序在1小时内了解React

    创建react应用程序 If you've been meaning to learn React but are unsure of where to start, Scrimba's brand ...

最新文章

  1. 一道简单的面试题:竟然有90%的程序员不能把这个算法完全写正确。。。
  2. 用python绘制柱状图标题-使用Python绘制图表大全总结
  3. 这五种 Python 字符串连接方式,你都知道吗?
  4. 第09课:项目实战——让你的神经网络模型越来越深
  5. linux 清理内存的c函数,Linux C函数之内存配置函数
  6. idea 切换java11_Java 11就在这里,您准备好进行切换了吗?
  7. win10高分辨率下修改字体显示大小(不是缩放百分比)
  8. 英伟达 | 深度学习GPU最新情况
  9. 计算机 信息安全常识
  10. Android 网络评分机制
  11. Apex弹窗闪退报错问题解决方案清晰讲解(系统软件层面解决,已亲测可行)
  12. 万彩动画大师-零基础视频教程-笔记
  13. 链表排序总结(全)(C++)
  14. 21 皮克定理 姿势不对一直wa到死亡
  15. linux环境下载jadx
  16. Java入门基本数据类型(羊驼)
  17. 开发板浮点型运算能力测试
  18. Debian10安装wine及用wine安装微信、QQ与TIM
  19. 2021年河南高考--各高校在河南录取分数线预测(本科二批——理科)
  20. 记一次智能灯泡的破解

热门文章

  1. java中使用jxls导出excel,excel单元格换行,多sheet页导出
  2. 基于session推荐的论文阅读
  3. 冒险岛 mysql 添加账号密码_Win7系统玩冒险岛079单机版输入账号密码后出现error38怎么办...
  4. 《易经》里的28条法则与64个大智慧
  5. 能否用一种语言来培养编程思维以及养成世界观
  6. 红警地图编辑器的使用方法
  7. 酵素果冻在快手火了!三个品牌单品一周卖出5000万背后的秘密是什么?
  8. springboot配置redis(单节点)
  9. 应急响应-文件痕迹排查
  10. montypython买火柴_无聊图集(2017-04-01)