Exemplo n.º 1
0
        private ICPTracerDelegate AddTracer(ulong id, string varName)
        {
            ignoreCellValEvents = true;
            table.Rows.Add();
            DataGridViewRow row = table.Rows[table.Rows.Count - 1];

            row.Cells[EnabledCellInd].Value = true;
            row.Cells[NameCellInd].Value    = varName;
            ICPTraceConsumer          cons       = new CPTableTraceConsumer(table, row);
            ICPTracerDelegate         cpDelegate = new CPTracerDelegate(cons);
            IList <ICPTracerDelegate> delegs     = null;

            if (!rowDelegates.TryGetValue(id, out delegs))
            {
                delegs = new List <ICPTracerDelegate>();
                rowDelegates.Add(id, delegs);
            }
            delegs.Add(cpDelegate);
            rowIdInds.Add(row.Index, new KeyValuePair <ulong, int>(id, delegs.Count - 1));
            if (updateTimer == null)
            {
                updateTimer          = new Timer();
                updateTimer.Interval = 100;
                updateTimer.Tick    += UpdateView;
                updateTimer.Start();
            }
            ignoreCellValEvents = false;

            return(cpDelegate);
        }
Exemplo n.º 2
0
        private ICPTracerDelegate AddTracer(ulong id, string varName)
        {
            Series ser = chart.Series.Add(varName);

            ser.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Time;
            ser.YValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Double;
            ser.ChartType  = SeriesChartType.FastLine;
            ser.LegendText = varName;
            ICPTraceConsumer cons       = new CPChartTraceConsumer(chart, ser);
            CPTracerDelegate cpDelegate = new CPTracerDelegate(cons);

            chart.ApplyPaletteColors();
            cpDelegate.properties.Add("color", ser.Color);
            IList <Tuple <ICPTracerDelegate, Series> > delegs = null;

            if (!serDelegates.TryGetValue(id, out delegs))
            {
                delegs = new List <Tuple <ICPTracerDelegate, Series> >();
                serDelegates.Add(id, delegs);
            }
            delegs.Add(new Tuple <ICPTracerDelegate, Series>(cpDelegate, ser));
            ICPTracerDelegate cpDepDelegate = traceConsumer.CreateTracer(id, varName);

            cpDepDelegate.SetProperty("color", ser.Color);
            depDelegates.Add(chart.Series.Count - 1, cpDepDelegate);

            if (updateTimer == null)
            {
                updateTimer          = new Timer();
                updateTimer.Interval = 500;
                updateTimer.Tick    += UpdateView;
                updateTimer.Start();
            }

            return(cpDelegate);
        }