private void SortExecutionOrder(UpdateCycle sortCycle)
            {
                if (m_updateDict.DoesNotContainKey(sortCycle))
                {
                    return;
                }

                m_updateDict[sortCycle].Sort((a, b) => a.SortOrder.CompareTo(b.SortOrder));
            }
        public FunctionData(Func <bool> updateFunction, string functionName, bool isActive, UpdateCycle updateType, int sortOrder = 0)
        {
            m_updateFunction = updateFunction;

            IsActive = isActive;

            SortOrder = sortOrder;

            FunctionName    = functionName;
            UpdateCycleType = updateType;
        }
示例#3
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (RtdsId != 0)
            {
                hash ^= RtdsId.GetHashCode();
            }
            if (UpdateCycle != 0)
            {
                hash ^= UpdateCycle.GetHashCode();
            }
            hash ^= tagInfors_.GetHashCode();
            return(hash);
        }
            private void UpdateData(UpdateCycle updateType)
            {
                if (!m_updateDict.ContainsKey(updateType))
                {
                    return;
                }
                m_cancelledData.Clear();

                for (int _dataIndex = 0; _dataIndex < m_updateDict[updateType].Count; _dataIndex++)
                {
                    FunctionData _data = m_updateDict[updateType][_dataIndex];

                    _data.Update();

                    if (!_data.CancelUpdate)
                    {
                        continue;
                    }

                    m_cancelledData.Add(_data);
                }

                FlushCancelled();
            }
示例#5
0
        static UpdateCycle<HElement> PushUpdate(HElement page)
        {
            lock (locker)
              {
            var lastUpdate = Updates.LastOrDefault();

            var cycle = (lastUpdate != null ? lastUpdate.Cycle : 0) + 1;

            var update = new UpdateCycle<HElement>(null, cycle, page, null);

            Updates = Updates.Skip(Math.Max(Updates.Length - 100, 0)).Concat(new[] { update }).ToArray();

            return update;
              }
        }
示例#6
0
 /// <summary>
 /// 启动
 /// </summary>
 public override void Start()
 {
     UpdateCycle.Run(this.Update, System.Threading.ThreadPriority.BelowNormal);
     RemoteCtrlCycle.Run(this.remoteCtrl, System.Threading.ThreadPriority.BelowNormal);
 }
示例#7
0
		public void Put(UpdateCycle cycle)
		{
			_api.Update (cycle);
		}
        /// <summary>
        /// Add a Func to the static update queue
        /// </summary>
        /// <param name="updateFunc">The function to update, returns the stop condition</param>
        /// <param name="functionName">The name of the function, used to cancel functions by name</param>
        /// <param name="active">Whether the function starts active</param>
        /// <param name="updateType">Which update cycle should be used (Normal, Fixed or Late)</param>
        /// <returns></returns>
        public static FunctionData CreateUpdater(Func <bool> updateFunc, string functionName = "", bool active = true, UpdateCycle updateType = UpdateCycle.NORMAL, int order = 0)
        {
            FunctionData _updateData = new FunctionData(updateFunc, functionName, active, updateType, order);

            HandlerInstance.AddFunctionData(_updateData);

            return(_updateData);
        }
 /// <summary>
 /// Add an Action to the static update queue
 /// </summary>
 /// <param name="updateFunc">The function to update</param>
 /// <param name="functionName">The name of the function, used to cancel functions by name</param>
 /// <param name="active">Whether the function starts active</param>
 /// <param name="updateType">Which update cycle should be used (Normal, Fixed or Late)</param>
 /// <returns></returns>
 public static FunctionData CreateUpdater(Action updateFunc, string functionName = "", bool active = true, UpdateCycle updateType = UpdateCycle.NORMAL, int order = 0)
 {
     return(CreateUpdater(() => { updateFunc.Invoke(); return true; }, functionName, active, updateType, order));
 }