예제 #1
0
        /// <summary>
        /// Closes the current connection, editing dialogs and puts the welcome panel in focus.
        /// </summary>
        /// <param name="givePanelFocus">Flag indicating whether the <see cref="WelcomePanel"/> is given focus.</param>
        public void CloseConnection(bool givePanelFocus)
        {
            WbConnection = null;
            if (givePanelFocus)
            {
                WelcomePanel1.BringToFront();
            }

            // Free up open Edit Dialogs
            WorkbookConnectionInfos.CloseWorkbookEditConnectionInfos(Globals.ThisAddIn.ActiveWorkbook);
        }
예제 #2
0
        /// <summary>
        /// Closes the current connection, editing tables and puts the schema panel in focus.
        /// </summary>
        /// <param name="askToCloseConnections">Flag indicating whether users are asked for confirmation before closing active <see cref="EditConnectionInfo"/>.</param>
        /// <param name="givePanelFocus">Flag indicating whether the <see cref="SchemaSelectionPanel"/> is given focus.</param>
        /// <returns><c>true</c> if the schema and its open <see cref="EditConnectionInfo"/> objects are closed, <c>false</c> otherwise.</returns>
        public bool CloseSchema(bool askToCloseConnections, bool givePanelFocus)
        {
            if (askToCloseConnections && WorkbookConnectionInfos.GetWorkbookEditConnectionInfos(Globals.ThisAddIn.ActiveWorkbook).Count > 0)
            {
                // If there are Active OldStoredEditConnectionInfos warn the users that by closing the schema the active EditConnectionInfos will be closed.
                var dr = MiscUtilities.ShowCustomizedWarningDialog(Resources.ActiveEditConnectionInfosCloseWarningTitle, Resources.ActiveEditConnectionInfosCloseWarningDetail);
                if (dr == DialogResult.No)
                {
                    return(false);
                }
            }

            WorkbookConnectionInfos.CloseWorkbookEditConnectionInfos(Globals.ThisAddIn.ActiveWorkbook);
            if (givePanelFocus)
            {
                SchemaSelectionPanel2.BringToFront();
            }

            return(true);
        }