Exemplo n.º 1
0
 public SuperClock(int x, int y, int z, DateTime date, TimeCounters counters)
 {
     this.SecondsInMinute = x;
     this.MinutsInHour    = y;
     this.HoursInDay      = z;
     this.counters        = counters;
     this.date            = date;
 }
Exemplo n.º 2
0
 private void Execute(Timer timer, TimeCounters counters, IClocks clocks)
 {
     timer.Stop();
     counters.Hours         = 0;
     counters.Minuts        = 0;
     counters.Seconds       = 0;
     clocks.HoursInDay      = 24;
     clocks.MinutsInHour    = 60;
     clocks.SecondsInMinute = 60;
     clocks.date            = new DateTime(0, 0, 0, 0, 0, 0);
 }
Exemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            double koef = 1;

            if (textBox1.Text != null)
            {
                try { koef = 1 / Convert.ToDouble(textBox1.Text); }
                catch
                {
                    MessageBox.Show("Пожалуйста укажите число в коэффициенте ускорялки (дробные числа указывайте через запятую)");
                }
            }
            Dictionary <int, string> months = new Dictionary <int, string>(12);

            months.Add(1, "Января");
            months.Add(2, "Февраля");
            months.Add(3, "Марта");
            months.Add(4, "Апреля");
            months.Add(5, "Мая");
            months.Add(6, "Июня");
            months.Add(7, "Июля");
            months.Add(8, "Августа");
            months.Add(9, "Сентября");
            months.Add(10, "Октября");
            months.Add(11, "Ноября");
            months.Add(12, "Декабря");
            TimeCounters counters     = new TimeCounters(dateTimePicker2.Value.Hour, dateTimePicker2.Value.Minute, dateTimePicker2.Value.Second);
            SuperClock   superClock36 = new SuperClock(60, 60, 36, dateTimePicker1.Value, counters);

            timer          = new Timer();
            timer.Interval = Convert.ToInt32(1000 * koef);
            timer.Enabled  = true;
            timer.Tick    += (x, y) => { TimerTick(superClock36, months); };
            timer.Start();
            button1.Enabled = false;
        }