using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace LCDTest
{
    public partial class Form1 : Form
    {
        private int frame;
        private bool negovat;
        public Form1()
        {
            InitializeComponent();
            frame = 0;
            negovat = false;
        }

        private void button1_Click(object sender, EventArgs e)
        {
           

            lcd1.Sloupce = 11;
            lcd1.Radky = 11;

            lcd1.Nastaveni = new string[] {  "BBBBBBB   ",
                                           "B B B B   ",
                                           "B B B BBB ",
                                           "B B B B  B",
                                           "B B B B  B",
                                           "B B B B  B",
                                           "B B B B  B",
                                           "B B B B  B",
                                           "B B B BBB ",
                                           "B B B B   ",
                                           "BBBBBBB   " };
        }

        private void button2_Click(object sender, EventArgs e)
        {
            if (timer1.Enabled)
                timer1.Stop();
            else
                timer1.Start();

        }

        private void timer1_Tick(object sender, EventArgs e)
        {


            lcd1.Sloupce = 11;
            lcd1.Radky = 11;

            if (frame == 0)
            {
                lcd1.Nastaveni = new string[] { "BBBBBBBBBBB",
                                                "B         B",
                                                "B BB   BB B",
                                                "B BB   BB B",
                                                "B BB   BB B",
                                                "B         B",
                                                "B         B",
                                                "B         B",
                                                "B BBBBBBB B",
                                                "B         B",
                                                "BBBBBBBBBBB" };
                frame++;
            }
            else if (frame == 1)
            {
                lcd1.Nastaveni = new string[] { "BBBBBBBBBBB",
                                          "B         B",
                                          "B         B",
                                          "B BB   BB B",
                                          "B         B",
                                          "B         B",
                                          "B B     B B",
                                          "B  B   B  B",
                                          "B   BBB   B",
                                          "B         B",
                                          "BBBBBBBBBBB" };
                frame++;
            }
            else if (frame == 2)
            {
                lcd1.Nastaveni = new string[] { "BBBBBBBBBBB",
                                          "B         B",
                                          "B BB   BB B",
                                          "B BB   BB B",
                                          "B BB   BB B",
                                          "B         B",
                                          "B  BBBBB  B",
                                          "B B     B B",
                                          "B  BBBBB  B",
                                          "B         B",
                                          "BBBBBBBBBBB" };
                            frame++;
            }
            else if (frame == 3)
            {
                lcd1.Nastaveni = new string[] { "BBBBBBBBBBB",
                                          "B         B",
                                          "B BB   BB B",
                                          "B BB   BB B",
                                          "B BB   BB B",
                                          "B         B",
                                          "B         B",
                                          "B B B B B B",
                                          "B  B B B  B",
                                          "B         B",
                                          "BBBBBBBBBBB" };

                frame = 0;
            }
        }

        private void timer2_Tick(object sender, EventArgs e)
        {
            if (negovat)
            {
                lcd2.Zobrazeni = LCD.LCD.zobrazeni.Dacan;
                negovat = false;
            }
            else
            {
                lcd2.Zobrazeni = LCD.LCD.zobrazeni.DacanII;
                negovat = true;
            }
        }

        private void lcd1_Resize(object sender, EventArgs e)
        {
            Point lokace = new Point(panel1.Width / 2 - lcd1.Width / 2, panel1.Height / 2 - lcd1.Height / 2);
            lcd1.Location = lokace;
        }

        private void Form1_Resize(object sender, EventArgs e)
        {
            Point lokace = new Point(panel1.Width / 2 - lcd1.Width / 2, panel1.Height / 2 - lcd1.Height / 2);
            lcd1.Location = lokace;
            lokace.X = panel3.Width / 2 - lcd2.Width / 2;
            lokace.Y = panel3.Height / 2 - lcd2.Height / 2;
            lcd2.Location = lokace;
        }
    }
}
