示例#1
0
        /// <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);
            }
        }
示例#2
0
        /// ---------- ---------- ---------- ---------- ---------- ----------
        /// <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);
        }
示例#3
0
 public void RemoveNumber(VehicleNumberTypeViewModel oldNumber)
 {
     this.VehicleNumbersList.Remove(oldNumber);
     this.RaisePropertyChangedEvent("VehicleNumberList");
     this.RaisePropertyChangedEvent("NumbersList");
 }
示例#4
0
 public void AddNumber(VehicleNumberTypeViewModel newNumber)
 {
     this.VehicleNumbersList.Add(newNumber);
     this.RaisePropertyChangedEvent("VehicleNumberList");
     this.RaisePropertyChangedEvent("NumbersList");
 }