Ejemplo n.º 1
0
        /// <summary>
        /// Assigns every property from another instance
        /// </summary>
        /// <param name="from">Object to assign from</param>
        /// <exception cref="ArgumentNullException">other is null</exception>
        /// <exception cref="ArgumentException">Types do not match</exception>
        public void Assign(object from)
        {
            if (from == null)
            {
                throw new ArgumentNullException();
            }
            if (!(from is MachineModel other))
            {
                throw new ArgumentException("Invalid type");
            }

            Channels.Assign(other.Channels);
            Electronics.Assign(other.Electronics);
            ListHelpers.AssignList(Fans, other.Fans);
            Heat.Assign(other.Heat);
            Job.Assign(other.Job);
            MessageBox.Assign(other.MessageBox);
            ListHelpers.AssignList(Messages, other.Messages);
            Move.Assign(other.Move);
            Network.Assign(other.Network);
            Scanner.Assign(other.Scanner);
            Sensors.Assign(other.Sensors);
            ListHelpers.AssignList(Spindles, other.Spindles);
            State.Assign(other.State);
            ListHelpers.AssignList(Storages, other.Storages);
            ListHelpers.AssignList(Tools, other.Tools);
            ListHelpers.AssignList(UserVariables, other.UserVariables);
        }