示例#1
0
        public void addUserList(www16pu www16puObj)
        {
            User user = new User();

            if (GlobalV.userList.Count == 0)
            {
                user.ID = 1;
            }
            else
            {
                user.ID = (GlobalV.userList.Select(ul => ul.ID).Max() + 1);
            }
            user.Obj = www16puObj;
            GlobalV.userList.Add(user);
            user_listView.Items.Add(user.Item);
            //TimeUpEvent += new TimeUpHandler(user.test); // 加入倒计时结束事件的订阅
            TimeUpEvent  += new TimeUpHandler(user.BuyThreadStartFun); // 加入倒计时结束事件的订阅
            UserLogEvent += user.reLogein;                             // 加入重新登陆事件订阅
        }
示例#2
0
        Dictionary <TTaskKey, TaskContainer> _scheduledTasks = new Dictionary <TTaskKey, TaskContainer>(); // 定时列表
        public MyTaskScheduler(TimeUpHandler timeUpHandler, int minIntervalMS = 1000, int maxIntervalMS = 30 * 1000)
        {
            if (timeUpHandler == null)
            {
                throw new ArgumentNullException(nameof(timeUpHandler));
            }
            if (minIntervalMS <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(minIntervalMS));
            }
            if (maxIntervalMS <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(maxIntervalMS));
            }
            if (maxIntervalMS < minIntervalMS)
            {
                throw new ArgumentOutOfRangeException(nameof(maxIntervalMS) + " should larger than or equals with " + nameof(minIntervalMS));
            }

            _timeUpHandle    = timeUpHandler;
            MIN_POLL_WAIT_MS = minIntervalMS;
            MAX_POLL_WAIT_MS = maxIntervalMS;
        }