|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Windows.Media;
namespace ReputationLib
{
public class RepItem : INotifyPropertyChanged
{
#region INotifyPropertyChanged
public event PropertyChangedEventHandler PropertyChanged;
protected void OnPropertyChanged(string name)
{
PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null)
{
handler(this, new PropertyChangedEventArgs(name));
}
}
#endregion INotifyPropertyChanged
private const int MAX_CPID_LENGTH = 12;
private int m_value;
private int m_cpUserID;
private DateTime m_timeScraped;
private RepCategory m_category;
private int m_changeValue;
public int ChangeValue
{
get { return m_changeValue; }
set { m_changeValue = value; OnPropertyChanged("ChangeValue"); }
}
public int Value
{
get { return m_value; }
set { m_value = value; OnPropertyChanged("Value"); }
}
public DateTime TimeScraped
{
get { return m_timeScraped; }
set { m_timeScraped = value; OnPropertyChanged("TimeScraped"); }
}
public RepCategory Category
{
get { return m_category; }
set { m_category = value; OnPropertyChanged("Category"); }
}
public int CPUserID
{
get { return m_cpUserID; }
set { m_cpUserID = value; OnPropertyChanged("CPUserID"); }
}
/// <summary>
/// GET (only) the category's color for this rep item (only used in pie charts?)
/// </summary>
public SolidColorBrush CategoryColor
{
get { return Globals.CategoryColors[this.Category]; }
}
//--------------------------------------------------------------------------------
public RepItem()
{
Value = 0;
ChangeValue = 0;
TimeScraped = new DateTime(0);
Category = RepCategory.Unknown;
CPUserID = -1;
}
//--------------------------------------------------------------------------------
/// <summary>
/// Creates a new repItem object with this object's data member values
/// </summary>
/// <returns></returns>
public RepItem Clone()
{
RepItem item = new RepItem()
{
Category = this.Category,
CPUserID = this.CPUserID,
ChangeValue = this.ChangeValue,
TimeScraped = this.TimeScraped,
Value = this.Value
};
return item;
}
//--------------------------------------------------------------------------------
/// <summary>
/// Copies this options data to the specified object
/// </summary>
/// <param name="item"></param>
/// <returns></returns>
public RepItem Clone(RepItem item)
{
item.Category = this.Category;
item.CPUserID = this.CPUserID;
item.ChangeValue = this.ChangeValue;
item.TimeScraped = this.TimeScraped;
item.Value = this.Value;
return item;
}
}
}
|
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.
I've been paid as a programmer since 1982 with experience in Pascal, and C++ (both self-taught), and began writing Windows programs in 1991 using Visual C++ and MFC. In the 2nd half of 2007, I started writing C# Windows Forms and ASP.Net applications, and have since done WPF, Silverlight, WCF, web services, and Windows services.
My weakest point is that my moments of clarity are too brief to hold a meaningful conversation that requires more than 30 seconds to complete. Thankfully, grunts of agreement are all that is required to conduct most discussions without committing to any particular belief system.