public SignalColorExtension(string color)
    {
        SignalColor outColor;

        if (!SignalColor.TryParse(color, true, out outColor))
        {
            IncomingSignalColor = SignalColor.None;
        }
    }
Ejemplo n.º 2
0
    public static Color getColor(SignalColor col)
    {
        Color color = new Color(123, 123, 123);

        switch (col)
        {
        case SignalColor.BLUE1:
            color = new Color(0.6117f, 1f, 0.6352f);
            break;

        case SignalColor.RED1:
            color = new Color(0.9176f, 0.6392f, 0.5f);
            break;

        case SignalColor.YELLOW1:
            color = new Color(0.7921f, 0.7960f, 0.1960f);
            break;

        case SignalColor.GREEN1:
            color = new Color(0.4f, 0.5764f, 0);
            break;

        case SignalColor.CYAN1:
            color = new Color(0.3058f, 0.6980f, 0.8392f);
            break;

        case SignalColor.PINK1:
            color = new Color(1, 0.3411f, 0.6705f);
            break;

        default:
            Debug.Log("WHYYY");
            break;
        }


        return(color);
    }
Ejemplo n.º 3
0
        protected override void Paint(
            Graphics graphics,
            Rectangle clipBounds,
            Rectangle cellBounds,
            int rowIndex,
            DataGridViewElementStates cellState,
            object value,
            object formattedValue,
            string errorText,
            DataGridViewCellStyle cellStyle,
            DataGridViewAdvancedBorderStyle advancedBorderStyle,
            DataGridViewPaintParts paintParts)
        {
            // paint the content cell
            if (rowIndex >= 0)
            {
                int[] sparks;
                if (value is int[])
                {
                    sparks = (int[])value;

                    if (sparks.Length > 0)
                    {
                        // let the base class draw the numeric contents
                        cellStyle.ForeColor = SignalColor.GetColorThreshold(sparks[sparks.Length - 1]);
                        base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, sparks[sparks.Length - 1],
                                   sparks[sparks.Length - 1].ToString(), errorText, cellStyle, advancedBorderStyle, DataGridViewPaintParts.All);
                    }

                    using (Pen pen = new Pen(Color.Red))
                    {
                        float x0        = cellBounds.X + cellBounds.Width - RightPadding;
                        float xStepSize = ((cellBounds.Width - LeftPadding - RightPadding) / (float)AccessPoint.MaxDataPoints);

                        for (int i = sparks.Length - 1; i >= 0; i--)
                        {
                            float x = cellBounds.X + cellBounds.Width - RightPadding - (sparks.Length - i) * xStepSize;

                            // calculating Y value of each point... use range of -100 to -25 dBm
                            float y = cellBounds.Y + (-25f - sparks[i]) * ((float)cellBounds.Height / 75);

                            if (y < cellBounds.Y)
                            {
                                y = cellBounds.Y;
                            }
                            if (y > cellBounds.Y + cellBounds.Height - 1)
                            {
                                y = cellBounds.Y + cellBounds.Height - 1;
                            }

                            pen.Color = SignalColor.GetColorThreshold(sparks[i]);
                            graphics.DrawLine(pen, x0, y, x, y);

                            if (i == sparks.Length - 1)
                            {
                                // draw a dot at the last point to signify it is current..
                                pen.Color = Color.White;
                                graphics.DrawLine(pen, x0, y, x, y);
                            }

                            x0 = x;
                        }
                    }
                }
                else
                {
                    // let the base class draw the numeric contents
                    base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, null,
                               null, errorText, cellStyle, advancedBorderStyle, DataGridViewPaintParts.All);
                }
            }
            // paint the header row.
            else
            {
                base.Paint(graphics, clipBounds, cellBounds, rowIndex, cellState, value,
                           formattedValue, errorText, cellStyle, advancedBorderStyle, paintParts);
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Creates a new Signal, with the specified parameters
 /// </summary>
 /// <param name="color">The color of the signal</param>
 /// <param name="status">The current status of the Signal</param>
 /// <param name="pin">The pin used by this signal</param>
 public Signal(SignalColor color, bool status, int pin)
 {
     Color  = color;
     Status = status;
     Pin    = pin;
 }
Ejemplo n.º 5
0
        //public void SetLocalStartByte(CiStartId startID)
        //{
        //    SetStartByte(ID - startID.SignalStart);
        //}

        public void ResetDefaultStatus()
        {
            sColor_ = SignalColor.DSFail;
        }