private void Updater_NewQueryResults(object sender, QueryResultsEventArgs e) { long count = 0; foreach (SignalDataBase r in e.Results.Values) count += r.Count; m_pointCount = count; }
private void m_syncEvent_CustomEvent(object sender, QueryResultsEventArgs e) { if (SynchronousNewQueryResults != null) { SynchronousNewQueryResults(this, e); } if (ParallelWithControlLockNewQueryResults != null) { ParallelWithControlLockNewQueryResults(sender, e); } }
private void AsyncDoWork(object sender, EventArgs eventArgs) { if (BeforeExecuteQuery != null) { BeforeExecuteQuery(this, EventArgs.Empty); } DateTime startTime; DateTime stopTime; DateTime currentTime; object token; List <MetadataBase> activeSignals; lock (m_syncRoot) { token = m_requestToken; m_requestToken = null; if (Mode == ExecutionMode.Manual) { startTime = m_lowerBounds; stopTime = m_upperBounds; currentTime = m_focusedDate; activeSignals = m_activeSignals; } else { m_playback.GetTimes(out startTime, out stopTime); currentTime = stopTime; activeSignals = m_activeSignals; } } IDictionary <Guid, SignalDataBase> results = m_query.GetQueryResult(startTime, stopTime, 0, activeSignals); QueryResultsEventArgs queryResults = new QueryResultsEventArgs(results, token, startTime, stopTime); if (AfterQuery != null) { AfterQuery(this, EventArgs.Empty); } if (NewQueryResults != null) { NewQueryResults.ParallelRunAndWait(this, queryResults); } if (SynchronousNewQueryResults != null || ParallelWithControlLockNewQueryResults != null) { m_syncEvent.RaiseEvent(new QueryResultsEventArgs(results, token, startTime, stopTime)); } lock (m_syncRoot) { if (Mode == ExecutionMode.Automatic) { m_async.Start(m_refreshInterval.Milliseconds); } } if (AfterExecuteQuery != null) { AfterExecuteQuery(this, EventArgs.Empty); } }
private void AsyncDoWork(object sender, EventArgs eventArgs) { if (BeforeExecuteQuery != null) BeforeExecuteQuery(this, EventArgs.Empty); DateTime startTime; DateTime stopTime; DateTime currentTime; object token; List<MetadataBase> activeSignals; lock (m_syncRoot) { token = m_requestToken; m_requestToken = null; if (Mode == ExecutionMode.Manual) { startTime = m_lowerBounds; stopTime = m_upperBounds; currentTime = m_focusedDate; activeSignals = m_activeSignals; } else { m_playback.GetTimes(out startTime, out stopTime); currentTime = stopTime; activeSignals = m_activeSignals; } } IDictionary<Guid, SignalDataBase> results = m_query.GetQueryResult(startTime, stopTime, 0, activeSignals); QueryResultsEventArgs queryResults = new QueryResultsEventArgs(results, token, startTime, stopTime); if (AfterQuery != null) AfterQuery(this, EventArgs.Empty); if (NewQueryResults != null) NewQueryResults.ParallelRunAndWait(this, queryResults); if (SynchronousNewQueryResults != null || ParallelWithControlLockNewQueryResults != null) m_syncEvent.RaiseEvent(new QueryResultsEventArgs(results, token, startTime, stopTime)); lock (m_syncRoot) { if (Mode == ExecutionMode.Automatic) { m_async.Start(m_refreshInterval.Milliseconds); } } if (AfterExecuteQuery != null) AfterExecuteQuery(this, EventArgs.Empty); }
private void m_syncEvent_CustomEvent(object sender, QueryResultsEventArgs e) { if (SynchronousNewQueryResults != null) { SynchronousNewQueryResults(this, e); } if (ParallelWithControlLockNewQueryResults != null) { ParallelWithControlLockNewQueryResults(sender, e); } }
private void Updater_NewQueryResults(object sender, QueryResultsEventArgs e) { m_lastResults = e; long pointCount = 0; foreach (SignalDataBase r in e.Results.Values) pointCount += r.Count; this.pointCount = pointCount; }
private void PlotChart(QueryResultsEventArgs e, PlotSurface2D plot, List<KeyValuePair<int, Guid>> signals, bool cacheAxis) { if (cacheAxis) { double minX, maxX, minY, maxY; plot.Title = m_plotTitle; maxX = plot.XAxis1.WorldMax; minX = plot.XAxis1.WorldMin; maxY = plot.YAxis1.WorldMax; minY = plot.YAxis1.WorldMin; foreach (IDrawable drawing in plot.Drawables.ToArray()) plot.Remove(drawing, false); foreach (KeyValuePair<int, Guid> freq in signals) { SignalDataBase data = e.Results[freq.Value]; List<double> y = new List<double>(data.Count); List<double> x = new List<double>(data.Count); for (int i = 0; i < data.Count; i++) { ulong time; double value; data.GetData(i, out time, out value); x.Add(time); y.Add(value * m_scalingFactor); } LinePlot lines = new LinePlot(y, x); lines.Pen = m_colorWheel.TryGetPen(freq.Key); plot.Add(lines); } plot.XAxis1.WorldMax = maxX; plot.XAxis1.WorldMin = minX; plot.YAxis1.WorldMax = maxY; plot.YAxis1.WorldMin = minY; plot.Refresh(); } else { plot.Clear(); plot.Title = m_plotTitle; AddInteractions(); foreach (KeyValuePair<int, Guid> freq in signals) { SignalDataBase data = e.Results[freq.Value]; List<double> y = new List<double>(data.Count); List<double> x = new List<double>(data.Count); for (int i = 0; i < data.Count; i++) { ulong time; double value; data.GetData(i, out time, out value); x.Add(time); y.Add(value * m_scalingFactor); } LinePlot lines = new LinePlot(y, x); lines.Pen = m_colorWheel.TryGetPen(freq.Key); plot.Add(lines); } if (plot.XAxis1 != null) { plot.XAxis1.WorldMax = e.EndTime.Ticks; plot.XAxis1.WorldMin = e.StartTime.Ticks; } plot.Refresh(); } }
private void m_framework_ParallelWithControlLockNewQueryResults(object sender, QueryResultsEventArgs e) { //Debug Code //if (InvokeRequired) // throw new Exception(); try { PlotChart(e, plotSurface2D1, m_signals, m_ignoreNextUpdate |= ReferenceEquals(m_token, e.RequestedToken)); } catch (Exception) { } m_ignoreNextUpdate = false; }
private void m_framework_SynchronousNewQueryResults(object sender, QueryResultsEventArgs e) { m_suspendEvent = true; monthCalendar1.SetSelectionRange(e.StartTime.Date, e.EndTime.Date); m_suspendEvent = false; }
private void m_framework_SynchronousNewQueryResults(object sender, QueryResultsEventArgs e) { m_legendData.Clear(); for (int x = 0; x < m_allGroups.Count; x++) { m_legendData.Add(new LegendEntry(m_allGroups[x], m_colorWheel.TryGetPen(x))); } Refresh(); }