void timerCpu_Tick(object sender, EventArgs e)
        {
            if (cpuQueue.Count == 0)
            {
                timerCpu.Stop();
            }
            timerCpu.Stop();
            try
            {
                trans_cpu++;
                Data dataPoint = cpuQueue.Dequeue();
                fairprice_cpu.Text = dataPoint.FairPrice.ToString();
                stock_cpu.Text     = dataPoint.ExpandedData.Stock_Id.ToString();
                time_cpu.Text      = dataPoint.Time.ToString();
                //Console.WriteLine(dataPoint.Time);
                transaction_cpu.Text = trans_cpu.ToString();
                expiry_cpu.Text      = dataPoint.ExpandedData.Expiry.ToString();
                callput_cpu.Text     = dataPoint.ExpandedData.Call_Put.ToString();

                //Plot point
                //Console.WriteLine(dataPoint.TimeDiff);
                timerCpu.Interval = dataPoint.TimeDiff;

                DateTime newTime = baseDateCpu.Add(dataPoint.Time);


                DateModel dtpoint = new DateModel {
                    DateTime = newTime, Value = trans_cpu
                };
                CpuValues.Add(dtpoint);

                timerCpu.Start();
            }
            catch
            {
                timerCpu.Stop();
            }
        }
Esempio n. 2
0
        public static void UpdateGraphs(int index, double value)
        {
            //Debug.WriteLine("UpdateGraphs: " + index + " | " + value);
            switch (index)
            {
            case 0:
                GpuValues.Add(new MeasureModel
                {
                    DateTime = DateTime.Now,
                    Value    = value
                });
                if (GpuValues.Count > 10)
                {
                    GpuValues.RemoveAt(0);
                }
                break;

            case 1:
                CpuValues.Add(new MeasureModel
                {
                    DateTime = DateTime.Now,
                    Value    = value
                });
                if (CpuValues.Count > 10)
                {
                    CpuValues.RemoveAt(0);
                }
                break;

            case 2:
                MemValues.Add(new MeasureModel
                {
                    DateTime = DateTime.Now,
                    Value    = value
                });
                if (MemValues.Count > 10)
                {
                    MemValues.RemoveAt(0);
                }
                break;

            case 3:
                DiskValues.Add(new MeasureModel
                {
                    DateTime = DateTime.Now,
                    Value    = value
                });
                if (DiskValues.Count > 10)
                {
                    DiskValues.RemoveAt(0);
                }
                break;

            case 4:
                NetValues.Add(new MeasureModel
                {
                    DateTime = DateTime.Now,
                    Value    = value
                });
                if (NetValues.Count > 10)
                {
                    NetValues.RemoveAt(0);
                }
                break;

            default:
                Debug.WriteLine("Invalid Index " + index);
                break;
            }
            //SetAxisLimits(DateTime.Now);

            //lets only use the last 150 values
        }