#region License
// Copyright 2005-2019 Paul Kohler (https://github.com/paulkohler/minisqlquery). All rights reserved.
// This source code is made available under the terms of the GNU Lesser General Public License v3.0
// https://github.com/paulkohler/minisqlquery/blob/master/LICENSE
#endregion
using System.Windows.Forms;
using MiniSqlQuery.Core;
using MiniSqlQuery.PlugIns.DatabaseInspector.Commands;
namespace MiniSqlQuery.PlugIns.DatabaseInspector
{
/// The database inspector loader.
public class DatabaseInspectorLoader : PluginLoaderBase
{
/// Initializes a new instance of the class.
public DatabaseInspectorLoader()
: base(
"数据库检查器",
"用于在树视图中显示数据库架构的迷你SQL查询插件",
20)
{
}
/// Iinitialize the plug in.
public override void InitializePlugIn()
{
Services.RegisterSingletonComponent("DatabaseInspector");
Services.RegisterComponent("FindObjectForm");
IHostWindow hostWindow = Services.HostWindow;
hostWindow.AddPluginCommand();
CommandManager.GetCommandInstance().Execute();
ToolStripMenuItem editMenu = hostWindow.GetMenuItem("edit");
editMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem());
hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem());
hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem());
hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem());
hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem());
hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem());
hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem());
hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem());
hostWindow.DatabaseInspector.ColumnMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem());
// todo: bug - the opening event is not firing....
CommandControlBuilder.MonitorMenuItemsOpeningForEnabling(hostWindow.DatabaseInspector.ColumnMenu);
}
}
}