Exemplo n.º 1
0
 private void timer1_Tick(object sender, EventArgs e)
 {
     if (time <= 0)
     {
         timer1.Stop();
         label1.Visible   = false;
         textBox1.Visible = true;
         button1.Enabled  = true;
         button2.Enabled  = false;
         textBox1.Text    = time.ToString();
         if (radioButton1.Checked)
         {
             Application.SetSuspendState(PowerState.Suspend, true, true);
         }
         if (radioButton2.Checked)
         {
             reboot end = new reboot();
             end.halt(false, true);
         }
         if (radioButton3.Checked)
         {
             reboot end = new reboot();
             end.halt(true, true);
         }
     }
     else
     {
         label1.Text = (--time).ToString();
         label1.Left = label2.Left - label1.Width;
     }
 }
Exemplo n.º 2
0
        private void metroButton3_Click(object sender, EventArgs e)
        {
            DialogResult r = DialogResult.Cancel;

            if (Properties.Settings.Default.LANG == "BE")
            {
                r = MessageBox.Show("Вы сапраўды хочаце датэрмінова завяршыць працу ? Час будзе захаваны. Не забудзьцеся захаваць файл з заданнем! Камбінацыя клавіш на клавіятуры: (CTRL+S)", "CAVA", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk);
            }
            else if (Properties.Settings.Default.LANG == "RU")
            {
                r = MessageBox.Show("Вы действительно хотите досрочно завершить работу ? Время будет сохранено. Не забудьте сохранить файл с заданием! Комбинация клавиш на клавиатуре: (CTRL+S)", "CAVA", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk);
            }
            else
            {
                r = MessageBox.Show("Do you really want to finish the job ahead of schedule? The time will be saved. Do not forget to save the file with the task! The key combination on the keyboard: (CTRL + S) ", " CAVA ", MessageBoxButtons.YesNo, MessageBoxIcon.Asterisk);
            }
            if (r == DialogResult.Yes)
            {
                try
                {
                    accDataGridView.Rows[Properties.Settings.Default.AccRow].Cells[7].Value = 0;
                    accBindingSource.EndEdit();

                    accDataGridView.Rows[Properties.Settings.Default.AccRow].Cells[2].Value = tim;
                    accBindingSource.EndEdit();

                    Application.Exit();
                    reboot r1 = new reboot();
                    r1.halt(true, true);
                    timer2.Stop();
                }
                catch (Exception ex)
                {
                    if (Properties.Settings.Default.LANG == "BE")
                    {
                        MessageBox.Show("Інфармацыя пра заданне не захавана, выхад адменены. Error: " + ex.Message, "CAVA", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                    else if (Properties.Settings.Default.LANG == "RU")
                    {
                        MessageBox.Show("Информация о задании не сохранена, выход отменён. Error: " + ex.Message, "CAVA", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                    else
                    {
                        MessageBox.Show("The job information was not saved, the output was canceled. Error: " + ex.Message, "CAVA", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                    }
                }
            }
        }
Exemplo n.º 3
0
        private void timer2_Tick(object sender, EventArgs e)
        {
            try
            {
                accDataGridView.Rows[Properties.Settings.Default.AccRow].Cells[2].Value = tim;
                accBindingSource.EndEdit();

                teacherDataGridView.CurrentCell = teacherDataGridView[0, Properties.Settings.Default.RT];
                subDataGridView.CurrentCell     = subDataGridView[0, Properties.Settings.Default.RS];
                clasDataGridView.CurrentCell    = clasDataGridView[0, Properties.Settings.Default.RC];
                pupilDataGridView.CurrentCell   = pupilDataGridView[0, Properties.Settings.Default.RP];
                accDataGridView.CurrentCell     = accDataGridView[0, Properties.Settings.Default.AccRow];

                if (tim < 0)
                {
                    try
                    {
                        accDataGridView.Rows[Properties.Settings.Default.AccRow].Cells[7].Value = 0;
                        accBindingSource.EndEdit();

                        accDataGridView.Rows[Properties.Settings.Default.AccRow].Cells[2].Value = tim;
                        accBindingSource.EndEdit();

                        reboot r1 = new reboot();
                        r1.halt(true, true);
                        timer2.Stop();
                    }
                    catch (Exception ex)
                    {
                        if (Properties.Settings.Default.LANG == "BE")
                        {
                            MessageBox.Show("Інфармацыя пра заданне не захавана, выхад адменены. Error: " + ex.Message, "CAVA", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        }
                        else if (Properties.Settings.Default.LANG == "RU")
                        {
                            MessageBox.Show("Информация о задании не сохранена, выход отменён. Error: " + ex.Message, "CAVA", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        }
                        else
                        {
                            MessageBox.Show("The job information was not saved, the output was canceled. Error: " + ex.Message, "CAVA", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        }
                    }
                }
                if (tim == 0 && s == 0)
                {
                    try
                    {
                        accDataGridView.Rows[Properties.Settings.Default.AccRow].Cells[7].Value = 0;
                        accBindingSource.EndEdit();

                        accDataGridView.Rows[Properties.Settings.Default.AccRow].Cells[2].Value = tim;
                        accBindingSource.EndEdit();

                        reboot r1 = new reboot();
                        r1.halt(true, true);
                        timer2.Stop();
                    }
                    catch (Exception ex)
                    {
                        if (Properties.Settings.Default.LANG == "BE")
                        {
                            MessageBox.Show("Інфармацыя пра заданне не захавана, выхад адменены. Error: " + ex.Message, "CAVA", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        }
                        else if (Properties.Settings.Default.LANG == "RU")
                        {
                            MessageBox.Show("Информация о задании не сохранена, выход отменён. Error: " + ex.Message, "CAVA", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        }
                        else
                        {
                            MessageBox.Show("The job information was not saved, the output was canceled. Error: " + ex.Message, "CAVA", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                        }
                    }
                }
                else
                {
                    bar--;
                    barP    = ((bar - 1) * 100) / barconst;
                    barPint = Convert.ToInt32(Math.Round(barP));
                    //Prog.Size = new Size(20, Convert.ToInt32(Math.Round(Convert.ToDouble((340 * barPint) / 100))));
                    Prog.Location = new Point(0, 350 - Convert.ToInt32(Math.Round(Convert.ToDouble((340 * barPint) / 100))));

                    Properties.Settings.Default.tim = tim;
                    Properties.Settings.Default.s   = s;
                    Properties.Settings.Default.ifo = 1;
                    Properties.Settings.Default.Save();
                    if (s == 0)
                    {
                        s = s + 59;
                        if (Properties.Settings.Default.LANG == "RU")
                        {
                            labelTimeO2.Text = s.ToString() + " Сек";
                            tim--;
                            labelTimeO.Text = tim.ToString() + " Мин";
                        }
                        else if (Properties.Settings.Default.LANG == "BE")
                        {
                            labelTimeO2.Text = s.ToString() + " Сек";
                            tim--;
                            labelTimeO.Text = tim.ToString() + " Мін";
                        }
                        else
                        {
                            labelTimeO2.Text = s.ToString() + " Sec";
                            tim--;
                            labelTimeO.Text = tim.ToString() + " Min";
                        }
                    }
                    else
                    {
                        s--;
                        if ((Properties.Settings.Default.LANG == "RU") || (Properties.Settings.Default.LANG == "BE"))
                        {
                            labelTimeO2.Text = s.ToString() + " Сек";
                        }
                        else
                        {
                            labelTimeO2.Text = s.ToString() + " Sec";
                        }
                    }
                    if (tim == 15 && a == 0 && s == 0)
                    {
                        SoundPlayer sp = new SoundPlayer(Application.StartupPath + @"\15.wav");
                        sp.Play();
                        if (Properties.Settings.Default.LANG == "BE")
                        {
                            notifyIcon1.BalloonTipText = "Да завяршэння працы засталося хвілін: 15";
                        }
                        else if (Properties.Settings.Default.LANG == "RU")
                        {
                            notifyIcon1.BalloonTipText = "До завершения работы осталось минут: 15";
                        }
                        else
                        {
                            notifyIcon1.BalloonTipText = "Minutes left before the end: 15";
                        }
                        notifyIcon1.ShowBalloonTip(15);
                        a++;
                    }
                    if (tim == 10 && b == 0 && s == 0)
                    {
                        SoundPlayer sp = new SoundPlayer(Application.StartupPath + @"\10.wav");
                        sp.Play();
                        if (Properties.Settings.Default.LANG == "BE")
                        {
                            notifyIcon1.BalloonTipText = "Да завяршэння працы засталося хвілін: 10";
                        }
                        else if (Properties.Settings.Default.LANG == "RU")
                        {
                            notifyIcon1.BalloonTipText = "До завершения работы осталось минут: 10";
                        }

                        else
                        {
                            notifyIcon1.BalloonTipText = "Minutes left before the end: 10";
                        }
                        notifyIcon1.ShowBalloonTip(10);
                        b++;
                    }
                    if (tim == 5 && c == 0 && s == 0)
                    {
                        SoundPlayer sp = new SoundPlayer(Application.StartupPath + @"\5.wav");
                        sp.Play();
                        if (Properties.Settings.Default.LANG == "BE")
                        {
                            notifyIcon1.BalloonTipText = "Да завяршэння працы засталося хвілін: 5";
                        }
                        else if (Properties.Settings.Default.LANG == "RU")
                        {
                            notifyIcon1.BalloonTipText = "До завершения работы осталось минут: 5";
                        }
                        else
                        {
                            notifyIcon1.BalloonTipText = "Minutes left before the end: 5";
                        }
                        notifyIcon1.ShowBalloonTip(5);
                        c++;
                    }
                    if (tim == 1 && d == 0 && s == 0)
                    {
                        SoundPlayer sp = new SoundPlayer(Application.StartupPath + @"\1.wav");
                        sp.Play();
                        if (Properties.Settings.Default.LANG == "BE")
                        {
                            notifyIcon1.BalloonTipText = "Да завяршэння працы засталося хвілін: 1";
                        }
                        else if (Properties.Settings.Default.LANG == "RU")
                        {
                            notifyIcon1.BalloonTipText = "До завершения работы осталось минут: 1";
                        }
                        else
                        {
                            notifyIcon1.BalloonTipText = "Minutes left before the end: 1";
                        }
                        notifyIcon1.ShowBalloonTip(5);
                        d++;
                    }
                }
            }
            catch
            {
            }
        }