aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Engine/WindowManager/ShiftWM.cs
blob: 38537c7c96b3be04208cfe766b602208b19bdc71 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System.Drawing;
using System.Windows.Forms;
using static ShiftOS.Engine.WindowManager.InfoboxTemplate;

namespace ShiftOS.Engine.WindowManager
{
    public class ShiftWM
    {
        public ShiftWindow Init(UserControl content, string title, Image icon, bool ShowAsInfobox = false, bool resize = true)
        {
            // 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;

            // Icon Setup
            if (icon == null)
            {
                app.programIcon.Hide();
                app.programIcon.Image = Properties.Resources.nullIcon;
                app.Title.Location = new Point(2, 7);
            }
            else app.programIcon.Image = icon;

            // Setup UC
            content.Parent = app.programContent;
            content.BringToFront();
            content.Dock = DockStyle.Fill;
            app.Show();
            return app;
        }
        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;
        }
    }
}