aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Frontend/Desktop/Desktop.cs
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-07-06 18:25:19 -0400
committerMichael <[email protected]>2017-07-06 18:25:19 -0400
commitca339b2661ee565d55191d58ed40c2303f77c0b4 (patch)
tree0554a0f3f1a4b08bf89a49001a89b37af3fa3e8d /ShiftOS.Frontend/Desktop/Desktop.cs
parent38774ba7930f9d6fa2111c8b71f1056125ab75b5 (diff)
downloadshiftos_thereturn-ca339b2661ee565d55191d58ed40c2303f77c0b4.tar.gz
shiftos_thereturn-ca339b2661ee565d55191d58ed40c2303f77c0b4.tar.bz2
shiftos_thereturn-ca339b2661ee565d55191d58ed40c2303f77c0b4.zip
HEAVILY optimize the game
Diffstat (limited to 'ShiftOS.Frontend/Desktop/Desktop.cs')
-rw-r--r--ShiftOS.Frontend/Desktop/Desktop.cs14
1 files changed, 11 insertions, 3 deletions
diff --git a/ShiftOS.Frontend/Desktop/Desktop.cs b/ShiftOS.Frontend/Desktop/Desktop.cs
index af79c9c..46baf7f 100644
--- a/ShiftOS.Frontend/Desktop/Desktop.cs
+++ b/ShiftOS.Frontend/Desktop/Desktop.cs
@@ -110,6 +110,8 @@ namespace ShiftOS.Frontend.Desktop
{
}
+ private string dateTimeString = "";
+
protected override void OnLayout()
{
SendToBack();
@@ -117,7 +119,14 @@ namespace ShiftOS.Frontend.Desktop
Y = 0;
Width = GetSize().Width;
Height = GetSize().Height;
- Invalidate();
+ var now = DateTime.Now.TimeOfDay;
+ var newDateTimeString = $"{now.Hours}:{now.Minutes}:{now.Seconds}";
+ if(newDateTimeString != dateTimeString)
+ {
+ dateTimeString = newDateTimeString;
+ Invalidate();
+ }
+
}
private List<PanelButtonData> PanelButtons = new List<PanelButtonData>();
@@ -158,8 +167,7 @@ namespace ShiftOS.Frontend.Desktop
var panelClockRight = LoadedSkin.DesktopPanelClockFromRight;
var panelClockTextColor = LoadedSkin.DesktopPanelClockColor.ToMonoColor();
- var dateTimeString = DateTime.Now.TimeOfDay.ToString();
-
+
var measure = gfx.MeasureString(dateTimeString, LoadedSkin.DesktopPanelClockFont);
int panelclockleft = Width - (int)measure.X;