且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Hello Metro:Windows 8下首个App

更新时间:2022-08-12 14:00:53

Windows 8 CP发布了,网络一片沸腾。我也来凑个热闹,做了个小应用,供大家分享。

首先Show一下Windows 8、IE10还有Visual Studio 11的安装界面:

Hello Metro:Windows 8下首个App

Visual Studio 11 Beta安装完毕,进入Splash界面:

Hello Metro:Windows 8下首个App 

 

好吧,现在就开始创建首个Metro应用吧。先要选择Metro Template:

Hello Metro:Windows 8下首个App

哇噢,跳出一个License框!Agree,必须的!

Hello Metro:Windows 8下首个App

 

好吧,进入最熟悉的编码界面。上硬菜了~

Hello Metro:Windows 8下首个App

 

先睹为快,看看效果吧:

Hello Metro:Windows 8下首个App .

又是这该死的license~ 搞定之后,预览效果如下:

Hello Metro:Windows 8下首个App

 

运行之前,要配置app manifest,详见下图:

Hello Metro:Windows 8下首个App

Hello Metro:Windows 8下首个App

 

 

 

 

 

最终的运行效果如下:

Hello Metro:Windows 8下首个App

 

最后附上源码,不用说了,这是大家最最喜欢的了~

Hello Metro:Windows 8下首个App附件: 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)