From 4b44847216ac4b498d088c11db5f928cc037d605 Mon Sep 17 00:00:00 2001 From: JayXKanz666 Date: Thu, 6 Jul 2017 18:31:20 +0200 Subject: Added Time distorter Look at the source if you want to know more *wink* --- .../OS/Win95/Win95Apps/WinClassicTimeDistorter.cs | 47 ++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 TimeHACK.Main/OS/Win95/Win95Apps/WinClassicTimeDistorter.cs (limited to 'TimeHACK.Main/OS/Win95/Win95Apps/WinClassicTimeDistorter.cs') diff --git a/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicTimeDistorter.cs b/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicTimeDistorter.cs new file mode 100644 index 0000000..b0542ba --- /dev/null +++ b/TimeHACK.Main/OS/Win95/Win95Apps/WinClassicTimeDistorter.cs @@ -0,0 +1,47 @@ +using System; +using System.Windows.Forms; +using TimeHACK.Engine; +using TimeHACK.Engine.Template; + +namespace TimeHACK.OS.Win95 +{ + public partial class WinClassicTimeDistorter : UserControl + { + private int _counter; + private Form _action; + + public WinClassicTimeDistorter(string currentYear, string yearToTravel, int counter, Form action = null) + { + InitializeComponent(); + + btnGo.Paint += (sender, args) => Paintbrush.PaintClassicBorders(sender, args, 2); + lblYear.Text = currentYear; + lblDestYear.Text = yearToTravel; + _action = action; + _counter = counter; + } + + private void btnGo_Click(object sender, EventArgs e) + { + lblCountDown.Visible = true; + btnGo.Enabled = false; + countDownTimer.Start(); + + lblCountDown.Text = $"Preparing to travel... ETA: {_counter.ToString()} seconds"; + } + + private void countDownTimer_Tick(object sender, EventArgs e) + { + _counter--; + + if (_counter == 0) + { + countDownTimer.Stop(); + + if (_action != null) + _action.ShowDialog(); + } + lblCountDown.Text = $"Preparing to travel... ETA: {_counter.ToString()} seconds"; + } + } +} -- cgit v1.2.3