public MainWindow() { InitializeComponent(); printer = new PrinterController(); thread = new ThreadController(); core = new AsciiController(); }
private void ExecuteTask(IThreadController tc) { for (int i = 1; i <= 100 && !tc.IsStopRequested; i++) { Thread.Sleep(100); tc.SetProgress(i, 100); } }
private static long RunThread(IThreadController <int> controller, int[] arr, int key) { int[] arr1 = new int[arr.Length]; Array.Copy(arr, arr1, arr1.Length); int[] arr2 = new int[arr.Length]; Array.Copy(arr, arr2, arr1.Length); Thread threadMerge = new Thread(new ParameterizedThreadStart(controller.RunSortMerge)); Thread threadShell = new Thread(new ParameterizedThreadStart(controller.RunSortShell)); Thread threadFind = new Thread(new ParameterizedThreadStart(controller.RunFind)); Stopwatch time = Stopwatch.StartNew(); threadMerge.Start(arr1); threadFind.Start(key); threadShell.Start(arr2); threadFind.Join(); threadShell.Join(); threadMerge.Join(); time.Stop(); return(time.ElapsedMilliseconds); }
public Sorter(IThreadController <T> controller) { this.controller = controller; }