Exemplo n.º 1
0
        private void btnRefresh_Click(object sender, EventArgs e)
        {
            if (m_RealTimeList.Count == 0)
            {
                foreach (int key in server.m_ValueDictionary.Keys)
                {
                    m_RealTimeList.AddRange(server.m_ValueDictionary[key]);
                }

                m_BindingList = new BindingList <CollectionData.Models.RealTimeValue>(m_RealTimeList);

                realTimeData.DataSource = m_BindingList;
            }

            foreach (int key in server.m_ValueDictionary.Keys)
            {
                foreach (var item in server.m_ValueDictionary[key])
                {
                    CollectionData.Models.RealTimeValue rValue = m_RealTimeList.Find(realValue => realValue.MeterCode == item.MeterCode && realValue.ParamCode == item.ParamCode);

                    if (rValue != null)
                    {
                        if (rValue.Value != item.Value)
                        {
                            int index = m_RealTimeList.FindIndex(realValue => realValue.MeterCode == item.MeterCode && realValue.ParamCode == item.ParamCode);
                            m_RealTimeList[index].Value = item.Value;
                        }
                    }
                }
            }

            realTimeData.Refresh();
        }
Exemplo n.º 2
0
        private void RefreshView()
        {
            m_TopologicalValues.Clear();
            m_IdList.Clear();
            List <CollectionData.Models.TopologicalRegister> topologicalRegisters = helper.GetTopologicalRegisters(m_TopologicalID, mysqlConnectionString);
            List <CollectionData.Models.RealTimeValue>       allValues            = graphHelper.GetCurrentValue();

            foreach (var item in topologicalRegisters)
            {
                if (!m_IdList.Contains(item.MeterCode))
                {
                    m_IdList.Add(item.MeterCode);
                }

                CollectionData.Models.RealTimeValue tempValue = allValues.Find(value => item.MeterCode == value.MeterCode && item.ParamCode == value.ParamCode);
                if (tempValue == null)
                {
                    continue;
                }

                m_TopologicalValues.Add(tempValue);
            }
        }