Exemplo n.º 1
0
        void GetDeviceDistributionList()
        {
            try
            {
                Dictionary <string, int> temp = CommonFunctions.GetVendorDeviceDistribution(null, ((App)Application.Current).NodeValue);
                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);
                    }
                }

                ChartDeviceDistribution.DataContext = m_deviceDistributionList;               //CommonFunctions.GetVendorDeviceDistribution(null, ((App)Application.Current).NodeValue);
                ChartDeviceDistribution.UpdateLayout();
                if (m_thirtySecondsTimer == null)
                {
                    StartThirtySecondsTimer();
                }
            }
            catch
            {
            }
            if (m_activityWindow != null)
            {
                m_activityWindow.Close();
            }
        }
Exemplo n.º 2
0
        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();
            }
        }