Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 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 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 / SettingPage.xaml
Created December 4, 2012 14:57
新增一個頁面,寬度設為346
<common:LayoutAwarePage
x:Name="pageRoot"
x:Class="App2.SettingPage"
DataContext="{Binding DefaultViewModel, RelativeSource={RelativeSource Self}}"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App2"
xmlns:common="using:App2.Common"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
@kw0006667
kw0006667 / SettingPage.xaml.cs
Created December 4, 2012 15:13
在剛新增的頁面裡,增加移入的動畫
const int ContentAnimationOffset = 100;
public SettingPage()
{
this.InitializeComponent();
FlyoutContent.Transitions = new Windows.UI.Xaml.Media.Animation.TransitionCollection();
FlyoutContent.Transitions.Add(new Windows.UI.Xaml.Media.Animation.EntranceThemeTransition()
{
FromHorizontalOffset = (SettingsPane.Edge == SettingsEdgeLocation.Right) ? ContentAnimationOffset : (ContentAnimationOffset * -1)
});
}
@kw0006667
kw0006667 / MainPage.xaml.cs
Created December 4, 2012 16:00
在主畫面,將原來的「首頁」改成「詳細設定」,並建立舉呼叫剛才自訂的子畫面
public MainPage()
{
this.InitializeComponent();
SettingsPane.GetForCurrentView().CommandsRequested += MainPage_CommandsRequested;
}
void MainPage_CommandsRequested(SettingsPane sender, SettingsPaneCommandsRequestedEventArgs args)
{
SettingsCommand urlCommand = new SettingsCommand("urlCommand", "詳細設定", onSettingsCommand);
args.Request.ApplicationCommands.Add(urlCommand);