Example #1
0
        public ColorForm(ColorMeter c)
        {
            InitializeComponent();

            tester t = new tester();
            _colorMeter = c;
            _colorMeter.sendData += _colorMeter_sendData;

            colorDataGridView.CellBeginEdit += ColorDataGridView_CellBeginEdit;
            colorDataGridView.CellEndEdit += ColorDataGridView_CellEndEdit;

            _gridData = new ColorGridData(AddRow(true));
        }
        public void ColorTest()
        {
            ColorMeter c = new ColorMeter("COM3", "X");

            //Assert(true);
        }
Example #3
0
        /*
        private void Color_sendData(ColorReader sender, EventArgs e)
        {

        }
        */
        private void _colorMeter_sendData(ColorMeter sender, EventArgs e)
        {
            MessageBox.Show("L: " + sender.L + "\n"
                            + "a: " + sender.a +
                            "b: " + sender.b);

            int startCol;
            int startRow = colorDataGridView.SelectedCells[0].RowIndex;
            int val = colorDataGridView.SelectedCells[0].ColumnIndex;

            if( val < 3)
            {
                startCol = 4;
            }
            else if( val < 6)
            {
                startCol = 7;
            }
            else if( val < 9)
            {
                startCol = 11;
            }
            else
            {
                _gridData.ColorGridAddRow(AddRow());
                startRow++;
                startCol = 4;
            }

            colorDataGridView.Rows[startRow].Cells[startCol].Value = sender.L;
            colorDataGridView.Rows[startRow].Cells[startCol + 1].Value = sender.a;
            colorDataGridView.Rows[startRow].Cells[startCol + 2].Value = sender.b;

            CalculateAverage(startRow);
        }
Example #4
0
        private void colorMeterToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if(Balance != null)
            {
                Balance.Dispose();
                Balance = null;
            }

            using (var meter = new ColorMeter(Settings.Default.ColorCOMPort))
            {
                ColorForm c = new ColorForm(meter);
                c.Show();
            }
        }