void m_duplexClient_SendToClientReceived(object sender, SendToClientReceivedEventArgs e) { if (e.msg is TimeTaggedDataMessage) { TextBlockLastRefresh.Text = "Last Refresh: " + DateTime.Now.ToString(); Dictionary <int, TimeTaggedMeasurement> timeTaggedMeasurements = new Dictionary <int, TimeTaggedMeasurement>(); timeTaggedMeasurements = (e.msg as TimeTaggedDataMessage).TimeTaggedMeasurements; foreach (DeviceMeasurementData deviceMeasurement in m_deviceMeasurementDataList) { foreach (DeviceInfo device in deviceMeasurement.DeviceList) { foreach (MeasurementInfo measurement in device.MeasurementList) { TimeTaggedMeasurement timeTaggedMeasurement; if (timeTaggedMeasurements.TryGetValue(measurement.PointID, out timeTaggedMeasurement)) { measurement.CurrentValue = timeTaggedMeasurement.CurrentValue; measurement.CurrentTimeTag = timeTaggedMeasurement.TimeTag; measurement.CurrentQuality = timeTaggedMeasurement.Quality; } } } } TreeViewDeviceMeasurements.ItemsSource = m_deviceMeasurementDataList; } }
void duplexClient_SendToClientReceived(object sender, SendToClientReceivedEventArgs e) { if (e.msg is LivePhasorDataMessage) { LivePhasorDataMessage livePhasorData = (LivePhasorDataMessage)e.msg; //pmuDistributionList = livePhasorData.PmuDistributionList; interconnectionStatusList = livePhasorData.InterconnectionStatusList; Dictionary<string, int> temp = livePhasorData.DeviceDistributionList; foreach (KeyValuePair<string, int> pair in temp) { if (m_deviceDistributionList.ContainsKey(pair.Key)) m_deviceDistributionList[pair.Key] = pair.Value; else m_deviceDistributionList.Add(pair.Key, pair.Value); } //ItemsControlPmuDistribution.ItemsSource = pmuDistributionList; ChartDeviceDistribution.DataContext = m_deviceDistributionList; ChartDeviceDistribution.UpdateLayout(); ItemControlInterconnectionStatus.ItemsSource = interconnectionStatusList; } else if (e.msg is TimeSeriesDataMessage) { if (((TimeSeriesDataMessage)e.msg).TimeSeriesData.Count > m_framesPerSecond) { for (int i = 0; i < (int)((TimeSeriesDataMessage)e.msg).TimeSeriesData.Count / m_framesPerSecond; i++) { if (timeSeriesDataList.Count == 0) timeSeriesDataList.Add(new TimeSeriesDataPoint() { Index = 0, Value = ((TimeSeriesDataMessage)e.msg).TimeSeriesData[(i * m_framesPerSecond)].Value }); else timeSeriesDataList.Add(new TimeSeriesDataPoint() { Index = timeSeriesDataList[timeSeriesDataList.Count - 1].Index + 1, Value = ((TimeSeriesDataMessage)e.msg).TimeSeriesData[(i * m_framesPerSecond)].Value }); } } else if (((TimeSeriesDataMessage)e.msg).TimeSeriesData.Count > 0) { if (timeSeriesDataList.Count == 0) timeSeriesDataList.Add(new TimeSeriesDataPoint() { Index = 0, Value = ((TimeSeriesDataMessage)e.msg).TimeSeriesData[0].Value }); else timeSeriesDataList.Add(new TimeSeriesDataPoint() { Index = timeSeriesDataList[timeSeriesDataList.Count - 1].Index + 1, Value = ((TimeSeriesDataMessage)e.msg).TimeSeriesData[0].Value }); } if (timeSeriesDataList.Count > 30) timeSeriesDataList.RemoveAt(0); ChartRealTimeData.DataContext = timeSeriesDataList; } if (m_activityWindow != null) m_activityWindow.Close(); }
void m_duplexClient_SendToClientReceived(object sender, SendToClientReceivedEventArgs e) { if (e.msg is TimeTaggedDataMessage) { Dictionary <int, TimeTaggedMeasurement> timeTaggedMeasurements = new Dictionary <int, TimeTaggedMeasurement>(); timeTaggedMeasurements = (e.msg as TimeTaggedDataMessage).TimeTaggedMeasurements; if (timeTaggedMeasurements != null) { TextBlockLastRefresh.Text = "Last Refresh: " + DateTime.Now.ToString(); foreach (StatisticMeasurementData statisticMeasurement in m_statisticMeasurementDataList) { foreach (StreamInfo streamInfo in statisticMeasurement.SourceStreamInfoList) { foreach (DeviceStatistic deviceStatistic in streamInfo.DeviceStatisticList) { foreach (DetailStatisticInfo detailStatistic in deviceStatistic.StatisticList) { TimeTaggedMeasurement timeTaggedMeasurement; if (timeTaggedMeasurements.TryGetValue(detailStatistic.PointID, out timeTaggedMeasurement)) { if (detailStatistic.Statistics.IsConnectedState == true) { if (Convert.ToBoolean(timeTaggedMeasurement.CurrentValue)) { streamInfo.StatusColor = "Green"; } else { streamInfo.StatusColor = "Red"; } } detailStatistic.Statistics.Value = timeTaggedMeasurement.CurrentValue; detailStatistic.Statistics.TimeTag = timeTaggedMeasurement.TimeTag; detailStatistic.Statistics.Quality = timeTaggedMeasurement.Quality; } } } } } } TreeViewRealTimeStatistics.ItemsSource = m_statisticMeasurementDataList; } }
void m_duplexClient_SendToClientReceived(object sender, SendToClientReceivedEventArgs e) { if (e.msg is ServiceUpdateMessage) { string message = ((ServiceUpdateMessage)e.msg).ServiceUpdate; if (((ServiceUpdateMessage)e.msg).ServiceUpdateType == UpdateType.Information) { // TextBoxServiceStatus.Text += ((ServiceUpdateMessage)e.msg).ServiceUpdate; Run run = new Run(); run.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255)); run.Text = message; TextBoxServiceStatus.Inlines.Add(run); } else if (((ServiceUpdateMessage)e.msg).ServiceUpdateType == UpdateType.Warning) { Run run = new Run(); run.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 255, 0)); run.Text = message; TextBoxServiceStatus.Inlines.Add(run); } else { Run run = new Run(); run.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 10, 10)); run.Text = message; TextBoxServiceStatus.Inlines.Add(run); } } if (TextBoxServiceStatus.Inlines.Count > m_numberOfMessagesOnMonitor) { TextBoxServiceStatus.Inlines.RemoveAt(0); } if (m_activityWindow != null) { m_activityWindow.Close(); } ScrollViewerMonitor.UpdateLayout(); //this is required to keep scroll-bar at the bottom. ScrollViewerMonitor.ScrollToVerticalOffset(TextBoxServiceStatus.ActualHeight * 2); //ScrollViewerMonitor.ScrollToBottom(); }
void m_duplexClient_SendToClientReceived(object sender, SendToClientReceivedEventArgs e) { if (e.msg is ServiceUpdateMessage) { string message = ((ServiceUpdateMessage)e.msg).ServiceUpdate; if (((ServiceUpdateMessage)e.msg).ServiceUpdateType == UpdateType.Information) { // TextBoxServiceStatus.Text += ((ServiceUpdateMessage)e.msg).ServiceUpdate; Run run = new Run(); run.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 255, 255)); run.Text = message; TextBoxServiceStatus.Inlines.Add(run); } else if (((ServiceUpdateMessage)e.msg).ServiceUpdateType == UpdateType.Warning) { Run run = new Run(); run.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 255, 0)); run.Text = message; TextBoxServiceStatus.Inlines.Add(run); } else { Run run = new Run(); run.Foreground = new SolidColorBrush(Color.FromArgb(255, 255, 10, 10)); run.Text = message; TextBoxServiceStatus.Inlines.Add(run); } } if (TextBoxServiceStatus.Inlines.Count > m_numberOfMessagesOnMonitor) TextBoxServiceStatus.Inlines.RemoveAt(0); if (m_activityWindow != null) m_activityWindow.Close(); ScrollViewerMonitor.UpdateLayout(); //this is required to keep scroll-bar at the bottom. ScrollViewerMonitor.ScrollToVerticalOffset(TextBoxServiceStatus.ActualHeight * 2); //ScrollViewerMonitor.ScrollToBottom(); }
void m_duplexClient_SendToClientReceived(object sender, SendToClientReceivedEventArgs e) { if (e.msg is TimeTaggedDataMessage) { Dictionary<int, TimeTaggedMeasurement> timeTaggedMeasurements = new Dictionary<int, TimeTaggedMeasurement>(); timeTaggedMeasurements = (e.msg as TimeTaggedDataMessage).TimeTaggedMeasurements; if (timeTaggedMeasurements != null) { TextBlockLastRefresh.Text = "Last Refresh: " + DateTime.Now.ToString(); foreach (StatisticMeasurementData statisticMeasurement in m_statisticMeasurementDataList) { foreach (StreamInfo streamInfo in statisticMeasurement.SourceStreamInfoList) { foreach (DeviceStatistic deviceStatistic in streamInfo.DeviceStatisticList) { foreach (DetailStatisticInfo detailStatistic in deviceStatistic.StatisticList) { TimeTaggedMeasurement timeTaggedMeasurement; if (timeTaggedMeasurements.TryGetValue(detailStatistic.PointID, out timeTaggedMeasurement)) { if (detailStatistic.Statistics.IsConnectedState == true) { if (Convert.ToBoolean(timeTaggedMeasurement.CurrentValue)) streamInfo.StatusColor = "Green"; else streamInfo.StatusColor = "Red"; } detailStatistic.Statistics.Value = timeTaggedMeasurement.CurrentValue; detailStatistic.Statistics.TimeTag = timeTaggedMeasurement.TimeTag; detailStatistic.Statistics.Quality = timeTaggedMeasurement.Quality; } } } } } } TreeViewRealTimeStatistics.ItemsSource = m_statisticMeasurementDataList; } }
void duplexClient_SendToClientReceived(object sender, SendToClientReceivedEventArgs e) { if (e.msg is LivePhasorDataMessage) { LivePhasorDataMessage livePhasorData = (LivePhasorDataMessage)e.msg; //pmuDistributionList = livePhasorData.PmuDistributionList; interconnectionStatusList = livePhasorData.InterconnectionStatusList; Dictionary <string, int> temp = livePhasorData.DeviceDistributionList; foreach (KeyValuePair <string, int> pair in temp) { if (m_deviceDistributionList.ContainsKey(pair.Key)) { m_deviceDistributionList[pair.Key] = pair.Value; } else { m_deviceDistributionList.Add(pair.Key, pair.Value); } } //ItemsControlPmuDistribution.ItemsSource = pmuDistributionList; ChartDeviceDistribution.DataContext = m_deviceDistributionList; ChartDeviceDistribution.UpdateLayout(); ItemControlInterconnectionStatus.ItemsSource = interconnectionStatusList; } else if (e.msg is TimeSeriesDataMessage) { if (((TimeSeriesDataMessage)e.msg).TimeSeriesData.Count > m_framesPerSecond) { for (int i = 0; i < (int)((TimeSeriesDataMessage)e.msg).TimeSeriesData.Count / m_framesPerSecond; i++) { if (timeSeriesDataList.Count == 0) { timeSeriesDataList.Add(new TimeSeriesDataPoint() { Index = 0, Value = ((TimeSeriesDataMessage)e.msg).TimeSeriesData[(i * m_framesPerSecond)].Value }); } else { timeSeriesDataList.Add(new TimeSeriesDataPoint() { Index = timeSeriesDataList[timeSeriesDataList.Count - 1].Index + 1, Value = ((TimeSeriesDataMessage)e.msg).TimeSeriesData[(i * m_framesPerSecond)].Value }); } } } else if (((TimeSeriesDataMessage)e.msg).TimeSeriesData.Count > 0) { if (timeSeriesDataList.Count == 0) { timeSeriesDataList.Add(new TimeSeriesDataPoint() { Index = 0, Value = ((TimeSeriesDataMessage)e.msg).TimeSeriesData[0].Value }); } else { timeSeriesDataList.Add(new TimeSeriesDataPoint() { Index = timeSeriesDataList[timeSeriesDataList.Count - 1].Index + 1, Value = ((TimeSeriesDataMessage)e.msg).TimeSeriesData[0].Value }); } } if (timeSeriesDataList.Count > 30) { timeSeriesDataList.RemoveAt(0); } ChartRealTimeData.DataContext = timeSeriesDataList; } if (m_activityWindow != null) { m_activityWindow.Close(); } }
void m_duplexClient_SendToClientReceived(object sender, SendToClientReceivedEventArgs e) { if (e.msg is TimeTaggedDataMessage) { TextBlockLastRefresh.Text = "Last Refresh: " + DateTime.Now.ToString(); Dictionary<int, TimeTaggedMeasurement> timeTaggedMeasurements = new Dictionary<int, TimeTaggedMeasurement>(); timeTaggedMeasurements = (e.msg as TimeTaggedDataMessage).TimeTaggedMeasurements; foreach (DeviceMeasurementData deviceMeasurement in m_deviceMeasurementDataList) { foreach (DeviceInfo device in deviceMeasurement.DeviceList) { foreach (MeasurementInfo measurement in device.MeasurementList) { TimeTaggedMeasurement timeTaggedMeasurement; if (timeTaggedMeasurements.TryGetValue(measurement.PointID, out timeTaggedMeasurement)) { measurement.CurrentValue = timeTaggedMeasurement.CurrentValue; measurement.CurrentTimeTag = timeTaggedMeasurement.TimeTag; measurement.CurrentQuality = timeTaggedMeasurement.Quality; } } } } TreeViewDeviceMeasurements.ItemsSource = m_deviceMeasurementDataList; } }