示例#1
0
 private void RemoveAllOfType(DeviceActionType type)
 {
     lock (_lock)
     {
         var  cur  = _root;
         Node prev = null;
         while (cur != null)
         {
             if (cur.Action.ActionType == type)
             {
                 Count--;
                 if (prev != null)
                 {
                     prev.Next = cur.Next;
                 }
                 else //we are removing the root
                 {
                     _root = cur.Next;
                 }
             }
             else
             {
                 prev = cur;
             }
             cur = cur.Next;
         }
         if (_root == null)
         {
             _itemsInQueueEvent.Reset();
         }
     }
 }
示例#2
0
        /// <summary>
        /// 获取设备状态说明
        /// </summary>
        /// <param name="parameterType"></param>
        /// <returns></returns>
        public static string GetDeviceActionTypeString(DeviceActionType actionType)
        {
            string strReturn = string.Empty;

            switch (actionType)
            {
            case DeviceActionType.P:
                strReturn = "投放";
                break;

            case DeviceActionType.S:
                strReturn = "启动";
                break;

            case DeviceActionType.M:
                strReturn = "搅拌";
                break;

            case DeviceActionType.E:
                strReturn = "停止";
                break;

            case DeviceActionType.H:
                strReturn = "加热";
                break;

            default:
                break;
            }
            return(strReturn);
        }
示例#3
0
 public void Enqueue(DeviceActionType type, DeviceActionParams args, bool overwriteSameType, Action <bool> completionCallback = null)
 {
     lock (_lock)
     {
         if (overwriteSameType)
         {
             RemoveAllOfType(type);
         }
         Enqueue(new Node(new DeviceAction {
             ActionType = type, Params = args, CompletionCallback = completionCallback
         }));
     }
 }