/// <summary>
        /// Calculates gcd of two number and time of execution of calculations.
        /// </summary>
        /// <param name="first">First number.</param>
        /// <param name="second">Second number.</param>
        /// <returns>Calculated gcd.</returns>
        public int Calculate(int first, int second)
        {
            timeCalculator.Start();
            int gcd = this.algorithm.Calculate(first, second);

            timeCalculator.Stop();
            this.Milliseconds = this.timeCalculator.TimeInMilliseconds;
            return(gcd);
        }
        /// <summary>
        /// Calculates gcd and time of algorithm's execution.
        /// </summary>
        /// <param name="gcdAlgorithm">Gcd algorithm.</param>
        /// <param name="first">First number.</param>
        /// <param name="second">Second number.</param>
        /// <param name="timeCalculator">Util for time calculation.</param>
        /// <param name="timeForCalculations">Result time of algorithm's execution.</param>
        /// <returns></returns>
        public static int CalculateGcdWithTime(this IGcdAlgorithm gcdAlgorithm, int first, int second,
                                               ITimeCalculator timeCalculator, out long timeForCalculations)
        {
            gcdAlgorithm.CheckOnNull();
            timeCalculator.CheckOnNull();
            timeCalculator.Start();
            int gcd = gcdAlgorithm.Calculate(first, second);

            timeCalculator.Stop();
            timeForCalculations = timeCalculator.TimeInMilliseconds;
            return(gcd);
        }
 /// <summary>
 /// Start button press event.
 /// </summary>
 /// <param name="directoryPath">Path to directory.</param>
 /// <param name="fileNamePattern">File name pattern.</param>
 /// <param name="allowedCharacters">Allowed characters in file.</param>
 private void Start(string directoryPath, string fileNamePattern, string allowedCharacters)
 {
     if (!searchOperationRunning)
     {
         view.StartButtonText = "Cancel";
         view.SecondsPassed   = "0";
         timer.Start();
         StartSearch(directoryPath, fileNamePattern, allowedCharacters);
     }
     else
     {
         view.StartButtonText = "Start";
         CancelSearch();
         timer.Stop();
     }
 }