/// <summary>
        /// Prepares the procedure parameters needed to call the MySQL procedure.
        /// </summary>
        private void PrepareParameters()
        {
            _dbProcedure.InitializeParameters();
            foreach (var dataTypeAndParameterTuple in _dbProcedure.Parameters)
            {
                var dataType       = dataTypeAndParameterTuple.Item1;
                var parameter      = dataTypeAndParameterTuple.Item2;
                var customProperty = new CustomProperty(parameter.ParameterName, parameter.Value, parameter.IsReadOnly(), true)
                {
                    Description = string.Format("Direction: {0}, Data Type: {1}", parameter.Direction, dataType)
                };

                _procedureParamsProperties.Add(customProperty);
            }

            FieldInfo fi          = ParametersPropertyGrid.GetType().GetField("gridView", BindingFlags.NonPublic | BindingFlags.Instance);
            object    gridViewRef = fi != null?fi.GetValue(ParametersPropertyGrid) : ParametersPropertyGrid;

            Type       gridViewType = gridViewRef.GetType();
            MethodInfo mi           = gridViewType.GetMethod("MoveSplitterTo", BindingFlags.NonPublic | BindingFlags.Instance);
            int        gridColWidth = (int)Math.Truncate(ParametersPropertyGrid.Width * 0.4);

            mi.Invoke(gridViewRef, new object[] { gridColWidth });
            ParametersPropertyGrid.Refresh();
        }
        /// <summary>
        /// Event delegate method fired when the <see cref="CallButton"/> button is clicked.
        /// </summary>
        /// <param name="sender">Sender object.</param>
        /// <param name="e">Event arguments.</param>
        private void CallButton_Click(object sender, EventArgs e)
        {
            Cursor = Cursors.WaitCursor;
            try
            {
                if (_dbProcedure.Parameters == null)
                {
                    _dbProcedure.InitializeParameters();
                }

                // Fill procedure parameter values
                for (int paramIdx = 0; paramIdx < _procedureParamsProperties.Count; paramIdx++)
                {
                    var parameter = _dbProcedure.Parameters[paramIdx].Item2;
                    parameter.Value = _procedureParamsProperties[paramIdx].Value;
                }

                // Call stored procedure
                _importDataSet = _dbProcedure.Execute();
                if (_importDataSet == null || _importDataSet.Tables.Count == 0)
                {
                    ImportButton.Enabled = false;
                    return;
                }

                // Refresh output/return parameter values in PropertyGrid
                for (int paramIdx = 0; paramIdx < _procedureParamsProperties.Count; paramIdx++)
                {
                    var parameter = _dbProcedure.Parameters[paramIdx].Item2;
                    if (!parameter.IsReadOnly())
                    {
                        continue;
                    }

                    _procedureParamsProperties[paramIdx].Value = parameter.Value;
                }

                ParametersPropertyGrid.Refresh();

                // Prepare Preview DataSet to show it on Grids
                _previewDataSet = _importDataSet.Clone();
                int resultSetsRowSum = 0;
                for (int tableIdx = 0; tableIdx < _importDataSet.Tables.Count; tableIdx++)
                {
                    resultSetsRowSum += _importDataSet.Tables[tableIdx].Rows.Count;
                    if (_workbookInCompatibilityMode)
                    {
                        _sumOfResultSetsExceedsMaxCompatibilityRows = _sumOfResultSetsExceedsMaxCompatibilityRows || resultSetsRowSum > UInt16.MaxValue;
                    }

                    int limitRows = Math.Min(_importDataSet.Tables[tableIdx].Rows.Count, Settings.Default.ImportPreviewRowsQuantity);
                    for (int rowIdx = 0; rowIdx < limitRows; rowIdx++)
                    {
                        _previewDataSet.Tables[tableIdx].ImportRow(_importDataSet.Tables[tableIdx].Rows[rowIdx]);
                    }
                }

                // Refresh ResultSets in Tab Control
                ResultSetsDataGridView.DataSource = null;
                ResultSetsTabControl.TabPages.Clear();
                for (int dtIdx = 0; dtIdx < _importDataSet.Tables.Count; dtIdx++)
                {
                    ResultSetsTabControl.TabPages.Add(_importDataSet.Tables[dtIdx].TableName);
                }

                if (ResultSetsTabControl.TabPages.Count > 0)
                {
                    _selectedResultSetIndex = ResultSetsTabControl.SelectedIndex = 0;
                    ResultSetsTabControl_SelectedIndexChanged(ResultSetsTabControl, EventArgs.Empty);
                }
            }
            catch (Exception ex)
            {
                MiscUtilities.ShowCustomizedErrorDialog(Resources.ImportProcedureErrorTitle, ex.Message, true);
                MySqlSourceTrace.WriteAppErrorToLog(ex);
            }
            finally
            {
                ImportButton.Enabled = true;
                Cursor = Cursors.Default;
            }
        }