Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="name">Task的名称</param>
        /// <param name="commCmd">执行的命令</param>
        /// <param name="taskStrategy">使用的策略</param>
        // 2006.12.13 move station parameters to commandBase
        //
        //// 2006.10.26
        ////
        ////public Task( Station station, CommCmdBase commCmd, TaskStrategy taskStrategy )
        ////public Task( string name, Station station, CommCmdBase commCmd, TaskStrategy taskStrategy )
        public Task(string name, CommCmdBase commCmd, TaskStrategy taskStrategy)
        {
            this.Name = name;
            // 2006.12.13
            //
            ////Debug.Assert (station != null,      "station can't is null.");
            //if ( station == null )
            //    throw new ArgumentNullException("station", SR.GetString("LE_StationNull"));

            //Debug.Assert (commCmd != null,      "commCmd can't is null.");
            if (commCmd == null)
            {
                throw new ArgumentNullException("commCmd", SR.GetString("LE_CommCmdNull"));
            }



            // 2006.12.13
            //
            //m_Station = station;

            m_CommCmd = commCmd;

            TaskStrategy = taskStrategy;
        }
Ejemplo n.º 2
0
        protected Task(SerializationInfo info, StreamingContext context)
        {
            foreach (SerializationEntry entry in info)
            {
                //if (entry.ObjectType == typeof (Station) ||
                //    entry.ObjectType.IsSubclassOf(typeof(Station)))
                //{
                //    this.m_Station = (Station) entry.Value;
                //}

                switch (entry.Name)
                {
                case "TaskStrategy":
                    //this.TaskStrategy = (TaskStrategy)entry.Value;
                    this.m_TaskStrategy = (TaskStrategy)entry.Value;
                    break;

                // 2006.12.13
                //
                //case "Station":
                //    this.m_Station  = (Station)entry.Value;
                //    break;

                case "CommCmd":
                    this.m_CommCmd = (CommCmdBase)entry.Value;
                    break;

                // 2006.12.13
                //
                //case "Parameters":
                //    this.m_Parameters = (object[])entry.Value;
                //    break;

                case "Key":
                    this.Key = (string)entry.Value;
                    break;

                case "Tag":
                    this.Tag = (object)entry.Value;
                    break;

                default:
                    throw new SerializationException(entry.Name + " " + entry.Value);
                }
            }
        }
Ejemplo n.º 3
0
 public Task(CommCmdBase commCmd, TaskStrategy taskStrategy)
     : this(string.Empty, commCmd, taskStrategy)
 {
 }