Esempio n. 1
0
        private void OnCPStatusChanged(CPLineEvArgs args)
        {
            Tuple <ILineChartPoints, IChartPoint> tagData = new Tuple <ILineChartPoints, IChartPoint>(args.lineCPs, args.cp);

            foreach (DataGridViewRow row in list.Rows)
            {
                if (row.Tag.Equals(tagData))
                {
                    ignoreCellValEvents = true;
                    switch (tagData.Item2.data.status)
                    {
                    case EChartPointStatus.Available:
                    case EChartPointStatus.SwitchedOn:
                    case EChartPointStatus.SwitchedOff:
                        row.Cells[0].ReadOnly          = false;
                        row.DefaultCellStyle.ForeColor = System.Drawing.Color.Black;
                        break;

                    case EChartPointStatus.NotAvailable:
                        row.Cells[0].Value             = false;
                        row.Cells[0].ReadOnly          = true;
                        row.DefaultCellStyle.ForeColor = System.Drawing.Color.Red;
                        break;
                    }
                    ignoreCellValEvents = false;
                }
            }
        }
Esempio n. 2
0
        private void OnRemCpEvent(CPLineEvArgs args)
        {
            int rowIndex = -1;
            Tuple <ILineChartPoints, IChartPoint> tagData = new Tuple <ILineChartPoints, IChartPoint>(args.lineCPs, args.cp);

            foreach (DataGridViewRow row in list.Rows)
            {
                if (row.Tag.Equals(tagData))
                {
                    if (tagData.Item2 == cpIgnore)
                    {
                        cpIgnore = null;
                    }
                    else
                    {
                        rowIndex = row.Index;
                    }
                    break;
                }
            }
            if (rowIndex >= 0)
            {
                //tagData.Item1.remCPEvent.On -= OnRemCpEvent;
                list.Rows.RemoveAt(rowIndex);
            }
        }
Esempio n. 3
0
 private void OnRemCp(CPLineEvArgs args)
 {
     if (args.lineCPs.Count == 0)
     {
         RemoveLineChartPoints(args.lineCPs);
     }
 }
Esempio n. 4
0
        private void AddChartPoint(CPLineEvArgs args)
        {
            ignoreCellValEvents = true;
            int             i   = list.Rows.Add();
            DataGridViewRow row = list.Rows[i];

            row.Tag = new Tuple <ILineChartPoints, IChartPoint>(args.lineCPs, args.cp);
            args.lineCPs.cpStatusChangedEvent += OnCPStatusChanged;
            row.Cells[0].Value = args.cp.data.enabled;
            row.Cells[1].Value = args.cp.data.uniqueName;
            row.Cells[2].Value = args.cp.data.type;
            //list.AutoResizeColumns();
            ignoreCellValEvents = false;
        }
Esempio n. 5
0
 private void OnAddCpEvent(CPLineEvArgs args)
 {
     if (InvokeRequired)
     {
         if (IsHandleCreated)
         {
             BeginInvoke((MethodInvoker)(() =>
             {
                 AddChartPoint(args);
             }));
         }
         else
         {
             Console.WriteLine("");
         }
     }
     else
     {
         AddChartPoint(args);
     }
 }