2017-09-27 22:32:16 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Windows.Forms;
|
2017-11-05 23:47:46 +00:00
|
|
|
|
using ShiftOS.Engine.Misc;
|
2017-09-27 22:32:16 +00:00
|
|
|
|
using ShiftOS.Engine.WindowManager;
|
2017-11-05 23:47:46 +00:00
|
|
|
|
using ShiftOS.Main.Properties;
|
|
|
|
|
using ShiftOS.Main.ShiftOS.Apps;
|
2017-09-27 22:32:16 +00:00
|
|
|
|
|
|
|
|
|
namespace ShiftOS.Main.ShiftOS
|
|
|
|
|
{
|
|
|
|
|
public partial class Desktop : Form
|
|
|
|
|
{
|
|
|
|
|
public Desktop()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
|
|
|
|
|
timer1.Start();
|
|
|
|
|
|
2017-11-05 23:47:46 +00:00
|
|
|
|
Closed += (sender, args) => { Application.Exit(); };
|
2017-09-27 22:32:16 +00:00
|
|
|
|
|
|
|
|
|
#region Disgusting taskbar code
|
|
|
|
|
|
2017-11-11 13:53:55 +00:00
|
|
|
|
ShiftWM.Windows.ItemAdded += (sender, e) =>
|
2017-09-27 22:32:16 +00:00
|
|
|
|
{
|
2017-11-11 13:53:55 +00:00
|
|
|
|
taskbar.Invoke(
|
|
|
|
|
new Action(
|
|
|
|
|
() =>
|
|
|
|
|
{
|
|
|
|
|
taskbar.Items.Add(
|
|
|
|
|
new ToolStripButton
|
|
|
|
|
{
|
|
|
|
|
Text = e.Item.Title.Text,
|
|
|
|
|
Image = e.Item.Icon.ToBitmap(),
|
|
|
|
|
Tag = e.Item.Id
|
|
|
|
|
});
|
|
|
|
|
}));
|
|
|
|
|
};
|
2017-09-27 22:32:16 +00:00
|
|
|
|
|
2017-11-11 13:53:55 +00:00
|
|
|
|
ShiftWM.Windows.ItemRemoved += (sender, e) =>
|
2017-09-27 22:32:16 +00:00
|
|
|
|
{
|
2017-11-11 13:53:55 +00:00
|
|
|
|
taskbar.Invoke(
|
|
|
|
|
new Action(
|
|
|
|
|
() =>
|
2017-09-27 22:32:16 +00:00
|
|
|
|
{
|
2017-11-11 13:53:55 +00:00
|
|
|
|
var tbRemovalList = taskbar.Items.OfType<ToolStripItem>().Where(i => (uint) i.Tag == e.Item.Id);
|
2017-09-27 22:32:16 +00:00
|
|
|
|
|
2017-11-11 13:53:55 +00:00
|
|
|
|
tbRemovalList.ToList().ForEach(p => taskbar.Items.Remove(p));
|
|
|
|
|
}));
|
2017-09-27 22:32:16 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
|
2017-11-05 23:47:46 +00:00
|
|
|
|
void timer1_Tick(object sender, EventArgs e) =>
|
2017-09-27 22:32:16 +00:00
|
|
|
|
taskbarClock.Text = $"{DateTime.Now:t}";
|
2017-10-14 15:23:41 +00:00
|
|
|
|
|
|
|
|
|
private void terminalToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Apps.Terminal trm = new Apps.Terminal();
|
2017-10-15 19:25:37 +00:00
|
|
|
|
|
2017-10-14 15:23:41 +00:00
|
|
|
|
ShiftWM.Init(trm, "Terminal", null, false, true);
|
|
|
|
|
}
|
2017-11-05 20:13:06 +00:00
|
|
|
|
|
2017-11-05 23:47:46 +00:00
|
|
|
|
void textPadToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var tp = new TextPad();
|
2017-11-11 13:53:55 +00:00
|
|
|
|
ShiftWM.Init(tp, "TextPad", Resources.iconTextPad);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void fileSkimmerToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
var fs = new FileSkimmer();
|
|
|
|
|
ShiftWM.Init(fs, "File Skimmer", Resources.iconFileSkimmer);
|
2017-11-05 23:47:46 +00:00
|
|
|
|
}
|
2017-11-18 18:04:01 +00:00
|
|
|
|
|
|
|
|
|
private void shifterToolStripMenuItem_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Apps.ShifterStuff.Shifter app = new Apps.ShifterStuff.Shifter();
|
|
|
|
|
ShiftWM.Init(app, "Shifter", null);
|
|
|
|
|
}
|
|
|
|
|
}
|
2017-09-27 22:32:16 +00:00
|
|
|
|
}
|