コード例 #1
0
        //***************************************************************************
        // Depreciated Class Constructor
        //

        /*
         *  ScheduledEventList unsorted = new ScheduledEventList();
         *  for (int i = 0; i < RollupParams.Length; i++)
         *      if (RollupParams[i].EventInterval.TotalSeconds > 0)
         *      {
         #if DEBUG
         *          Console.WriteLine("Added interval event...");
         *          Console.WriteLine(RollupParams[i].EventInterval.ToString());
         #endif
         *          DateTime evtTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 00, 00, 00);
         *          for (int f = 0; f <= (24 * 60 * 60) / RollupParams[i].EventInterval.TotalSeconds; f++)
         *          {
         *              evtTime = evtTime.AddSeconds(aosText[i].EventInterval.TotalSeconds);
         *              string evtName = RollupParams[i].ToString().PadRight(20, ' ') + " [" + evtTime.ToString("hh:mm:ss") + "]";
         *              unsorted.Add(new ScheduledEvent(i, evtName, evtTime));
         *          }
         *      }
         *      else
         *      {
         *          string evtName = RollupParams[i].ToString().PadRight(20, ' ') + " [" + RollupParams[i].EventTime.ToString("hh:mm:ss") + "]";
         *          unsorted.Add(new ScheduledEvent(i, evtName, aosText[i].EventTime));
         *      }
         *
         *  for (int r = 0; r < unsorted.Count; r++)
         *  {
         *      for (int t = 0; t < unsorted.Count; t++)
         *      {
         *          if (unsorted[t] > unsorted[r])
         *          {
         *              unsorted.Move(t, r);
         *          }
         *      }
         *  }
         *  // We clone the (now) sorted list into our global variable reference
         *  events = unsorted.Clone() as ScheduledEventList;
         *  // Then we loop through until we find the first event who's time has not
         *  //   already passed, and set the 'nextEvent' counter to that record.
         *  GetNextEvent();
         #if DEBUG
         *  foreach (ScheduledEvent evnt in events)
         *      Console.WriteLine("{0}:  {1} [{2}]", evnt.EventID, evnt.EventName, evnt.ScheduledTime.ToString("hh:mm:ss"));
         #endif
         */
        #endregion

        #region Public Methods
        //***************************************************************************
        // Public Methods
        //
        /// <summary>
        /// Creates a 'deep' copy of the current AosSchedule object.
        /// </summary>
        /// <returns>An AosSchedule object which is a direct copy of the current AosSchedule object.</returns>
        public override object Clone()
        {
            ScheduleManager newSchedule = new ScheduleManager(events.Clone() as ScheduledEventCollection);

            return(newSchedule);
        }
コード例 #2
0
        //***************************************************************************
        // Depreciated Class Constructor
        // 
        /*
            ScheduledEventList unsorted = new ScheduledEventList();
            for (int i = 0; i < RollupParams.Length; i++)
                if (RollupParams[i].EventInterval.TotalSeconds > 0)
                {
#if DEBUG
                    Console.WriteLine("Added interval event...");
                    Console.WriteLine(RollupParams[i].EventInterval.ToString());
#endif
                    DateTime evtTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, 00, 00, 00);
                    for (int f = 0; f <= (24 * 60 * 60) / RollupParams[i].EventInterval.TotalSeconds; f++)
                    {
                        evtTime = evtTime.AddSeconds(aosText[i].EventInterval.TotalSeconds);
                        string evtName = RollupParams[i].ToString().PadRight(20, ' ') + " [" + evtTime.ToString("hh:mm:ss") + "]";
                        unsorted.Add(new ScheduledEvent(i, evtName, evtTime));
                    }
                }
                else
                {
                    string evtName = RollupParams[i].ToString().PadRight(20, ' ') + " [" + RollupParams[i].EventTime.ToString("hh:mm:ss") + "]";
                    unsorted.Add(new ScheduledEvent(i, evtName, aosText[i].EventTime));
                }

            for (int r = 0; r < unsorted.Count; r++)
            {
                for (int t = 0; t < unsorted.Count; t++)
                {
                    if (unsorted[t] > unsorted[r])
                    {
                        unsorted.Move(t, r);
                    }
                }
            }
            // We clone the (now) sorted list into our global variable reference
            events = unsorted.Clone() as ScheduledEventList;
            // Then we loop through until we find the first event who's time has not
            //   already passed, and set the 'nextEvent' counter to that record.
            GetNextEvent();
#if DEBUG
            foreach (ScheduledEvent evnt in events)
                Console.WriteLine("{0}:  {1} [{2}]", evnt.EventID, evnt.EventName, evnt.ScheduledTime.ToString("hh:mm:ss"));
#endif
        */
        #endregion

        #region Public Methods
        //***************************************************************************
        // Public Methods
        // 
        /// <summary>
        /// Creates a 'deep' copy of the current AosSchedule object.
        /// </summary>
        /// <returns>An AosSchedule object which is a direct copy of the current AosSchedule object.</returns>
        public override object Clone()
        {
            ScheduleManager newSchedule = new ScheduleManager(events.Clone() as ScheduledEventCollection);
            return newSchedule;
        }