void RegisterQuickieText()
{
DockPanel.Click += (s, a) =>
{
var tb = new System.Windows.Forms.TextBox();
var f = new System.Windows.Forms.Form();
tb.KeyDown += (kps, kpa) =>
{
if (kpa.KeyCode == Keys.Escape)
{
f.Close();
}
if (kpa.KeyCode == Keys.Enter)
{
var command = tb.Text.ToLowerInvariant();
// Do some more intelligent stuff
// than this:
if (command.StartsWith("remove"))
{
var id = command.Split(' ')[1];
Hierarchy.Remove(long.Parse(id));
}
if (command == "com")
{
this.Commands.Add("Hey " + this.Commands.Count(), (n, x) => { MessageBox.Show(n.NodeDataAdapter.GetDisplayName()); }, "Nice one buddy");
}
if (command == "comr")
{
var first = this.Commands.First();
// if (first != null) Hierarchy.Commands.RemoveItem(first);
}
f.Close();
}
};
tb.Width = 300;
tb.Font = Consolas975;
f.WindowState = FormWindowState.Normal;
f.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
f.Controls.Add(tb);
f.Show();
f.SetDesktopLocation(Cursor.Position.X, Cursor.Position.Y);
f.ClientSize = tb.Size;
};
}