Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version
Go to top

My First Windows 8 Application – Metro Puzzle

, 7 Apr 2012
My first Windows 8 application, Metro Puzzle.
PuzzleMetro.zip
PuzzleMetro
bin
Debug
Images
PuzzleMetro.build.appxrecipe
resources.pri
Release
Converters
Images
Help
1.png
2.png
3.png
Logo.png
SmallLogo.png
SplashScreen.png
StoreLogo.png
WideLogo.png
Winner.png
obj
Debug
puzzlemetro
TempPE
Package.appxmanifest
Properties
PuzzleMetro_TemporaryKey.pfx
PuzzleMetro_-_Consumer_Preview.zip
PuzzleMetro.v11.suo
Assets
Logo.png
SmallLogo.png
SplashScreen.png
StoreLogo.png
ARM
Debug
Release
AppX
Assets
Logo.png
SmallLogo.png
SplashScreen.png
StoreLogo.png
Common
Images
Help
1.png
2.png
3.png
Logo.png
SmallLogo.png
SplashScreen.png
StoreLogo.png
WideLogo.png
Winner.png
microsoft.system.package.metadata
S-1-5-21-2796664923-3921637894-3850728130-1001.pckgdep
PuzzleMetro.exe
PuzzleMetro.pdb
resources.pri
vs.appxrecipe
Assets
Common
Help
x64
Debug
Release
x86
Debug
Release
Common
1.png
2.png
3.png
Logo.png
SmallLogo.png
SplashScreen.png
StoreLogo.png
WideLogo.png
Winner.png
Common
DesignTimeResolveAssemblyReferencesInput.cache
intermediatexaml
PuzzleMetro.exe
PuzzleMetro.pdb
LanguageQualifiers.txt.intermediate
Package.appxmanifest
PuzzleMetro.csproj.user
PuzzleMetro_TemporaryKey.pfx
<Page x:ConnectionId='1'
    x:Class="PuzzleMetro.BlankPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="using:PuzzleMetro"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="1366"                                                                        >

    <Grid x:Name="LayoutRoot"  Background="White">
        <Grid.RowDefinitions>
            <RowDefinition Height="98"/>
            <RowDefinition Height="21*"/>
            <RowDefinition Height="100*"/>
            <RowDefinition Height="15"/>
            <RowDefinition Height="100*"/>
            <RowDefinition Height="16"/>
            <RowDefinition Height="100*"/>
            <RowDefinition Height="18"/>
            <RowDefinition Height="100*"/>
            <RowDefinition Height="195"/>

        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="30"/>
            <ColumnDefinition Width="100*"/>
            <ColumnDefinition Width="22"/>
            <ColumnDefinition Width="100*"/>
            <ColumnDefinition Width="18"/>
            <ColumnDefinition Width="100*"/>
            <ColumnDefinition Width="20"/>
            <ColumnDefinition Width="102*"/>
            <ColumnDefinition Width="875*"/>
        </Grid.ColumnDefinitions>
        <!--ContentPanel - place additional content here-->
        <Canvas x:Name="ContentPanel" Grid.ColumnSpan="9" Grid.RowSpan="10">
            <Border Style="{StaticResource BorderStyle}" Canvas.Left="390" Canvas.Top="474"  />
            <Border Style="{StaticResource BorderStyle}" Canvas.Left="270" Canvas.Top="474" >
                <TextBlock Text="15" Tag="15" Style="{StaticResource NumberStyle}" />
            </Border>
            <Border Style="{StaticResource BorderStyle}" Canvas.Left="150" Canvas.Top="473" >
                <TextBlock Text="14" Tag="14" Style="{StaticResource NumberStyle}" />
            </Border>
            <Border Style="{StaticResource BorderStyle}" Canvas.Left="30" Canvas.Top="474" >
                <TextBlock Text="13" Tag="13" Style="{StaticResource NumberStyle}" />
            </Border>
            <Border Style="{StaticResource BorderStyle}" Canvas.Left="390" Canvas.Top="356" >
                <TextBlock Text="12" Tag="12" Style="{StaticResource NumberStyle}" />
            </Border>
            <Border Style="{StaticResource BorderStyle}" Canvas.Left="270" Canvas.Top="356" >
                <TextBlock Text="11" Tag="11" Style="{StaticResource NumberStyle}" />
            </Border>
            <Border Style="{StaticResource BorderStyle}" Canvas.Left="150" Canvas.Top="356">
                <TextBlock Text="10" Tag="10" Style="{StaticResource NumberStyle}" />
            </Border>
            <Border Style="{StaticResource BorderStyle}" Canvas.Left="30" Canvas.Top="356">
                <TextBlock Text="9" Tag="9" Style="{StaticResource NumberStyle}" />
            </Border>
            <Border Style="{StaticResource BorderStyle}" Canvas.Left="390" Canvas.Top="238" >
                <TextBlock Text="8" Tag="8" Style="{StaticResource NumberStyle}" />
            </Border>
            <Border Style="{StaticResource BorderStyle}" Canvas.Left="270" Canvas.Top="238" >
                <TextBlock Text="7" Tag="7" Style="{StaticResource NumberStyle}" />
            </Border>
            <Border Style="{StaticResource BorderStyle}" Canvas.Left="150" Canvas.Top="238"  >
                <TextBlock Text="6" Tag="6" Style="{StaticResource NumberStyle}" />
            </Border>
            <Border Style="{StaticResource BorderStyle}" Canvas.Left="30" Canvas.Top="238" >
                <TextBlock Text="5" Tag="5" Style="{StaticResource NumberStyle}" />
            </Border>
            <Border Style="{StaticResource BorderStyle}" Canvas.Left="390" Canvas.Top="120" >
                <TextBlock Text="4" Tag="4" Style="{StaticResource NumberStyle}" />
            </Border>

            <Border Style="{StaticResource BorderStyle}" Canvas.Left="270" Canvas.Top="120" >
                <TextBlock Text="3" Tag="3" Style="{StaticResource NumberStyle}" />
            </Border>
            <Border Style="{StaticResource BorderStyle}" Canvas.Left="150" Canvas.Top="120" >
                <TextBlock Text="2" Tag="2" Style="{StaticResource NumberStyle}" />
            </Border>
            <Border Style="{StaticResource BorderStyle}" Canvas.Left="30" Canvas.Top="120" >
                <TextBlock Text="1" Tag="1" Style="{StaticResource NumberStyle}" />
            </Border>

            <TextBlock Canvas.Left="273" Style="{StaticResource H3Style}" Text="Moves:" Canvas.Top="62" Margin="0" />
            <TextBlock Canvas.Left="352" x:Name="txtMoves" Text="0" Canvas.Top="62" Style="{StaticResource H2Style}"/>
            <TextBlock Canvas.Left="33"  Text="Time:"   Style="{StaticResource H3Style}" Canvas.Top="62" Margin="0"/>
            <TextBlock Canvas.Left="94" x:Name="txtTime" Text="00:00:00" Style="{StaticResource H2Style}" Canvas.Top="62"/>
            <TextBlock  Style="{StaticResource H1Style}" Text="{StaticResource AppName}" Height="51" Margin="0" Canvas.Left="8" Canvas.Top="8" />

            <TextBlock Height="488" Canvas.Left="614" TextWrapping="Wrap" Text="The 15-puzzle (also called Gem Puzzle, Boss Puzzle, Game of Fifteen, Mystic Square and many others) is a sliding puzzle that consists of a frame of numbered square tiles in random order with one tile missing. The puzzle also exists in other sizes, particularly the smaller 8-puzzle. If the size is 3×3 tiles, the puzzle is called the 8-puzzle or 9-puzzle, and if 4×4 tiles, the puzzle is called the 15-puzzle or 16-puzzle named, respectively, for the number of tiles and the number of spaces. The object of the puzzle is to place the tiles in order (see diagram) by making sliding moves that use the empty space." Canvas.Top="120" Width="609" FontSize="18" Style="{StaticResource TextStyle}" LineHeight="36"/>
            <TextBlock Canvas.Left="614" TextWrapping="Wrap" Text="What is Puzzle 15?" Canvas.Top="62" Style="{StaticResource H3Style}"/>
        </Canvas>

        <Grid Grid.ColumnSpan="9" Grid.RowSpan="10" x:Name="WinGrid" Visibility="Collapsed"  Background="#BFE6E6E6">
            <TextBlock HorizontalAlignment="Center" Text="Congratulations You Won!!!" Margin="8,92,8,568" FontSize="72" FontWeight="Bold" />
            <Button x:ConnectionId='4' x:Name="btnGame"                       Content="Again" Margin="304,366,0,286" Height="116" Width="258" FontSize="24" />
            <Button x:ConnectionId='5' x:Name="btnShare"                        Content="Share Your Win" Margin="850,366,0,286" Height="116" Width="258" FontSize="24" />
        </Grid>
        <AppBar Grid.ColumnSpan="9" Height="88" Grid.Row="9" VerticalAlignment="Bottom">
            <StackPanel Orientation="Horizontal">
                <Button x:ConnectionId='2' Content="Exit" Style="{StaticResource BackButtonStyle}" x:Name="btnBack"                       />
                <Button x:ConnectionId='3' Content="New Game" Style="{StaticResource RefreshButtonStyle}" x:Name="btnnewGame"                         />
            </StackPanel>
        </AppBar>
    </Grid>
</Page>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Microsoft Public License (Ms-PL)

Share

About the Author

Shai Raiten
Architect Sela
Israel Israel
Shai Raiten is VS ALM MVP, currently working for Sela Group as a ALM senior consultant and trainer specializes in Microsoft technologies especially Team System and .NET technology. He is currently consulting in various enterprises in Israel, planning and analysis Load and performance problems using Team System, building Team System customizations and adjusts ALM processes for enterprises. Shai is known as one of the top Team System experts in Israel. He conducts lectures and workshops for developers\QA and enterprises who want to specialize in Team System.
 
My Blog: http://blogs.microsoft.co.il/blogs/shair/
Follow on   Twitter

| Advertise | Privacy | Mobile
Web01 | 2.8.140916.1 | Last Updated 7 Apr 2012
Article Copyright 2011 by Shai Raiten
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid