コード例 #1
0
        /// <summary>
        /// Raises the Closing event.
        /// </summary>
        /// <param name="e">A <see cref="CancelEventArgs"/> that contains the event data.</param>
        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);
            _parentTaskPane.RefreshDbObjectPanelActionLabelsEnabledStatus(EditingTableName, false);
            if (EditingWorksheetExists)
            {
                UnprotectWorksheet();
                EditingWorksheet.UsedRange.Interior.ColorIndex = ExcelInterop.XlColorIndex.xlColorIndexNone;
                if (!string.IsNullOrEmpty(EditingWorksheet.GetProtectionKey()))
                {
                    EditingWorksheet.RemoveProtectionKey();
                }
            }

            WorkbookConnectionInfos.RemoveEditConnectionInfoWithEditDialog(this);
            Dispose();
        }
コード例 #2
0
        /// <summary>
        /// Raises the Closing event.
        /// </summary>
        /// <param name="e">A <see cref="CancelEventArgs"/> that contains the event data.</param>
        protected override void OnClosing(CancelEventArgs e)
        {
            base.OnClosing(e);
            _parentTaskPane.RefreshDbObjectPanelActionLabelsEnabledStatus(EditingTableName, false);
            if (EditingWorksheetExists)
            {
                UnprotectWorksheet();
                EditingWorksheet.UsedRange.Interior.ColorIndex = ExcelInterop.XlColorIndex.xlColorIndexNone;
                if (!string.IsNullOrEmpty(EditingWorksheet.GetProtectionKey()))
                {
                    EditingWorksheet.RemoveProtectionKey();
                }
            }

            var connectionInfo = Globals.ThisAddIn.ActiveWorkbookEditConnectionInfos.FirstOrDefault(ac => ac.EditDialog.Equals(this));

            if (connectionInfo != null)
            {
                Globals.ThisAddIn.ActiveWorkbookEditConnectionInfos.Remove(connectionInfo);
            }

            Dispose();
        }