Hello Metro:Windows 8下首個App


Windows 8 CP發布了,網絡一片沸騰。我也來湊個熱鬧,做了個小應用,供大家分享。

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

1.Setup

Visual Studio 11 Beta安裝完畢,進入Splash界面:

2.Splash 

 

好吧,現在就開始創建首個Metro應用吧。先要選擇Metro Template:

3.Metro Template

哇噢,跳出一個License框!Agree,必須的!

4.Developer License

 

好吧,進入最熟悉的編碼界面。上硬菜了~

5.First C# Metro App

 

先睹為快,看看效果吧:

6.Xaml design (no license) .

又是這該死的license~ 搞定之后,預覽效果如下:

7.Design UI

 

運行之前,要配置app manifest,詳見下圖:

8.app manifest (UI)

9.app manifest (capabilities)

 

 

 

 

 

最終的運行效果如下:

10.Final screen snapshot

 

最后附上源碼,不用說了,這是大家最最喜歡的了~

附件: 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)




免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM