Time Of Day text

This commit is contained in:
Alkaline Thunder 2018-12-28 00:18:56 -05:00
parent 8debadb818
commit 44f8184edc
4 changed files with 45 additions and 2 deletions

View file

@ -28,12 +28,17 @@
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
this.DesktopPanel = new System.Windows.Forms.Panel();
this.CurrentTime = new System.Windows.Forms.Label();
this.UpdateTimer = new System.Windows.Forms.Timer(this.components);
this.DesktopPanel.SuspendLayout();
this.SuspendLayout();
//
// DesktopPanel
//
this.DesktopPanel.BackColor = System.Drawing.Color.Gray;
this.DesktopPanel.Controls.Add(this.CurrentTime);
this.DesktopPanel.Dock = System.Windows.Forms.DockStyle.Top;
this.DesktopPanel.ForeColor = System.Drawing.Color.Black;
this.DesktopPanel.Location = new System.Drawing.Point(0, 0);
@ -41,6 +46,23 @@
this.DesktopPanel.Size = new System.Drawing.Size(800, 24);
this.DesktopPanel.TabIndex = 0;
//
// CurrentTime
//
this.CurrentTime.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.CurrentTime.AutoSize = true;
this.CurrentTime.Font = new System.Drawing.Font("Microsoft Sans Serif", 11F, System.Drawing.FontStyle.Bold);
this.CurrentTime.Location = new System.Drawing.Point(698, 4);
this.CurrentTime.Name = "CurrentTime";
this.CurrentTime.Size = new System.Drawing.Size(101, 18);
this.CurrentTime.TabIndex = 0;
this.CurrentTime.Text = "12:00:00 AM";
//
// UpdateTimer
//
this.UpdateTimer.Enabled = true;
this.UpdateTimer.Interval = 50;
this.UpdateTimer.Tick += new System.EventHandler(this.UpdateTimer_Tick);
//
// Desktop
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -55,6 +77,8 @@
this.Text = "Form1";
this.TransparencyKey = System.Drawing.Color.FromArgb(((int)(((byte)(1)))), ((int)(((byte)(0)))), ((int)(((byte)(1)))));
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.DesktopPanel.ResumeLayout(false);
this.DesktopPanel.PerformLayout();
this.ResumeLayout(false);
}
@ -62,6 +86,8 @@
#endregion
private System.Windows.Forms.Panel DesktopPanel;
private System.Windows.Forms.Label CurrentTime;
private System.Windows.Forms.Timer UpdateTimer;
}
}

View file

@ -12,9 +12,17 @@ namespace ShiftOS
{
public partial class Desktop : Form
{
public Desktop()
private SystemContext CurrentSystem = null;
public Desktop(SystemContext InSystem)
{
this.CurrentSystem = InSystem;
InitializeComponent();
}
private void UpdateTimer_Tick(object sender, EventArgs e)
{
this.CurrentTime.Text = CurrentSystem.GetTimeOfDay();
}
}
}

View file

@ -117,4 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="UpdateTimer.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View file

@ -26,11 +26,17 @@ namespace ShiftOS
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
using (_desktop = new Desktop())
using (_desktop = new Desktop(this))
{
// Run Windows Forms.
Application.Run(_desktop);
}
}
public string GetTimeOfDay()
{
// TODO: Shiftorium time upgrades.
return DateTime.Now.ToShortTimeString();
}
}
}