Пример #1
0
 private void InitLEDArray()
 {
     for (int i = 0; i < 100; i++)
     {
         ledArray[i] = new LED {
             redValue = 0, greenValue = 0, blueValue = 0
         };
     }
 }
Пример #2
0
        private void ResetArray()
        {
            byte r = ((Color)newColor.GetValue(SolidColorBrush.ColorProperty)).R;
            byte g = ((Color)newColor.GetValue(SolidColorBrush.ColorProperty)).G;
            byte b = ((Color)newColor.GetValue(SolidColorBrush.ColorProperty)).B;

            for (int i = 0; i < 100; i++)
            {
                ledArray[i] = new LED {
                    redValue = r, greenValue = g, blueValue = b
                };
            }
        }
Пример #3
0
        private void Grid_MouseDown(object sender, MouseButtonEventArgs e)
        {
            Grid thisGrid = (Grid)sender;

            thisGrid.Background = newColor;

            int   thisPosition = int.Parse(thisGrid.Name.Substring(8, 2));
            Brush thisBrush    = grdSwatch.Background;

            byte r = ((Color)thisBrush.GetValue(SolidColorBrush.ColorProperty)).R;
            byte g = ((Color)thisBrush.GetValue(SolidColorBrush.ColorProperty)).G;
            byte b = ((Color)thisBrush.GetValue(SolidColorBrush.ColorProperty)).B;

            LED thisLED = new LED {
                redValue = (int)r, greenValue = (int)g, blueValue = (int)b, position = thisPosition
            };

            ledArray[thisPosition] = thisLED;
        }