Exemple #1
0
 /// <summary>
 /// Permet de déterminer si l'action de l'élément à été annulée (elle n'apparait plus dans la liste des actions)
 /// </summary>
 /// <param name="SAI"></param>
 /// <returns></returns>
 public bool IsActionCancelled(SyncActionItem SAI)
 {
     lock (ActionListLock)
     {
         return(!ActionList.Contains(SAI));
     }
 }
Exemple #2
0
 public bool ActionAdd(SyncActionItem SAI)
 {
     lock (ActionListLock)
     {
         if (ActionList.Count(x => x.Equals(SAI)) == 0)
         {
             ActionList.Enqueue(SAI);
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
Exemple #3
0
 public void ActionCloseCurrent(bool IsMaxRetryReached = false)
 {
     lock (ActionListLock)
     {
         _IsDispatched = false;
         ErrorCount    = 0;
         if (ActionList.Count > 0)
         {
             SyncActionItem SAI = ActionList.Dequeue(); //Actions may have been cancelled and the tread running the action is still not notified. We catch a potential error
             if (IsMaxRetryReached)
             {
                 Logger logger = LogManager.GetCurrentClassLogger();
                 logger.Debug(String.Format("[{0}]This action has been removed due to max error count reached", SAI.ActionItemId));
             }
         }
     }
 }
Exemple #4
0
        /// <summary>
        /// Compare 2 SyncActionItem objects
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            if (!obj.GetType().Equals(typeof(SyncActionItem)))
            {
                return(false);
            }

            SyncActionItem objToCompare = (SyncActionItem)obj;

            if (StringParameter == null && RemoteElementParameter == null)
            {
                return(this.Action.Equals(objToCompare.Action));
            }
            else if (StringParameter != null)
            {
                return(this.Action.Equals(objToCompare.Action) && this.StringParameter.Equals(objToCompare.StringParameter));
            }
            else
            {
                return(this.Action.Equals(objToCompare.Action) && this.RemoteElementParameter.ElementId.Equals(objToCompare.RemoteElementParameter.ElementId));
            }
        }