Skip to content

Instantly share code, notes, and snippets.

@kw0006667
kw0006667 / Program.cs
Created October 23, 2012 19:11
將10個學生的成績由高到底排序
namespace ListConsoleApp
{
public class Student
{
public string Name;
public int Score;
public Student(string name, int score)
{
this.Name = name;
this.Score = score;
@kw0006667
kw0006667 / gist:3940992
Created October 23, 2012 19:19
從10個學生中取出成績不及格的
var query = from stu in students
where stu.Score < 60
select stu;
@kw0006667
kw0006667 / Program.cs
Created October 23, 2012 19:52
從10個學生中取出成績和排序,並取出不及格的學生
namespace ListConsoleApp
{
public class Student
{
public string Name;
public int Score;
public Student(string name, int score)
{
this.Name = name;
this.Score = score;
@kw0006667
kw0006667 / MainPage.xaml
Created October 30, 2012 08:13
新增 ListView 物件到頁面中
<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">
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
@kw0006667
kw0006667 / MainPage.xaml.cs
Created October 30, 2012 08:45
定義 資料結構,並加到 myListViewItem 的 DataSrouce 中
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
@kw0006667
kw0006667 / MainPage.xaml
Created October 30, 2012 08:53
指定 Item 樣版資源
<ListView x:Name="MyListViewitems" ItemTemplate="{StaticResource Standard250x250ItemTemplate}">
</ListView>
@kw0006667
kw0006667 / StandardStyles.xaml
Created October 30, 2012 08:57
樣版資源(部分)
<!-- 適合格線的 250 像素方形項目範本,如 GroupedItemsPage 和 ItemsPage 中所見 -->
<DataTemplate x:Key="Standard250x250ItemTemplate">
<Grid HorizontalAlignment="Left" Width="250" Height="250">
<Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}">
<Image Source="{Binding Image}" Stretch="UniformToFill" AutomationProperties.Name="{Binding Title}"/>
</Border>
<StackPanel VerticalAlignment="Bottom" Background="{StaticResource ListViewItemOverlayBackgroundThemeBrush}">
<TextBlock Text="{Binding Title}" Foreground="{StaticResource ListViewItemOverlayForegroundThemeBrush}" Style="{StaticResource TitleTextStyle}" Height="60" Margin="15,0,15,0"/>
<TextBlock Text="{Binding Subtitle}" Foreground="{StaticResource ListViewItemOverlaySecondaryForegroundThemeBrush}" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap" Margin="15,0,15,10"/>
</StackPanel>
@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>
@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 / 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;