private void CalculateIntersectionSet()
        {
            if (!IsDisposed && !CancellationPending && _intersectionSet == null)
            {
                DateTime startTime = DateTime.Now;
                BigInteger minValue = Program.ThinqMainForm.ResultMinValue;
                BigInteger maxValue = Program.ThinqMainForm.ResultMaxValue;
                BigInteger maxQuantity = Program.ThinqMainForm.ResultMaxQuantity;
                int padLen = maxValue.ToString().Length;
                BigInteger[] cofactors = Program.ThinqMainForm.CoFactors.ToArray();

                //Program.DisplayFunction(string.Format("Max: {0:n0}", maxValue));
                Program.DisplayFunction(string.Format("LCM[{0}]", string.Join(",", cofactors)));
                Program.DisplayFunction("----");

                try
                {
                    _operationStats.Counter = 0;
                    _intersectionSet = new Intersection(minValue, maxValue, cofactors, maxQuantity);
                    foreach (BigInteger factor in _intersectionSet.GetEnumerable())
                    {
                        _operationStats.Counter++;
                        Program.DisplayFunction(string.Concat("{0,", padLen.ToString(), "}"), factor);

                        if (CancellationPending)
                        {
                            break;
                        }
                    }
                }
                finally
                {
                    _operationStats.ProcessingTime = DateTime.Now.Subtract(startTime);

                    StringBuilder strBldr = new StringBuilder();
                    strBldr.AppendLine();
                    strBldr.AppendFormat("Factors found: {0}", _operationStats.Counter).AppendLine();
                    strBldr.AppendFormat("Time elapsed: {0}", _operationStats.ProcessingTime.ToString(@"mm\:ss\.ff"));

                    Program.DisplayFunction(strBldr.ToString());
                }
            }
        }
        /// <summary>
        /// Releases all resources used by the class.
        /// </summary>
        public void Dispose()
        {
            if (!IsDisposed)
            {
                IsDisposed = true;
                if (_intersectionSet != null)
                {
                    if (!_intersectionSet.IsDisposed)
                    {
                        _intersectionSet.Dispose();
                    }
                    _intersectionSet = null;
                }

                if (_backgroundWorker != null)
                {
                    _backgroundWorker.Dispose();
                    _backgroundWorker = null;
                }

                if (_operationStats != null)
                {
                    _operationStats = null;
                }
            }
        }