AnfiniL.SqlExpressProfiler.MainForm.StopCurrentTrace C# (CSharp) Method

StopCurrentTrace() private method

private StopCurrentTrace ( ) : bool
return bool
        private bool StopCurrentTrace()
        {
            if (CurrentTrace == null) return true;

            StatusErrorCode errorCode = CurrentTrace.Profiler.Stop();
            if (errorCode != StatusErrorCode.TraceIsInvalid)
            {
                if (errorCode != StatusErrorCode.NoError)
                {
                    MessageBox.Show("Can't stop trace: " + errorCode, "Error", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                    return false;
                }

                errorCode = CurrentTrace.Profiler.Close();
                if (errorCode != StatusErrorCode.NoError)
                {
                    MessageBox.Show("Can't close trace: " + errorCode, "Error", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                    return false;
                }
            }

            CurrentTrace = null;

            return true;
        }