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

My First Windows 8 Application – Metro Puzzle

, 7 Apr 2012 Ms-PL
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
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Windows.UI.Xaml.Data;

namespace PuzzleMetro.Common
{
    /// <summary>
    /// Implementation of <see cref="INotifyPropertyChanged"/> to simplify models.
    /// </summary>
    [Windows.Foundation.Metadata.WebHostHidden]
    public abstract class BindableBase : INotifyPropertyChanged
    {
        /// <summary>
        /// Multicast event for property change notifications.
        /// </summary>
        public event PropertyChangedEventHandler PropertyChanged;

        /// <summary>
        /// Checks if a property already matches a desired value.  Sets the property and
        /// notifies listeners only when necessary.
        /// </summary>
        /// <typeparam name="T">Type of the property.</typeparam>
        /// <param name="storage">Reference to a property with both getter and setter.</param>
        /// <param name="value">Desired value for the property.</param>
        /// <param name="propertyName">Name of the property used to notify listeners.  This
        /// value is optional and can be provided automatically when invoked from compilers that
        /// support CallerMemberName.</param>
        /// <returns>True if the value was changed, false if the existing value matched the
        /// desired value.</returns>
        protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] String propertyName = null)
        {
            if (object.Equals(storage, value)) return false;

            storage = value;
            this.OnPropertyChanged(propertyName);
            return true;
        }

        /// <summary>
        /// Notifies listeners that a property value has changed.
        /// </summary>
        /// <param name="propertyName">Name of the property used to notify listeners.  This
        /// value is optional and can be provided automatically when invoked from compilers
        /// that support <see cref="CallerMemberNameAttribute"/>.</param>
        protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
        {
            var eventHandler = this.PropertyChanged;
            if (eventHandler != null)
            {
                eventHandler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}

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.141015.1 | Last Updated 7 Apr 2012
Article Copyright 2011 by Shai Raiten
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid