示例#1
0
 /// <summary> Stops all the non-offline tasks and its children. </summary>
 internal void StopNonOfflineTasks()
 {
     for (int i = 0; i < _mgDataTab.Count; i++)
     {
         MGData mgData = _mgDataTab[i];
         if (mgData != null && !mgData.IsAborting)
         {
             Task firstTask = mgData.getFirstTask();
             if (!firstTask.isMainProg() && !firstTask.IsOffline)
             {
                 StopTaskTree(mgData.getFirstTask());
             }
         }
     }
 }
示例#2
0
        /// <summary>
        ///   add MGData object to the table
        /// </summary>
        /// <param name = "mgd">the MGData object to add</param>
        /// <param name = "idx">the index within the table for the new MGData</param>
        internal void addMGData(MGData mgd, int idx, bool isStartup)
        {
            if (idx < 0 || idx > getSize())
            {
                throw new ApplicationException("Illegal MGData requested");
            }

            if (isStartup)
            {
                StartupMgData = mgd;
            }

            if (idx == getSize())
            {
                _mgDataTab.Add(mgd);
            }
            else
            {
                MGData oldMgd = getMGData(idx);
                if (oldMgd != null && !oldMgd.IsAborting)
                {
                    oldMgd.getFirstTask().stop();
                    oldMgd.abort();
                }
                _mgDataTab[idx] = mgd;
            }
        }