Beispiel #1
0
        public LEDS(LEDSimulationForm form)
        {
            this.form = form;
            this.leds = new LED[LED_COUNT];

            form.Load += this.form_Ready;

            int x = SPACE_ROUND_LED / 2;
            int y = SPACE_ROUND_LED / 2;

            bool goingUp = true;

            for (int i = 0; i < ROW_COUNT; i++)
            {
                for (int j = 0; j < LED_PER_ROW; j++)
                {
                    this.leds[i * LED_PER_ROW + j].color    = Color.Red;
                    this.leds[i * LED_PER_ROW + j].position = new Point(x, y);

                    if (goingUp)
                    {
                        x += DRAW_STEP;
                    }
                    else
                    {
                        x -= DRAW_STEP;
                    }
                }
                goingUp = !goingUp;
                y      += DRAW_STEP;
                x      -= DRAW_STEP;
            }
        }
 public void Close()
 {
     if (this.form != null)
     {
         this.form.Close();
         this.form.Dispose();
         this.form = null;
     }
 }
        public bool Open()
        {
            if (this.form == null)
            {
                LEDS.SetFormSize = false;
                this.form        = new LEDSimulationForm()
                {
                    StartPosition = System.Windows.Forms.FormStartPosition.Manual,
                    Location      = new Point(1920 - 100 - WIDTH, 1080 - 100 + 4),
                    TopMost       = true,
                    Width         = WIDTH,
                    Height        = HEIGHT
                };
                new Thread(() => { this.form.ShowDialog(); }).Start();

                this.leds = new LEDS(this.form);
            }
            return(true);
        }