aboutsummaryrefslogtreecommitdiff
path: root/Histacom2/OS/Win95/Win95Apps/WinClassicTimeDistorter.cs
diff options
context:
space:
mode:
authorlempamo <[email protected]>2017-08-23 13:38:40 -0400
committerlempamo <[email protected]>2017-08-23 13:38:40 -0400
commit3306d36ecbc024775972e5cf7971b2a7a70671d0 (patch)
tree0a79e67b6723a8c75ffd66c7828bdd0ebb1bf74d /Histacom2/OS/Win95/Win95Apps/WinClassicTimeDistorter.cs
parent99fef5c57360f07259fc86f433bed8a9ab59c48e (diff)
downloadhistacom2-3306d36ecbc024775972e5cf7971b2a7a70671d0.tar.gz
histacom2-3306d36ecbc024775972e5cf7971b2a7a70671d0.tar.bz2
histacom2-3306d36ecbc024775972e5cf7971b2a7a70671d0.zip
Renaming the game!
Diffstat (limited to 'Histacom2/OS/Win95/Win95Apps/WinClassicTimeDistorter.cs')
-rw-r--r--Histacom2/OS/Win95/Win95Apps/WinClassicTimeDistorter.cs55
1 files changed, 55 insertions, 0 deletions
diff --git a/Histacom2/OS/Win95/Win95Apps/WinClassicTimeDistorter.cs b/Histacom2/OS/Win95/Win95Apps/WinClassicTimeDistorter.cs
new file mode 100644
index 0000000..6d53e0e
--- /dev/null
+++ b/Histacom2/OS/Win95/Win95Apps/WinClassicTimeDistorter.cs
@@ -0,0 +1,55 @@
+using System;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using Histacom2.Engine;
+using Histacom2.Engine.Template;
+
+namespace Histacom2.OS.Win95
+{
+ public partial class WinClassicTimeDistorter : UserControl
+ {
+ private int _counter;
+ private Action _action;
+
+ public WinClassicTimeDistorter(string currentYear, string yearToTravel, int counter, Action action = null)
+ {
+ InitializeComponent();
+
+ btnGo.Paint += (sender, args) => Paintbrush.PaintClassicBorders(sender, args, 2);
+ lblYear.Text = currentYear;
+ lblDestYear.Text = yearToTravel;
+ _action = action;
+ _counter = counter;
+ }
+
+ public int Counter
+ {
+ get { return _counter; }
+ set { _counter = value; }
+ }
+
+ private void btnGo_Click(object sender, EventArgs e)
+ {
+ lblCountDown.Visible = true;
+ btnGo.Enabled = false;
+ ((WinClassic)ParentForm).closeDisabled = true;
+
+ _action?.Invoke();
+ 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();
+ }
+
+ lblCountDown.Text = $"Preparing to travel... ETA: {_counter.ToString()} seconds";
+ }
+ }
+}