Hello Metro:Windows 8下首个App
Windows 8 CP发布了,网络一片沸腾。我也来凑个热闹,做了个小应用,供大家分享。首先Show一下Windows 8、IE10还有Visual Studio 11的安装界面:
http://images.cnblogs.com/cnblogs_com/powertoolsteam/201203/201203060947377959.png
Visual Studio 11 Beta安装完毕,进入Splash界面:
http://images.cnblogs.com/cnblogs_com/powertoolsteam/201203/201203060947402613.png
好吧,现在就开始创建首个Metro应用吧。先要选择Metro Template:
http://images.cnblogs.com/cnblogs_com/powertoolsteam/201203/201203060947438694.png
哇噢,跳出一个License框!Agree,必须的!
http://images.cnblogs.com/cnblogs_com/powertoolsteam/201203/201203060947466478.png
好吧,进入最熟悉的编码界面。上硬菜了~
http://images.cnblogs.com/cnblogs_com/powertoolsteam/201203/201203060947517379.png
先睹为快,看看效果吧:
http://images.cnblogs.com/cnblogs_com/powertoolsteam/201203/201203060947549491.png .
又是这该死的license~ 搞定之后,预览效果如下:
http://images.cnblogs.com/cnblogs_com/powertoolsteam/201203/201203060947587666.png
运行之前,要配置app manifest,详见下图:
http://images.cnblogs.com/cnblogs_com/powertoolsteam/201203/201203060948014337.png
http://images.cnblogs.com/cnblogs_com/powertoolsteam/201203/201203060948075935.png
最终的运行效果如下:
http://images.cnblogs.com/cnblogs_com/powertoolsteam/201203/201203060948095181.png
最后附上源码,不用说了,这是大家最最喜欢的了~
http://gcdn.grapecity.com/images/attachicons/rar.gif附件: 332953612419.zip
另注:关于申请Licnese
如果电脑直接联网,不使用代理,可以直接点击弹出的对话框,在线获得Develper License。
如果电脑是通过代理联网,必须使用PowerShell脚本进行Developer Licnese 的申请,脚本代码如下:
Add-Type @"
namespace AcquireDeveloper
{
using System;
using System.Runtime.InteropServices;
internal static class NativeMethods
{
public static extern int CheckDeveloperLicense(out System.Runtime.InteropServices.ComTypes.FILETIME filetime);
public static extern DateTime AcquireDeveloperLicense(ref string machine);
}
public class Program
{
public static void Main(string[] args)
{
string machine = ".";
DateTime dt = NativeMethods.AcquireDeveloperLicense(ref machine);
Console.WriteLine("AcquireDeveloperLicense machine {0}, filetime is {1}", machine, dt.ToString());
System.Runtime.InteropServices.ComTypes.FILETIME ft;
int iRet = NativeMethods.CheckDeveloperLicense(out ft);
long hFT2 = (((long)ft.dwHighDateTime) << 32) + ft.dwLowDateTime;
DateTime dtExpiry = DateTime.FromFileTime(hFT2);
Console.WriteLine("CheckDeveloperLicense returned {0}, filetime is {1}", iRet, dtExpiry.ToString());
}
}
}
"@
::Main($null)
页:
[1]