diff --git a/GPSDOTimeSync/FormMain.Designer.cs b/GPSDOTimeSync/FormMain.Designer.cs
index 32dc3e0..ef116d8 100644
--- a/GPSDOTimeSync/FormMain.Designer.cs
+++ b/GPSDOTimeSync/FormMain.Designer.cs
@@ -23,6 +23,7 @@
/// the contents of this method with the code editor.
///
private void InitializeComponent() {
+ this.components = new System.ComponentModel.Container();
this.statusStrip = new System.Windows.Forms.StatusStrip();
this.latestLogMessage = new System.Windows.Forms.ToolStripStatusLabel();
this.serialPortNames = new System.Windows.Forms.ComboBox();
@@ -31,6 +32,9 @@
this.stop = new System.Windows.Forms.Button();
this.deviceLabel = new System.Windows.Forms.Label();
this.deviceNames = new System.Windows.Forms.ComboBox();
+ this.currentTime = new System.Windows.Forms.Label();
+ this.currentDate = new System.Windows.Forms.Label();
+ this.timeAndDateDisplayUpdate = new System.Windows.Forms.Timer(this.components);
this.statusStrip.SuspendLayout();
this.SuspendLayout();
//
@@ -38,9 +42,9 @@
//
this.statusStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.latestLogMessage});
- this.statusStrip.Location = new System.Drawing.Point(0, 99);
+ this.statusStrip.Location = new System.Drawing.Point(0, 119);
this.statusStrip.Name = "statusStrip";
- this.statusStrip.Size = new System.Drawing.Size(224, 22);
+ this.statusStrip.Size = new System.Drawing.Size(534, 22);
this.statusStrip.SizingGrip = false;
this.statusStrip.TabIndex = 1;
this.statusStrip.Text = "statusStrip1";
@@ -49,7 +53,7 @@
//
this.latestLogMessage.ForeColor = System.Drawing.Color.Black;
this.latestLogMessage.Name = "latestLogMessage";
- this.latestLogMessage.Size = new System.Drawing.Size(178, 17);
+ this.latestLogMessage.Size = new System.Drawing.Size(519, 17);
this.latestLogMessage.Spring = true;
this.latestLogMessage.Text = "{RUNTIME}";
//
@@ -57,7 +61,7 @@
//
this.serialPortNames.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.serialPortNames.FormattingEnabled = true;
- this.serialPortNames.Location = new System.Drawing.Point(76, 39);
+ this.serialPortNames.Location = new System.Drawing.Point(139, 25);
this.serialPortNames.Name = "serialPortNames";
this.serialPortNames.Size = new System.Drawing.Size(121, 21);
this.serialPortNames.TabIndex = 2;
@@ -65,7 +69,7 @@
// serialPortNamesLabel
//
this.serialPortNamesLabel.AutoSize = true;
- this.serialPortNamesLabel.Location = new System.Drawing.Point(12, 42);
+ this.serialPortNamesLabel.Location = new System.Drawing.Point(136, 9);
this.serialPortNamesLabel.Name = "serialPortNamesLabel";
this.serialPortNamesLabel.Size = new System.Drawing.Size(55, 13);
this.serialPortNamesLabel.TabIndex = 3;
@@ -73,7 +77,7 @@
//
// start
//
- this.start.Location = new System.Drawing.Point(12, 66);
+ this.start.Location = new System.Drawing.Point(12, 52);
this.start.Name = "start";
this.start.Size = new System.Drawing.Size(75, 23);
this.start.TabIndex = 4;
@@ -84,7 +88,7 @@
// stop
//
this.stop.Enabled = false;
- this.stop.Location = new System.Drawing.Point(93, 66);
+ this.stop.Location = new System.Drawing.Point(93, 52);
this.stop.Name = "stop";
this.stop.Size = new System.Drawing.Size(75, 23);
this.stop.TabIndex = 5;
@@ -95,7 +99,7 @@
// deviceLabel
//
this.deviceLabel.AutoSize = true;
- this.deviceLabel.Location = new System.Drawing.Point(12, 15);
+ this.deviceLabel.Location = new System.Drawing.Point(9, 9);
this.deviceLabel.Name = "deviceLabel";
this.deviceLabel.Size = new System.Drawing.Size(41, 13);
this.deviceLabel.TabIndex = 6;
@@ -105,16 +109,47 @@
//
this.deviceNames.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.deviceNames.FormattingEnabled = true;
- this.deviceNames.Location = new System.Drawing.Point(76, 12);
+ this.deviceNames.Location = new System.Drawing.Point(12, 25);
this.deviceNames.Name = "deviceNames";
this.deviceNames.Size = new System.Drawing.Size(121, 21);
this.deviceNames.TabIndex = 7;
//
+ // currentTime
+ //
+ this.currentTime.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.currentTime.Font = new System.Drawing.Font("Microsoft Sans Serif", 30.25F);
+ this.currentTime.Location = new System.Drawing.Point(266, 9);
+ this.currentTime.Name = "currentTime";
+ this.currentTime.Size = new System.Drawing.Size(256, 50);
+ this.currentTime.TabIndex = 8;
+ this.currentTime.Text = "{RUNTIME}";
+ this.currentTime.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // currentDate
+ //
+ this.currentDate.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.currentDate.Font = new System.Drawing.Font("Microsoft Sans Serif", 30.25F);
+ this.currentDate.Location = new System.Drawing.Point(266, 59);
+ this.currentDate.Name = "currentDate";
+ this.currentDate.Size = new System.Drawing.Size(256, 50);
+ this.currentDate.TabIndex = 9;
+ this.currentDate.Text = "{RUNTIME}";
+ this.currentDate.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
+ //
+ // timeAndDateDisplayUpdate
+ //
+ this.timeAndDateDisplayUpdate.Interval = 50;
+ this.timeAndDateDisplayUpdate.Tick += new System.EventHandler(this.timeAndDateDisplayUpdate_Tick);
+ //
// FormMain
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(224, 121);
+ this.ClientSize = new System.Drawing.Size(534, 141);
+ this.Controls.Add(this.currentDate);
+ this.Controls.Add(this.currentTime);
this.Controls.Add(this.deviceNames);
this.Controls.Add(this.deviceLabel);
this.Controls.Add(this.stop);
@@ -122,6 +157,7 @@
this.Controls.Add(this.serialPortNamesLabel);
this.Controls.Add(this.serialPortNames);
this.Controls.Add(this.statusStrip);
+ this.MinimumSize = new System.Drawing.Size(550, 180);
this.Name = "FormMain";
this.Text = "GPSDO Time Sync";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FormMain_FormClosing);
@@ -141,6 +177,9 @@
private System.Windows.Forms.Button stop;
private System.Windows.Forms.Label deviceLabel;
private System.Windows.Forms.ComboBox deviceNames;
+ private System.Windows.Forms.Label currentTime;
+ private System.Windows.Forms.Label currentDate;
+ private System.Windows.Forms.Timer timeAndDateDisplayUpdate;
}
}
diff --git a/GPSDOTimeSync/FormMain.cs b/GPSDOTimeSync/FormMain.cs
index 6206f7a..799ceb3 100644
--- a/GPSDOTimeSync/FormMain.cs
+++ b/GPSDOTimeSync/FormMain.cs
@@ -46,6 +46,8 @@ namespace GPSDOTimeSync {
statusStrip.Renderer = new TruncatedTextEllipsisRenderer();
latestLogMessage.Text = "";
+
+ timeAndDateDisplayUpdate.Start();
}
private void PopulateDropDowns() {
@@ -80,12 +82,7 @@ namespace GPSDOTimeSync {
timeProvider.TimeAvailable += (DateTime dateTime) => {
Invoke(new Action(() => {
- AddMessageToLog(
- string.Format(
- "Time is {0} {1}",
- dateTime.ToLongDateString(), dateTime.ToLongTimeString()
- ), LogLevel.Info
- );
+
}));
};
@@ -115,6 +112,12 @@ namespace GPSDOTimeSync {
private void FormMain_FormClosing(object sender, FormClosingEventArgs e) {
timeProvider?.Stop();
}
+
+ private void timeAndDateDisplayUpdate_Tick(object sender, EventArgs e) {
+ DateTime systemTime = SystemTimeUtils.GetSystemTime();
+ currentTime.Text = systemTime.ToString("HH:mm:ss");
+ currentDate.Text = systemTime.ToString("dd\\/MM\\/yyyy");
+ }
}
public class TruncatedTextEllipsisRenderer : ToolStripProfessionalRenderer {
diff --git a/GPSDOTimeSync/FormMain.resx b/GPSDOTimeSync/FormMain.resx
index 422cca5..2440b27 100644
--- a/GPSDOTimeSync/FormMain.resx
+++ b/GPSDOTimeSync/FormMain.resx
@@ -120,4 +120,7 @@
17, 17
+
+ 126, 17
+
\ No newline at end of file