Пример #1
0
        /// <summary>
        /// Adds the specified id.
        /// </summary>
        /// <param name="id">The id.</param>
        public bool Add(string id, bool allowOnlySingleTask)
        {
            bool result = false;

            lock (syncRoot)
            {
                if (allowOnlySingleTask == true)
                {
                    string typeFullName = this.GetType().FullName;

                    if (SingleTaskIdByTypeName.Keys.Count(x => x == typeFullName) == 1)
                    {
                        result = false;
                    }
                    else
                    {
                        SingleTaskIdByTypeName.Add(typeFullName, id);

                        ProcessStatus.Add(id, 0);
                        ProcessStatusMessage.Add(id, "");

                        result = true;
                    }
                }
                else
                {
                    ProcessStatus.Add(id, 0);
                    ProcessStatusMessage.Add(id, "");

                    result = true;
                }
            }

            return(result);
        }
Пример #2
0
 /// <summary>
 /// 添加指定的ID/Adds the specified id.
 /// </summary>
 /// <param name="id">动作id/The id.</param>
 public void Add(string id)
 {
     lock (syncRoot)
     {
         ProcessStatus.Add(id, 0);
     }
 }