Ejemplo n.º 1
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            TimerTwo.Start();

            btOne.Visible   = false;
            btStart.Visible = false;

            tbName.Visible = false;

            lb1.Visible            = false;
            lb2.Visible            = false;
            lb3.Visible            = false;
            lbCountP.Visible       = false;
            lbCountT.Visible       = false;
            lbMoviment.Visible     = false;
            lbStartMessage.Visible = false;

            pbMain.Visible    = false;
            pbTwo.Visible     = false;
            pbTrigger.Visible = false;

            x = ((pnMain.Size.Width - lbMoviment.Size.Width) / 2) + pbMain.Size.Width;
            y = (pnMain.Size.Height / 2);
            lbMoviment.Location = new Point(x, y);

            x = (pnMain.Size.Width - pbMain.Size.Width) / 2;
            y = (pnMain.Size.Height - pbMain.Height) / 2;
            pbMain.Location = new Point(x, y);

            pbTrigger.Width  = 150;
            pbTrigger.Height = 140;
            x = (pnMain.Size.Width - 20) / 10;
            y = (pnMain.Size.Height) - (pbTrigger.Size.Width) - 20;
            pbTrigger.Location = new Point(x, y);
        }
Ejemplo n.º 2
0
        private void TimerTwo_Tick(object sender, EventArgs e)
        {
            lbStartMessage.Visible = true;
            if (countInitial == 0)
            {
                lbStartMessage.Text = "Bem vindo ao experimento!!";
                x = (pnMain.Size.Width - lbStartMessage.Width) / 2;
                y = (pnMain.Size.Height - lbStartMessage.Height) / 2;
                lbStartMessage.Location = new Point(x, y);
            }

            if (countInitial == 1)
            {
                pbTwo.Visible  = true;
                pbTwo.Width    = 964;
                pbTwo.Height   = 649;
                x              = (pnMain.Size.Width - pbTwo.Width) / 2;
                y              = (pnMain.Size.Height - pbTwo.Height) / 2;
                pbTwo.Location = new Point(x, y);

                pbTwo.Image            = img8;
                lbStartMessage.Visible = false;
                btOne.Visible          = true;
                btOne.Width            = 180;
                btOne.Height           = 45;
                x = (pnMain.Size.Width - btOne.Width) / 2;
                y = (pnMain.Size.Height + pbTwo.Height) / 2;
                btOne.Location = new Point(x, y);
                TimerTwo.Stop();
            }
            countInitial++;
        }
        static void Main(string[] args)
        {
            Timer.TimerOne timer = new Timer.TimerOne(2);
            Console.WriteLine($"Новый таймер! {timer.GetType()}");
            Console.WriteLine("Время таймера:" + timer.Time);
            listener listener1 = new listener();

            timer.timerElapsed += listener1.MethodToInvoke;
            Console.WriteLine("Отсчёт пошёл!");
            timer.Start();

            Timer.TimerTwo timer2 = new TimerTwo(5);
            Console.WriteLine($"\nНовый таймер! {timer2.GetType()}");
            Console.WriteLine("Время таймера:" + timer2.Time);
            timer2.timerTick    += listener1.MethodToInvoke;
            timer2.timerElapsed += listener1.MethodToInvoke;
            Console.WriteLine("Отсчёт пошёл!");
            timer2.Start();
        }