Ejemplo n.º 1
0
 public MainWindow()
 {
     InitializeComponent();
     printer = new PrinterController();
     thread = new ThreadController();
     core = new AsciiController();
 }
Ejemplo n.º 2
0
 private void ExecuteTask(IThreadController tc)
 {
     for (int i = 1; i <= 100 && !tc.IsStopRequested; i++)
     {
         Thread.Sleep(100);
         tc.SetProgress(i, 100);
     }
 }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
 public Sorter(IThreadController <T> controller)
 {
     this.controller = controller;
 }