public void AddEmpty() { var intQueue = new QueueList <int>(5); intQueue.Add(5); Assert.IsTrue(intQueue[0] == 5); }
private void ReadAhead(int needed) { while (needed-- > 0) { lookAhead.Add(ParseOne()); } }
private async void _lockTrackerService_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (QueueList.Any()) { var chatId = QueueList[0].ChatId; if (_lockTrackerService.IsRoomFree) { InitializeRoomDequeue(); _menuLoader.LoadStateMenu(chatId, UserState.InMainMenu); } else { CancelInBetweenTimer(toTheRoom: true); _menuLoader.LoadStateMenu(chatId, UserState.InTheRoom); _LogHelper.Log("LLN435N43FDGFDGFD879", $"About to delete a notification for {chatId}", chatId, LogLevel.Information); } } else { _LogHelper.Log("NBN75KJ6U55Y", "Adding user0 to the EMPTY queue", LogLevel.Information); var slot = new QueueSlot(0, 5); QueueList.Add(slot); ProcessUserInTheRoom(); } }
public void AddToQueue(String buildName) { lock (s_lock) { var item = new BuildElement() { Name = buildName, RequestTime = DateTime.Now }; QueueList.Add(item); if (!QueueTimer.Enabled) { QueueTimer.Start(); } } }
public void Enqueue(MusicData item) { lock (QueueList) { if (QueueList.Count == 1 || IsPlaying) { Player.StopAsync(); QueueList.Clear(); } if (!QueueList.Any()) { QueueList.Add(item); } } }
private void NeedChars(int needed) { while (needed-- > 0) { if (endQueued) { throw new ReaderException(this, "Tried to Read beyond the end of the file."); } int ch = dataSource.Read(); unreadBuffer.Add(ch); if (ch < 0) { endQueued = true; } } }
/////////////////////////////////////////////////////////////////////// public ReturnCode EnqueueCommand( string text, ref Result error ) { CheckDisposed(); QueueList <string, string> queue = GetQueue(); if (queue == null) { error = "debugger command queue not available"; return(ReturnCode.Error); } queue.Add(GetQueueKey(), text); return(ReturnCode.Ok); }
public int Enqueue(long id, int timeMinutes = 5) { QueueList.Add(new QueueSlot(id, timeMinutes)); if (QueueList.Count - 1 > 0) { string notificationText = _localizationHelper.GetLocalizedString(StringToLocalize.EnqueueAlert) .Replace("[QUEUEPOS]", (QueueList.Count - 1).ToString()) .Replace("[WAITTIME]", GetTimeToWait(id).ToString()); AlertSubscriber(id, notificationText); return(QueueList.Count - 1); } else { //var t = Task.Run(() => ProcessUserInBetweenQueueAndRoom()); ProcessUserInBetweenQueueAndRoom(); return(0); } }
private void InitiateCommand() { var query = Input.Text; //_cmdInstance.Hide(); Task.Run(() => { UserModule um = null; Command cm = null; if (UserModule.FindResponsibleUserModule(query, out um, out cm)) { Dispatcher.Invoke(() => { um.GiveRegexCommand(cm); _commandHistory.Add(cm.ToString()); }); } }); }
private async Task RefreshQueueList() { var result = await _queueManager.GetQueueList(); QueueList.Clear(); if (result != null) { //Filtered by state result = result.Where(x => x.PlayerState != PlayerState.Playing).ToList(); foreach (var item in result.OrderBy(x => x.DateTimeWhenPlayerSetInTheQueue)) { QueueList.Add(item); } } else { RaisePropertyChanged("QueueList"); } }
public void AddToQueue(PatternsSessionData session, byte[] upPByte, byte[] hrByte) { lock (s_lockObject) { var item = new RetrospectiveQueueStructure() { FHRByte = hrByte, UPByte = upPByte, Session = session }; QueueList.Add(item); if (!QueueTimer.Enabled) { QueueTimer.Start(); Logger.WriteLogEntry(TraceEventType.Information, "Patterns Add On Manager, RetrospectiveQueue, Add To Queue", "QueueTimer started"); } Logger.WriteLogEntry(TraceEventType.Information, "Patterns Add On Manager, RetrospectiveQueue, Add To Queue", "AddToQueue finished"); } }
/// <summary> /// Enqueues a queue ticket to the queue list with priority considerations /// </summary> /// <param name="newTicket"></param> public void EnqueueTicket(QueueTicket newTicket) { if (QueueList.Count < QueueLane.Capacity && newTicket.QueueLane.LaneID == newTicket.QueueLane.LaneID) { int indexToInsert = QueueList.FindIndex( item => item.HasHigherPriority( newTicket.PriorityNumber, newTicket.QueueDateTime, Tolerance )); if (indexToInsert != -1) { QueueList.Insert(indexToInsert, newTicket); } else { //index at end of list QueueList.Add(newTicket); } } }
// queues void addQueue(TaskQueue.ITQueue q) { QueueList.Add(q.QueueType, q); }
internal void QueueTask() { QueueList.Add(SelectedTask); ShowQueue(); }
/// <summary> /// Function launched every Tick (every minute) to see if some task /// was scheduled and need to be run /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void LaunchScheduleTimer_Tick(object sender, EventArgs e) { // First looking for schedule tasks already ran but failed and need to re-run foreach (var toAdd in from schedule in CurrentlyScheduledTasks where schedule.Value.ScheduleTime.Hour == DateTime.Now.Hour && schedule.Value.ScheduleTime.Minute == DateTime.Now.Minute select new { toScheduleTask = TaskManager.GetTaskById(schedule.Key, RunTimeContext.Context.DatabaseContext), taskSchedule = schedule.Value } ) { SelectedTask = toAdd.toScheduleTask; QueueList.Add(toAdd.toScheduleTask); if (!TaskRunning) { Start(); } } // Now looking for task to add in the CurrentlyScheduledTasks list and run them foreach (var toAdd in from schedule in ScheduledList where schedule.Date.Hour == DateTime.Now.Hour && schedule.Date.Minute == DateTime.Now.Minute select new { toScheduleTask = TaskManager.GetTaskById(schedule.TaskId, RunTimeContext.Context.DatabaseContext), taskSchedule = schedule } ) { if (string.IsNullOrEmpty(toAdd.taskSchedule.DayOfWeek)) { toAdd.taskSchedule.DayOfWeek = string.Empty; } int dayOfWeekSign = 0;//schedule时间是否符合设定的week时间的标志位 string[] dayString = toAdd.taskSchedule.DayOfWeek.Split(','); string nowDayOfWeek = DateTime.Now.DayOfWeek.ToString(); nowDayOfWeek = nowDayOfWeek.Substring(0, 3); if (dayString.Length == 1 && string.IsNullOrEmpty(dayString[0])) { dayOfWeekSign = 1; } foreach (string item in dayString) { if (nowDayOfWeek.Equals(item)) { dayOfWeekSign = 1; break; } } if (dayOfWeekSign == 0) { break; } SelectedTask = toAdd.toScheduleTask; CurrentlyScheduledTasks.Add(toAdd.toScheduleTask.Id, new ScheduledTaskInfo { Interval = toAdd.taskSchedule.Interval.Value, Retry = toAdd.taskSchedule.Count.Value, ScheduleTime = toAdd.taskSchedule.Date }); PrintMessage(String.Format("[Scheduler] {0} is scheduled to run at {1:HH:mm tt}, adding to queue now", toAdd.toScheduleTask.Name, toAdd.taskSchedule.Date)); QueueList.Add(toAdd.toScheduleTask); if (!TaskRunning) { Start(); } } }