/// <summary>
        /// Initialises a new instance of the <see cref="SubClassDataTypeViewModel"/> class.
        /// </summary>
        /// <param name="xmlData">data from the file</param>
        public SubClassDataTypeViewModel(Subclass xmlData)
        {
            this.SubClassNumber     = xmlData.Type;
            this.subClassImageList  = new ObservableCollection <string>();
            this.VehicleNumbersList = new ObservableCollection <VehicleNumberTypeViewModel>();

            foreach (Image fileImage in xmlData.Images)
            {
                this.subClassImageList.Add(fileImage.Name);
            }

            foreach (Number unitNumber in xmlData.Numbers)
            {
                VehicleNumberTypeViewModel newNumber =
                    new VehicleNumberTypeViewModel(
                        unitNumber);

                this.VehicleNumbersList.Add(newNumber);
            }
        }
        /// ---------- ---------- ---------- ---------- ---------- ----------
        /// <name>addNewNumberToolStripMenuItem_Click</name>
        /// <date>30/09/12</date>
        /// <summary>
        ///   addCurrentNumber, append an new number to the m_numberList
        ///   It first checks to see if the number doesn't already exist.
        /// </summary>
        /// <param name="currentNumber">current number</param>
        /// <returns>success flag</returns>
        /// ---------- ---------- ---------- ---------- ---------- ----------
        public bool AddCurrentNumber(int currentNumber)
        {
            bool success = true;

            foreach (VehicleNumberTypeViewModel number in this.VehicleNumbersList)
            {
                if (number.VehicleNumber == currentNumber)
                {
                    success = false;
                    break;
                }
            }

            if (success)
            {
                VehicleNumberTypeViewModel localVehicleNumber = new VehicleNumberTypeViewModel(currentNumber);
                this.VehicleNumbersList.Add(localVehicleNumber);
                this.RaisePropertyChangedEvent("VehicleNumbersList");
                this.RaisePropertyChangedEvent("NumbersList");
            }

            return(success);
        }
 public void RemoveNumber(VehicleNumberTypeViewModel oldNumber)
 {
     this.VehicleNumbersList.Remove(oldNumber);
     this.RaisePropertyChangedEvent("VehicleNumberList");
     this.RaisePropertyChangedEvent("NumbersList");
 }
 public void AddNumber(VehicleNumberTypeViewModel newNumber)
 {
     this.VehicleNumbersList.Add(newNumber);
     this.RaisePropertyChangedEvent("VehicleNumberList");
     this.RaisePropertyChangedEvent("NumbersList");
 }