Esempio n. 1
0
        public void AddPart(Part part)
        {
            // Remove part of the same type, if already exists
            if (this.Any(x => x.GetType() == part.GetType()))
            {
                RemovePart(this[part.GetType()]);
            }

            Parts.Add(PartDeepCloner.DeepClone(part));
            Price      += part.Price;
            Count       = Parts.Count;
            ID          = GetHashCode();
            SavedToFile = false;

            OnConfigurationChanged(new ConfigurationChangeEventArgs(part, true));
        }
Esempio n. 2
0
        public Computer(params Part[] parts)
        {
            Parts = new List <Part>(parts.Length);
            foreach (var part in parts)
            {
                Parts.Add(PartDeepCloner.DeepClone(part));
            }
            Count = Parts.Count;
            foreach (var part in Parts)
            {
                Price += part.Price;
            }
            ID          = GetHashCode();
            SavedToFile = false;

            OnConfigurationChanged(new ConfigurationChangeEventArgs(true, false));
        }