using System;
using System.Collections.ObjectModel;
using System.ComponentModel;

namespace ModuleB
{
    public class ViewTesterVm : INotifyPropertyChanged
    {
        public event PropertyChangedEventHandler PropertyChanged;

        public ViewTesterVm()
        {
            ViewCodes = new ObservableCollection<int>();
        }
        protected void OnPropertyChanged(string name)
        {
            if(PropertyChanged!= null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(name));
            }
        }

        public object ActiveView
        {
            set
            {
                if(value!= null)
                {
                    var code = value.GetHashCode();
                    if (!ViewCodes.Contains(code))
                    {
                        ViewCodes.Add(code);
                    }
                }
                
            }
        }

        public ObservableCollection<int> ViewCodes { get; set; }

        public void Reset()
        {
            ViewCodes.Clear();
            ActiveView = null;

        }
    }
}