// Constructor public CommandManager() { _commands = new CommandsList(this); _hashCommandExecutors = new Hashtable(); _timer = new Timer(1000); _timer.Elapsed += timer_Elapsed; _timer.AutoReset = false; _block = false; // Setup idle processing Application.Idle += OnIdle; // By default, menus and toolbars are known RegisterCommandExecutor("System.Windows.Forms.MenuItem", new MenuCommandExecutor()); RegisterCommandExecutor("System.Windows.Forms.ToolBarButton", new ToolbarCommandExecutor()); RegisterCommandExecutor("System.Windows.Forms.ToolStripButton", new ToolStripCommandExecutor()); RegisterCommandExecutor("System.Windows.Forms.ToolStripDropDownButton", new ToolStripCommandExecutor()); RegisterCommandExecutor("System.Windows.Forms.ToolStripSplitButton", new ToolStripCommandExecutor()); RegisterCommandExecutor("Kesco.Lib.Win.Document.Items.ToolStripSplitButtonCheckable", new ToolStripCommandExecutor()); RegisterCommandExecutor("System.Windows.Forms.ToolStripDropDownItem", new ToolStripCommandExecutor()); RegisterCommandExecutor("System.Windows.Forms.ToolStripMenuItem", new ToolStripCommandExecutor()); }
protected override void Dispose(bool disposing) { _commands = null; if (disposing) { Application.Idle -= OnIdle; if (_timer != null) { _timer.Elapsed -= timer_Elapsed; _timer.Stop(); _timer.Dispose(); _timer = null; } _hashCommandExecutors.Clear(); if (components != null) { components.Dispose(); } } base.Dispose(disposing); }