Приложение, которое ищет файлы по заданному шаблону имени файла и по заданной фразе для внутреннего содержимого файла.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

72 lines
1.6 KiB

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
namespace fileFinder
{
class TaskController
{
public bool isPaused { get; private set; }
public bool isStopped { get; private set; }
public bool isFormUpdatedAfterPause { get; set; }
private Stopwatch stopwatch = new Stopwatch();
public TaskController ()
{
isPaused = false;
isStopped = true;
isFormUpdatedAfterPause = true;
}
public bool beginTask ()
{
isPaused = false;
isStopped = false;
stopwatch.Restart();
return true;
}
public bool pauseTask ()
{
if (!isPaused && !isStopped)
{
isPaused = true;
isFormUpdatedAfterPause = false;
stopwatch.Stop();
return true;
} else
return false;
}
public bool resumeTask ()
{
if (isPaused && !isStopped)
{
isPaused = false;
stopwatch.Start();
return true;
} else
return false;
}
public bool stopTask ()
{
if (!isStopped)
{
isStopped = true;
stopwatch.Stop();
return true;
} else
return false;
}
public TimeSpan elapsedTime ()
{
return stopwatch.Elapsed;
}
}
}