Skip to content

Instantly share code, notes, and snippets.

@kw0006667
kw0006667 / MainPage.xaml.cs
Created December 4, 2012 09:27
在設定中增加兩個命令功能「首頁」和「Bing」,都是以瀏覽器開啟一個新網頁
void MainPage_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
{
SettingsCommand urlCommand = new SettingsCommand("urlCommand", "首頁", onSettingsCommand);
args.Request.ApplicationCommands.Add(urlCommand);
SettingsCommand urlCommand_2 = new SettingsCommand("urlCommand_2", "Bing", onSettingsCommand);
args.Request.ApplicationCommands.Add(urlCommand_2);
}
void onSettingsCommand(IUICommand command)
@kw0006667
kw0006667 / MainPage.xaml.cs
Created December 4, 2012 09:11
在程式碼中,加入「SettingsPane」的「CommandsRequested」事件註冊
public MainPage()
{
this.InitializeComponent();
SettingsPane.GetForCurrentView().CommandsRequested += MainPage_CommandsRequested;
}
void MainPage_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
{
}
@kw0006667
kw0006667 / MainPage.xaml.cs
Created December 3, 2012 18:03
在主頁面進行「搜尋」的動作
internal void OnQuerySubmitted(SearchPane sender, SearchPaneQuerySubmittedEventArgs args)
{
this.SearchInput.Text = args.QueryText;
}
@kw0006667
kw0006667 / MainPage.xaml.cs
Created December 3, 2012 17:51
在主頁面的「OnNavigatedTo 函式中,接收從 App.xaml.cs 傳進來的字串
/// <summary>
/// 在此頁面即將顯示在框架中時叫用。
/// </summary>
/// <param name="e">描述如何到達此頁面的事件資料。Parameter
/// 屬性通常用來設定頁面。</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
this.SearchInput.Text = e.Parameter.ToString();
}
@kw0006667
kw0006667 / App.xaml.cs
Created December 3, 2012 17:48
接受「搜尋」的字串
protected override void OnSearchActivated(SearchActivatedEventArgs args)
{
base.OnSearchActivated(args);
Frame rootFrame = new Frame();
rootFrame.Navigate(typeof(MainPage), args.QueryText);
Window.Current.Content = rootFrame;
Window.Current.Activate();
}
@kw0006667
kw0006667 / App.xaml
Created December 2, 2012 13:53
修改主題為「Light」
<Application
x:Class="App2.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App2"
RequestedTheme="Light">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
@kw0006667
kw0006667 / sample6.cpp 2
Created November 18, 2012 16:29
sample6.cpp 2
for (int i = 0; i < NUM_TARGET; i++)
{
tempHead=head;
while(tempHead != NULL )//刪頭
{
if (tempHead->fby > 40 || enemy[i].Hitting(tempHead->fbx, tempHead->fby))
{
if(tempHead->next){
tempHead->next->prior = tempHead->prior;
}
@kw0006667
kw0006667 / sample6.cpp
Created November 18, 2012 15:10
Linked-List
while(tempHead != NULL )//刪頭
{
if (tempHead->fby > 40 || enemy[i].Hitting(tempHead->fbx, tempHead->fby))
{
if(tempHead->next){
tempHead->next->prior = tempHead->prior;
}
else
{
tail = tempHead;
@kw0006667
kw0006667 / MainPage.xaml.cs
Created October 30, 2012 09:09
修改 Data 屬性名稱
namespace DataSource
{
/// <summary>
/// 可以在本身使用或巡覽至框架內的空白頁面。
/// </summary>
public sealed partial class MainPage : Page
{
private List<Data> myDatas;
public MainPage()
{
@kw0006667
kw0006667 / MainPage.xaml
Created October 30, 2012 09:07
新增樣版資源到 MainPage.xaml 並修改、使用它
<Page
x:Class="DataSource.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:DataSource"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Page.Resources>