2017-09-24 19:56:11 +00:00
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Windows.Forms;
|
2017-09-24 21:55:03 +00:00
|
|
|
|
using static ShiftOS.Engine.WindowManager.InfoboxTemplate;
|
2017-09-24 18:32:50 +00:00
|
|
|
|
|
|
|
|
|
namespace ShiftOS.Engine.WindowManager
|
|
|
|
|
{
|
|
|
|
|
public class ShiftWM
|
|
|
|
|
{
|
2017-09-24 19:56:11 +00:00
|
|
|
|
public ShiftWindow Init(UserControl content, string title, Image icon, bool ShowAsInfobox = false, bool resize = true)
|
2017-09-24 18:32:50 +00:00
|
|
|
|
{
|
|
|
|
|
// Setup Window
|
|
|
|
|
ShiftWindow app = new ShiftWindow();
|
|
|
|
|
app.Text = title;
|
|
|
|
|
app.Title.Text = title;
|
|
|
|
|
app.Width = content.Width + app.left.Width + app.right.Width;
|
|
|
|
|
app.Height = content.Height + app.bottom.Height + app.top.Height;
|
|
|
|
|
|
2017-09-24 19:56:11 +00:00
|
|
|
|
// Icon Setup
|
2017-09-24 18:32:50 +00:00
|
|
|
|
if (icon == null)
|
|
|
|
|
{
|
|
|
|
|
app.programIcon.Hide();
|
2017-09-24 19:56:11 +00:00
|
|
|
|
app.programIcon.Image = Properties.Resources.nullIcon;
|
|
|
|
|
app.Title.Location = new Point(2, 7);
|
2017-09-24 18:32:50 +00:00
|
|
|
|
}
|
|
|
|
|
else app.programIcon.Image = icon;
|
2017-09-24 19:56:11 +00:00
|
|
|
|
|
|
|
|
|
// Setup UC
|
|
|
|
|
content.Parent = app.programContent;
|
|
|
|
|
content.BringToFront();
|
|
|
|
|
content.Dock = DockStyle.Fill;
|
2017-09-24 18:32:50 +00:00
|
|
|
|
app.Show();
|
|
|
|
|
return app;
|
|
|
|
|
}
|
2017-09-24 21:55:03 +00:00
|
|
|
|
public InfoboxTemplate StartInfoboxSession(string title, string body, buttonType type)
|
|
|
|
|
{
|
|
|
|
|
InfoboxTemplate info = new InfoboxTemplate(type);
|
|
|
|
|
info.label1.Text = body;
|
|
|
|
|
Init(info, title, Properties.Resources.iconInfoBox_fw, true, false);
|
|
|
|
|
return info;
|
|
|
|
|
}
|
2017-09-24 18:32:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|