/// <summary>Iinitialize the plug in.</summary> public override void InitializePlugIn() { Services.RegisterSingletonComponent <IDatabaseInspector, DatabaseInspectorForm>("DatabaseInspector"); Services.RegisterComponent <FindObjectForm>("FindObjectForm"); IHostWindow hostWindow = Services.HostWindow; hostWindow.AddPluginCommand <ShowDatabaseInspectorCommand>(); CommandManager.GetCommandInstance <ShowDatabaseInspectorCommand>().Execute(); ToolStripMenuItem editMenu = hostWindow.GetMenuItem("edit"); editMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <ShowFindObjectFormCommand>()); hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <GenerateSelectStatementCommand>()); hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <GenerateSelectCountStatementCommand>()); hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <GenerateInsertStatementCommand>()); hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <GenerateUpdateStatementCommand>()); hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <GenerateDeleteStatementCommand>()); hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <CopyTableNameCommand>()); hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <TruncateTableCommand>()); hostWindow.DatabaseInspector.ColumnMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <LocateFkReferenceColumnCommand>()); // todo: bug - the opening event is not firing.... CommandControlBuilder.MonitorMenuItemsOpeningForEnabling(hostWindow.DatabaseInspector.ColumnMenu); }
/// <summary>Iinitialize the plug in.</summary> public override void InitializePlugIn() { //Services.RegisterSingletonComponent<IDatabaseInspector, DatabaseInspectorForm>("DatabaseInspector"); Services.RegisterComponent <IDatabaseInspector, DatabaseInspectorForm>(); //var builder = new ContainerBuilder(); ////builder.Register(c=>new DatabaseInspectorForm(c.Resolve<IApplicationServices>(),c.Resolve<IHostWindow>())); //builder.RegisterType<DatabaseInspectorForm>().As<IDatabaseInspector>().WithParameters( //new[] { new ResolvedParameter((p,c)=>p.ParameterType == typeof(IApplicationServices),(p,c)=>c.Resolve<IApplicationServices>()), // new ResolvedParameter((p,c)=>p.ParameterType == typeof(IHostWindow),(p,c)=>c.Resolve<IHostWindow>()) // }); //builder.Update(Services.Container); //Services.RegisterComponent<FindObjectForm>("FindObjectForm"); Services.RegisterComponent <FindObjectForm>(); IHostWindow hostWindow = Services.HostWindow; hostWindow.AddPluginCommand <ShowDatabaseInspectorCommand>(); CommandManager.GetCommandInstance <ShowDatabaseInspectorCommand>().Execute(); ToolStripMenuItem editMenu = hostWindow.GetMenuItem("edit"); editMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <ShowFindObjectFormCommand>()); hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <GenerateSelectStatementCommand>()); hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <GenerateSelectCountStatementCommand>()); hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <GenerateInsertStatementCommand>()); hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <GenerateUpdateStatementCommand>()); hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <GenerateDeleteStatementCommand>()); hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <CopyTableNameCommand>()); hostWindow.DatabaseInspector.TableMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <TruncateTableCommand>()); hostWindow.DatabaseInspector.ColumnMenu.Items.Add(CommandControlBuilder.CreateToolStripMenuItem <LocateFkReferenceColumnCommand>()); // todo: bug - the opening event is not firing.... CommandControlBuilder.MonitorMenuItemsOpeningForEnabling(hostWindow.DatabaseInspector.ColumnMenu); }
/// <summary>Iinitialize the plug in.</summary> public override void InitializePlugIn() { IApplicationServices services = Services; IHostWindow hostWindow = services.HostWindow; services.RegisterSingletonComponent <ICompletionProvider, NullCompletionProvider>("CompletionProvider"); services.RegisterEditor <BasicEditor>(new FileEditorDescriptor("Default text editor", "default-editor")); services.RegisterEditor <QueryForm>(new FileEditorDescriptor("SQL Editor", "sql-editor", "sql")); services.RegisterEditor <BasicCSharpEditor>(new FileEditorDescriptor("C# Editor", "cs-editor", "cs")); services.RegisterEditor <BasicVbNetEditor>(new FileEditorDescriptor("VB/VB.NET Editor", "vb-editor", "vb")); services.RegisterEditor <BasicXmlEditor>(new FileEditorDescriptor("XML Editor", "xml-editor", "xml")); services.RegisterEditor <BasicHtmlEditor>(new FileEditorDescriptor("HTML Editor", "htm-editor", "htm", "html")); services.RegisterEditor <BasicEditor>(new FileEditorDescriptor("Text Editor", "txt-editor", "txt")); services.RegisterComponent <NewFileForm>("NewFileForm"); services.RegisterComponent <OptionsForm>("OptionsForm"); services.RegisterSingletonComponent <IMostRecentFilesService, MostRecentFilesService>("MostRecentFilesService"); services.RegisterConfigurationObject <CoreMiniSqlQueryConfiguration>(); ToolStripMenuItem fileMenu = hostWindow.GetMenuItem("File"); ToolStripMenuItem editMenu = hostWindow.GetMenuItem("edit"); ToolStripMenuItem queryMenu = hostWindow.GetMenuItem("query"); ToolStripMenuItem helpMenu = hostWindow.GetMenuItem("help"); fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <NewQueryFormCommand>()); fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <NewFileCommand>()); fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItemSeparator()); fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <OpenFileCommand>()); fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <SaveFileCommand>()); fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <SaveFileAsCommand>()); fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <CloseActiveWindowCommand>()); fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItemSeparator()); fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <PrintCommand>()); fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItemSeparator()); fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <OpenRecentFile1Command>()); fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <OpenRecentFile2Command>()); fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <OpenRecentFile3Command>()); fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <OpenRecentFile4Command>()); fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <OpenRecentFile5Command>()); fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <OpenRecentFile6Command>()); fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <OpenRecentFile7Command>()); fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <OpenRecentFile8Command>()); fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <OpenRecentFile9Command>()); fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <OpenRecentFile10Command>()); fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItemSeparator()); fileMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <ExitApplicationCommand>()); queryMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <ExecuteTaskCommand>()); queryMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <CancelTaskCommand>()); queryMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <SaveResultsAsDataSetCommand>()); queryMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <RefreshDatabaseConnectionCommand>()); queryMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <CloseDatabaseConnectionCommand>()); queryMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <DisplayDbModelDependenciesCommand>()); // editMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem<DuplicateLineCommand>()); editMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <PasteAroundSelectionCommand>()); editMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <ConvertTextToLowerCaseCommand>()); editMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <ConvertTextToUpperCaseCommand>()); editMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <ConvertTextToTitleCaseCommand>()); editMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <SetLeftPasteAroundSelectionCommand>()); editMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <SetRightPasteAroundSelectionCommand>()); editMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <ShowOptionsFormCommand>()); editMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <OpenConnectionFileCommand>()); // get the new item and make in invisible - the shortcut key is still available etc ;-) ToolStripItem item = editMenu.DropDownItems["SetLeftPasteAroundSelectionCommandToolStripMenuItem"]; item.Visible = false; item = editMenu.DropDownItems["SetRightPasteAroundSelectionCommandToolStripMenuItem"]; item.Visible = false; helpMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <ShowHelpCommand>()); helpMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <ShowWebPageCommand>()); helpMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <ShowDiscussionsWebPageCommand>()); helpMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <EmailAuthorCommand>()); helpMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItemSeparator()); helpMenu.DropDownItems.Add(CommandControlBuilder.CreateToolStripMenuItem <ShowAboutCommand>()); CommandControlBuilder.MonitorMenuItemsOpeningForEnabling(hostWindow.Instance.MainMenuStrip); // toolstrip hostWindow.AddToolStripCommand <NewQueryFormCommand>(0); hostWindow.AddToolStripCommand <OpenFileCommand>(1); hostWindow.AddToolStripCommand <SaveFileCommand>(2); hostWindow.AddToolStripSeperator(3); hostWindow.AddToolStripCommand <ExecuteTaskCommand>(4); hostWindow.AddToolStripCommand <CancelTaskCommand>(5); hostWindow.AddToolStripSeperator(6); hostWindow.AddToolStripSeperator(null); hostWindow.AddToolStripCommand <RefreshDatabaseConnectionCommand>(null); hostWindow.AddPluginCommand <InsertGuidCommand>(); ConfigureMostRecentFileList(services); // watch tool strip enabled properties // by simply iterating each one every second or so we avoid the need to track via events _timer = new Timer(); _timer.Interval = 1000; _timer.Tick += TimerTick; _timer.Enabled = true; }