﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Text.RegularExpressions;
using System.Timers;

namespace AutobotManager
{
    public class BotStatusItem : INotifyPropertyChanged
    {
        public BotStatusItem(String a_sStatus, int a_iVal)
        {
            m_sStatus = a_sStatus;
            m_iCount = a_iVal;
        }

        public event PropertyChangedEventHandler PropertyChanged;

        // This method is called by the Set accessor of each property.
        // The CallerMemberName attribute that is applied to the optional propertyName
        // parameter causes the property name of the caller to be substituted as an argument.
        private void NotifyPropertyChanged(String propertyName = "")
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #region Methods
        public void Increment() { ++CurrentCount; }
        public void Decrement() { --CurrentCount; }
        public void ResetCount() { CurrentCount = 0; }
        #endregion

        #region Data
        private String m_sStatus;
        private int m_iCount;

        [DisplayName("Status")]
        [ReadOnly(true)]
        public String Status 
        { 
            get { return this.m_sStatus; } 
            set 
            { 
                if (value != this.m_sStatus) { this.m_sStatus = value; NotifyPropertyChanged("m_sStatus"); } 
            } 
        }

        [DisplayName("Count")]
        [ReadOnly(true)]
        public int CurrentCount 
        { 
            get { return this.m_iCount; } 
            set 
            { 
                if (value != this.m_iCount) { this.m_iCount = value; NotifyPropertyChanged("m_iCount"); } 
            } 
        }

        #endregion // Data

    }


}
