Exemple #1
0
        public void Receive(Dictionary <string, object> Objects)
        {
            nowTime = nowTime.AddMilliseconds(500);
            LinesCollection temp = new LinesCollection();
            Type            t    = temp.GetType();
            DataLine        aux  = null;

            foreach (var line in Lines.Reference.Keys)
            {
                if (Objects.ContainsKey(line))
                {
                    //RadChart1.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
                    //                     (ThreadStart)(() => UpdateProperty(t, ref aux, line, Objects, nowTime)));

                    string varProp = "Var" + Lines.Reference[line];
                    aux      = (t.GetProperty(varProp).GetValue(temp, null) as DataLine);
                    aux.Data = Convert.ToDouble(Objects[line]);
                    aux.Time = nowTime;
                }
            }

            UpdateDataLive(temp);

            //RadChart1.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
            //                             (ThreadStart)(() => SetUpAxisXRange(nowTime)));
            //RadChart1.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
            //                             (ThreadStart)(() => RadChart1.ItemsSource = null));
            //RadChart1.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
            //                             (ThreadStart)(() => RadChart1.ItemsSource = data));
        }
Exemple #2
0
        private void UpdateDataLive(LinesCollection temp)
        {
            if (this.data.Count >= queueCapacity)
            {
                this.data.Dequeue();
            }

            this.data.Enqueue(temp);
        }