private static List <T> Dequeue <T>(int count) { var ret = new List <T>(); while (ret.Count < count) { if (!TryEnterQMonitor(3)) { continue; //Could not obtain lock after 3 tries waiting 5 seconds each } try { ret.Add((T)Q.Dequeue()); } catch (InvalidOperationException) { OnReport?.Invoke($"[###Thread: {Thread.CurrentThread.ManagedThreadId}###] queue is empty"); count = 0;//don't try to get any more from empty queue } finally { Monitor.Pulse(Q); Monitor.Exit(Q); } } return(ret); }
private static void ExportReport(string report) { Report r = Report.CreateTextReport("Logs", report); OnReport?.Invoke(null, new ReportManagerEventArgs(r)); }
private void TriggerLogChanged(Report text) { try { OnReport?.Invoke(text); } catch (Exception e) { LogManager.Error($"Exception during Report Handling: {e.Message}"); LogManager.Error(e.StackTrace); } }
private bool Report() { EmitLog("Processing report command"); if (!IsPlaced) { return(false); } var status = $"{X},{Y},{FacingAsString}"; OnReport?.Invoke(status); return(true); }
private static void CreateQueueListener(Action <object> msgAction, CancellationToken ctx) { lock (Q) { while (!ctx.IsCancellationRequested) { if (Q.Count == 0) { Monitor.Wait(Q); } try { msgAction(Q.Dequeue()); } catch (InvalidOperationException) { OnReport?.Invoke($"[###Thread: {Thread.CurrentThread.ManagedThreadId}###] queue is empty"); } } } }
private void OnReportUserButtonPressed() { OnReport?.Invoke(userId); Hide(); }
private void OnReportUserButtonPressed() { OnReport?.Invoke(userId); WebInterface.SendReportPlayer(userId); Hide(); }
public void Report(Text report) { Console.WriteLine(report.Content); OnReport?.Invoke(report); }
public void Report(AbstractSimulationInfo info) { OnReport?.Invoke(info); }
void IProgress <T> .Report(T value) => OnReport?.Invoke(value);
private void OnReportUserButtonPressed() { OnReport?.Invoke(targetEntry); Hide(); }