|
using System;
using System.ComponentModel;
using System.Windows.Media;
using System.Device.Location;
using BikeInCity.Utils;
using System.Collections.ObjectModel;
using System.Windows.Data;
using System.Xml.Serialization;
using Microsoft.Phone.Controls.Maps.Platform;
namespace BikeInCity.Model
{
public class BikeStation : INotifyPropertyChanged
{
#region Private fields
private GeoCoordinate _location;
private int _free;
private int _freePlaces;
private bool _isSelected;
private int _walkDistance;
private int _id;
private string _address;
private int _total;
private ObservableCollection<BikeRoute> _routes;
#endregion
public ObservableCollection<BikeRoute> Routes
{
get
{
if (_routes == null)
{
_routes = new ObservableCollection<BikeRoute>();
}
return _routes;
}
set {
OnPropertyChanged("Routes");
_routes = value;
}
}
public bool IsSelected
{
get { return _isSelected; }
set {
_isSelected = value;
OnPropertyChanged("IsSelected");
}
}
public GeoCoordinate Location
{
get
{
return _location;
}
set
{
_location = value;
OnPropertyChanged("Location");
}
}
public String Address
{
get { return _address; }
set {
if (value != null)
{
string toTrim = " -";
string val = value;
if (value.Contains(toTrim))
{
val = value.TrimEnd(toTrim.ToCharArray());
}
val = val.ToLower();
if (_address != val)
{
OnPropertyChanged("Address");
}
_address = val;
}
}
}
public int Id
{
get { return _id; }
set { _id = value; }
}
public int Free
{
get { return _free; }
set { _free = value;
OnPropertyChanged("Free");
//OnPropertyChanged("PointColor");
OnPropertyChanged("FreePlaces");
}
}
public int Total
{
get { return _total; }
set {
_total = value;
OnPropertyChanged("FreePlaces");
}
}
public int WalkDistance
{
get { return _walkDistance; }
set {
_walkDistance = value;
}
}
public int FreePlaces
{
get { return _freePlaces; }
set {
_freePlaces = value;
OnPropertyChanged("FreePlaces");
}
}
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
public virtual void OnPropertyChanged(string propertyName)
{
PropertyChangedEventHandler handler = this.PropertyChanged;
if (handler != null)
{
var e = new PropertyChangedEventArgs(propertyName);
handler(this, e);
}
}
#endregion
}
}
|
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.