aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.WinForms/WinformsDesktop.cs
diff options
context:
space:
mode:
authorMichael <[email protected]>2017-04-22 17:10:15 -0400
committerMichael <[email protected]>2017-04-22 17:10:15 -0400
commit40fc14a237f0bbe3e5237e5ce0806f46ecf0f56e (patch)
tree581143fe22e90708396a92afee52ac439a82eaba /ShiftOS.WinForms/WinformsDesktop.cs
parentc718fbb5654c77ae521f42fb9e42efb1a79992a9 (diff)
downloadshiftos_thereturn-40fc14a237f0bbe3e5237e5ce0806f46ecf0f56e.tar.gz
shiftos_thereturn-40fc14a237f0bbe3e5237e5ce0806f46ecf0f56e.tar.bz2
shiftos_thereturn-40fc14a237f0bbe3e5237e5ce0806f46ecf0f56e.zip
Add Widget Manager UI
You can now toggle visibility of widgets.
Diffstat (limited to 'ShiftOS.WinForms/WinformsDesktop.cs')
-rw-r--r--ShiftOS.WinForms/WinformsDesktop.cs15
1 files changed, 12 insertions, 3 deletions
diff --git a/ShiftOS.WinForms/WinformsDesktop.cs b/ShiftOS.WinForms/WinformsDesktop.cs
index 61c371e..c5e3efe 100644
--- a/ShiftOS.WinForms/WinformsDesktop.cs
+++ b/ShiftOS.WinForms/WinformsDesktop.cs
@@ -455,21 +455,28 @@ namespace ShiftOS.WinForms
{
UserControl w = (UserControl)Activator.CreateInstance(widget.Value, null);
- w.Location = WidgetManager.LoadLocation(w.GetType());
+ w.Location = WidgetManager.LoadDetails(w.GetType()).Location;
pnlwidgetlayer.Controls.Add(w);
MakeWidgetMovable(w);
Widgets.Add(w as IDesktopWidget);
}
}
+ int lastHeight = 5;
foreach (var widget in Widgets)
{
- if (Shiftorium.UpgradeInstalled("desktop_widgets"))
+ if (WidgetManager.LoadDetails(widget.GetType()).IsVisible && Shiftorium.UpgradeInstalled("desktop_widgets"))
{
widget.OnSkinLoad();
+
widget.OnUpgrade();
widget.Setup();
widget.Show();
+ if (widget.Location.X == -1 && widget.Location.Y == -1)
+ {
+ widget.Location = new Point(5, lastHeight);
+ lastHeight += (widget.Location.Y + widget.Size.Height) + 5;
+ }
}
else
{
@@ -525,7 +532,9 @@ namespace ShiftOS.WinForms
w.MouseUp += (o, a) =>
{
moving = false;
- WidgetManager.SaveLocation(startCtrl.GetType(), startCtrl.Location);
+ var details = WidgetManager.LoadDetails(startCtrl.GetType());
+ details.Location = startCtrl.Location;
+ WidgetManager.SaveDetails(startCtrl.GetType(), details);
};
foreach (Control c in w.Controls)