Windows 8 CP发布了,网络一片沸腾。我也来凑个热闹,做了个小应用,供大家分享。
首先Show一下Windows 8、IE10还有Visual Studio 11的安装界面:
Visual Studio 11 Beta安装完毕,进入Splash界面:
好吧,现在就开始创建首个Metro应用吧。先要选择Metro Template:
哇噢,跳出一个License框!Agree,必须的!
好吧,进入最熟悉的编码界面。上硬菜了~
先睹为快,看看效果吧:
又是这该死的license~ 搞定之后,预览效果如下:
运行之前,要配置app manifest,详见下图:
最终的运行效果如下:
最后附上源码,不用说了,这是大家最最喜欢的了~
附件: 332953612419.zip
另注:关于申请Licnese
如果电脑直接联网,不使用代理,可以直接点击弹出的对话框,在线获得Develper License。
如果电脑是通过代理联网,必须使用PowerShell脚本进行Developer Licnese 的申请,脚本代码如下:
Add-Type @"
namespace AcquireDeveloper
{
using System;
using System.Runtime.InteropServices;
internal static class NativeMethods
{
[DllImport("WSClient.dll", EntryPoint = "CheckDeveloperLicense", SetLastError = true)]
public static extern int CheckDeveloperLicense(out System.Runtime.InteropServices.ComTypes.FILETIME filetime);
[DllImport("WSClient.dll", EntryPoint = "AcquireDeveloperLicense", SetLastError = true)]
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());
}
}
}
"@
[AcquireDeveloper.Program]::Main($null)