예제 #1
0
        /// <summary>
        /// Creates a clone of this instance
        /// </summary>
        /// <returns>Clone of this instance</returns>
        public object Clone()
        {
            MachineModel clone = new MachineModel
            {
                Channels    = (Channels)Channels.Clone(),
                Electronics = (Electronics)Electronics.Clone(),
                Heat        = (Heat)Heat.Clone(),
                Job         = (Job)Job.Clone(),
                MessageBox  = (MessageBox)MessageBox.Clone(),
                Move        = (Move)Move.Clone(),
                Network     = (Network)Network.Clone(),
                Scanner     = (Scanner)Scanner.Clone(),
                Sensors     = (Sensors)Sensors.Clone(),
                State       = (State)State.Clone()
            };

            ListHelpers.CloneItems(clone.Fans, Fans);
            ListHelpers.CloneItems(clone.Messages, Messages);
            ListHelpers.CloneItems(clone.Spindles, Spindles);
            ListHelpers.CloneItems(clone.Storages, Storages);
            ListHelpers.CloneItems(clone.Tools, Tools);
            ListHelpers.CloneItems(clone.UserVariables, UserVariables);

            return(clone);
        }
 /// <summary>
 /// Creates a duplicate of the full object model
 /// </summary>
 /// <returns>A clone of this model</returns>
 public object Clone()
 {
     return(new MachineModel
     {
         Channels = (Channels)Channels.Clone(),
         Electronics = (Electronics)Electronics.Clone(),
         Fans = Fans.Select(fan => (Fan)fan.Clone()).ToList(),
         Heat = (Heat)Heat.Clone(),
         Job = (Job)Job.Clone(),
         MessageBox = (MessageBox)MessageBox.Clone(),
         Move = (Move)Move.Clone(),
         Network = (Network)Network.Clone(),
         Messages = Messages.Select(item => (Message)item.Clone()).ToList(),
         Scanner = (Scanner)Scanner.Clone(),
         Sensors = (Sensors)Sensors.Clone(),
         Spindles = Spindles.Select(spindle => (Spindle)spindle.Clone()).ToList(),
         State = (State)State.Clone(),
         Storages = Storages.Select(storage => (Storage)storage.Clone()).ToList(),
         Tools = Tools.Select(tool => (Tool)tool.Clone()).ToList()
     });
 }