123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327 |
- /*
- * Copyright © 2011-2012 Nokia Corporation. All rights reserved.
- * Nokia and Nokia Connecting People are registered trademarks of Nokia Corporation.
- * Other product and company names mentioned herein may be trademarks
- * or trade names of their respective owners.
- * See LICENSE.TXT for license information.
- */
- using System;
- using System.Collections.Generic;
- using System.Collections.ObjectModel;
- using System.ComponentModel;
- using System.Device.Location;
- namespace wprestaurantapp
- {
- /// <summary>
- /// Model class for restaurant data
- /// </summary>
- public class RestaurantData : INotifyPropertyChanged
- {
- /// <summary>
- /// Constructor
- /// </summary>
- public RestaurantData()
- {
- }
- /// <summary>
- /// Member variable for Name property
- /// </summary>
- private string _name;
- /// <summary>
- /// Property for name of the restaurant
- /// </summary>
- public string Name
- {
- get
- {
- return _name;
- }
- set
- {
- if (_name != value)
- {
- _name = value;
- NotifyPropertyChanged("Name");
- }
- }
- }
- /// <summary>
- /// Member variable for LogoURI property
- /// </summary>
- private string _logoURI;
- /// <summary>
- /// Property for URI to the restaurant logo
- /// </summary>
- public string LogoURI
- {
- get
- {
- return _logoURI;
- }
- set
- {
- if (_logoURI != value)
- {
- _logoURI = value;
- NotifyPropertyChanged("LogoURI");
- }
- }
- }
- /// <summary>
- /// Member variable for StreetAddress property
- /// </summary>
- private string _streetAddress;
- /// <summary>
- /// Property for street address of the restaurant
- /// </summary>
- public string StreetAddress
- {
- get
- {
- return _streetAddress;
- }
- set
- {
- if (_streetAddress != value)
- {
- _streetAddress = value;
- NotifyPropertyChanged("StreetAddress");
- }
- }
- }
- /// <summary>
- /// Member variable for City property
- /// </summary>
- private string _city;
- /// <summary>
- /// Property for city of the restaurant
- /// </summary>
- public string City
- {
- get
- {
- return _city;
- }
- set
- {
- if (_city != value)
- {
- _city = value;
- NotifyPropertyChanged("City");
- }
- }
- }
- /// <summary>
- /// Member variable for Country property
- /// </summary>
- private string _country;
- /// <summary>
- /// Property for country of the restaurant
- /// </summary>
- public string Country
- {
- get
- {
- return _country;
- }
- set
- {
- if (_country != value)
- {
- _country = value;
- NotifyPropertyChanged("Country");
- }
- }
- }
- /// <summary>
- /// Member variable for Location property
- /// </summary>
- private GeoCoordinate _location;
- /// <summary>
- /// Property for location of the restaurant
- /// </summary>
- public GeoCoordinate Location
- {
- get
- {
- if (_location == null)
- {
- // Set a default value other than NaN to location, Silverlight map control
- // wouldn't like it
- _location = new GeoCoordinate( 0.0, 0.0 );
- }
- return _location;
- }
- set
- {
- if (_location != value)
- {
- _location = value;
- NotifyPropertyChanged("Location");
- }
- }
- }
- /// <summary>
- /// Member variable for Telephone property
- /// </summary>
- private string _telephone;
- /// <summary>
- /// Property for telephone number of the restaurant
- /// </summary>
- public string Telephone
- {
- get
- {
- return _telephone;
- }
- set
- {
- if (_telephone != value)
- {
- _telephone = value;
- NotifyPropertyChanged("Telephone");
- }
- }
- }
- /// <summary>
- /// Member variable for URL property
- /// </summary>
- private string _url;
- /// <summary>
- /// Property for the website of the restaurant
- /// </summary>
- public string URL
- {
- get
- {
- return _url;
- }
- set
- {
- if (_url != value)
- {
- _url = value;
- NotifyPropertyChanged("URL");
- }
- }
- }
- /// <summary>
- /// Member variable for Description property
- /// </summary>
- private string _description;
- /// <summary>
- /// Property for description text of the restaurant
- /// </summary>
- public string Description
- {
- get
- {
- return _description;
- }
- set
- {
- if (_description != value)
- {
- _description = value;
- NotifyPropertyChanged("Description");
- }
- }
- }
- /// <summary>
- /// Member variable for Categories property
- /// </summary>
- private List<Category> _categories;
- /// <summary>
- /// Property for different categories of the restaurant
- /// </summary>
- public List<Category> Categories
- {
- get
- {
- if (_categories == null)
- {
- _categories = new List<Category>();
- }
- return _categories;
- }
- set
- {
- if (_categories != value)
- {
- _categories = value;
- NotifyPropertyChanged("Categories");
- }
- }
- }
- /// <summary>
- /// Member variable for Reservations property
- /// </summary>
- private ObservableCollection<Reservation> _reservations;
- /// <summary>
- /// Property for existing reservations of the restaurant
- /// </summary>
- public ObservableCollection<Reservation> Reservations
- {
- get
- {
- if (_reservations == null)
- {
- _reservations = new ObservableCollection<Reservation>();
- }
- return _reservations;
- }
- set
- {
- if (_reservations != value)
- {
- _reservations = value;
- NotifyPropertyChanged("Reservations");
- }
- }
- }
- /// <summary>
- /// Implementation of PropertyChanged event of INotifyPropertyChanged
- /// </summary>
- public event PropertyChangedEventHandler PropertyChanged;
- /// <summary>
- /// Helper method for emitting PropertyChanged event
- /// </summary>
- /// <param name="propertyName">Name of the property that has changed</param>
- private void NotifyPropertyChanged(String propertyName)
- {
- PropertyChangedEventHandler handler = PropertyChanged;
- if (null != handler)
- {
- handler(this, new PropertyChangedEventArgs(propertyName));
- }
- }
- }
- }
|