aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/DesktopWidgets/HeartbeatWidget.cs
diff options
context:
space:
mode:
authorAShifter <[email protected]>2017-05-05 10:16:29 -0600
committerAShifter <[email protected]>2017-05-05 10:16:29 -0600
commita7fff72826ba12a9a87ad4edf38526174e330acb (patch)
tree2afba9246adeca69cffc98b77eb4183f680c6165 /ShiftOS.WinForms/DesktopWidgets/HeartbeatWidget.cs
parent13b35b32c2c429e6bd2d7b41ca43cc62f305dbc5 (diff)
parent9a2373ec42faeef719cff1c7076af87ef44179a7 (diff)
downloadshiftos_thereturn-a7fff72826ba12a9a87ad4edf38526174e330acb.tar.gz
shiftos_thereturn-a7fff72826ba12a9a87ad4edf38526174e330acb.tar.bz2
shiftos_thereturn-a7fff72826ba12a9a87ad4edf38526174e330acb.zip
Merge remote-tracking branch 'refs/remotes/shiftos-game/master'
Diffstat (limited to 'ShiftOS.WinForms/DesktopWidgets/HeartbeatWidget.cs')
-rw-r--r--ShiftOS.WinForms/DesktopWidgets/HeartbeatWidget.cs51
1 files changed, 51 insertions, 0 deletions
diff --git a/ShiftOS.WinForms/DesktopWidgets/HeartbeatWidget.cs b/ShiftOS.WinForms/DesktopWidgets/HeartbeatWidget.cs
new file mode 100644
index 0000000..d38cdc3
--- /dev/null
+++ b/ShiftOS.WinForms/DesktopWidgets/HeartbeatWidget.cs
@@ -0,0 +1,51 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Drawing;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using ShiftOS.WinForms.Tools;
+using ShiftOS.Engine;
+
+namespace ShiftOS.WinForms.DesktopWidgets
+{
+ [DesktopWidget("Server ping", "See the time spent between client requests and server replies in the digital society.")]
+ public partial class HeartbeatWidget : UserControl, IDesktopWidget
+ {
+ public HeartbeatWidget()
+ {
+ InitializeComponent();
+ tmr.Interval = 1;
+ tmr.Tick += (o, a) =>
+ {
+ if(ts != ServerManager.DigitalSocietyPing)
+ {
+ ts = ServerManager.DigitalSocietyPing;
+ lbheartbeat.Text = "Server ping: " + ts.ToString();
+ }
+ };
+ }
+
+ //Fun fact. I misspelled this as "TimeSpam."
+ TimeSpan ts;
+
+ public void OnSkinLoad()
+ {
+ ControlManager.SetupControls(this);
+ }
+
+ public void OnUpgrade()
+ {
+ }
+
+ Timer tmr = new Timer();
+
+ public void Setup()
+ {
+ tmr.Start();
+ }
+ }
+}