Exemplo n.º 1
0
        /// <summary>
        ///     The configure container.
        /// </summary>
        /// <param name = "services">The services.</param>
        public static void ConfigureContainer(IApplicationServices services)
        {
            // singletons
            services.RegisterSingletonComponent <IApplicationSettings, ApplicationSettings>("ApplicationSettings");
            services.RegisterSingletonComponent <IHostWindow, MainForm>("HostWindow");
            services.RegisterSingletonComponent <IFileEditorResolver, FileEditorResolverService>("FileEditorResolver");

            // components
            services.RegisterComponent <AboutForm>("AboutForm");
            services.RegisterComponent <ITextFindService, BasicTextFindService>("DefaultTextFindService");
            services.RegisterComponent <IQueryEditor, QueryForm>("QueryForm");
            services.RegisterComponent <ISqlWriter, SqlWriter>("DefaultSqlWriter");
            services.RegisterComponent <ITextFormatter, NVelocityWrapper>("TextFormatter");
            services.RegisterComponent <TemplateModel>("TemplateModel");
            services.RegisterComponent <BatchQuerySelectForm>("BatchQuerySelectForm");
        }
Exemplo n.º 2
0
        /// <summary>
        /// 	The configure container.
        /// </summary>
        /// <param name = "services">The services.</param>
        public static void ConfigureContainer(IApplicationServices services)
        {
            // singletons
            services.RegisterSingletonComponent<IApplicationSettings, ApplicationSettings>("ApplicationSettings");
            services.RegisterSingletonComponent<IHostWindow, MainForm>("HostWindow");
            services.RegisterSingletonComponent<IFileEditorResolver, FileEditorResolverService>("FileEditorResolver");

            // components
            services.RegisterComponent<AboutForm>("AboutForm");
            services.RegisterComponent<ITextFindService, BasicTextFindService>("DefaultTextFindService");
            services.RegisterComponent<IQueryEditor, QueryForm>("QueryForm");
            services.RegisterComponent<ISqlWriter, SqlWriter>("DefaultSqlWriter");
            services.RegisterComponent<ITextFormatter, NVelocityWrapper>("TextFormatter");
            services.RegisterComponent<TemplateModel>("TemplateModel");
            services.RegisterComponent<BatchQuerySelectForm>("BatchQuerySelectForm");
        }
Exemplo n.º 3
0
        /// <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;
        }