/// <summary> /// Открытие(закрытие) окна с цифровыми часами /// </summary> private void Button_Click(object sender, RoutedEventArgs e) { try { if (digital != null) { digital.Close(); digital = null; digitalClock.Content = "Digital Clock"; digitalClock.FontSize = 30; } else { digital = new DigitalClock(); digital.Show(); digitalClock.Content = "Close digital clock"; digitalClock.FontSize = 22; } } catch (Exception ex) { MessageBox.Show(ex.Message); } //digital.IsOpened = OpenCloseWindow(digital, digitalClock, "Digital Clock", "Close digital clock", digital.IsOpened); }
public void TimeChanges() { // Assert DigitalClock clock = new DigitalClock(); // Arrange String originalTime = clock.getLabelText(); System.Threading.Thread.Sleep(1100); String expectedTime = clock.getLabelText(); // Assert Assert.AreNotEqual(originalTime, expectedTime); }
public Form1() { InitializeComponent(); try { log.Info("Elements initialization was started."); graphics = clockPanel.CreateGraphics(); rectangle = clockPanel.DisplayRectangle; hrHand = rectangle.Height / 4; secHand = hrHand * 1.5; minHand = hrHand * 1.3; center = new Point(clockPanel.Width / 2, clockPanel.Height / 2); secondBox.Enabled = false; minuteBox.Enabled = false; hourBox.Enabled = false; digitalClock = new DigitalClock(); clockAdapter = new ClockAdapter(digitalClock); analogClock = new AnalogClock(); log.Info("The Clocks have been initialized successfuly."); Paint += new PaintEventHandler(DrawClock); timer = new Timer(); timer.Interval = 1000; timer.Tick += new EventHandler(TimerTick); timer.Start(); log.Info("Elements initialization was finished successfuly."); } catch (ArgumentNullException ex) { log.Error(ex.Message); log.Error(ex.StackTrace); } catch (Exception ex) { log.Error(ex.Message); log.Error(ex.StackTrace); } }