Пример #1
0
        public void StartCheckByOneThread()
        {
            Task.Run(() =>
            {
                while (!_isExit)
                {
                    var hwnd = WindowHwndBll.GetTargetWindow();
                    if (hwnd > 0)
                    {
                        OperaBll opear = _operas.First();
                        opear.Hwnd     = hwnd;
                        opear.Load();
                        opear.StartTask();

                        while (!_isExit)
                        {
                            if (!WindowHwndBll.ExistsWindow(hwnd))
                            {
                                _operas.First().ThreadRun = false;
                                Task.Delay(1000).Wait();
                                _operas.First().UnBindWindow();
                                StartCheckByOneThread();
                                return;
                            }
                            Task.Delay(1000).Wait();
                        }
                    }
                    Task.Delay(1000).Wait();
                }
            });
        }
Пример #2
0
 public void StartCheckByMultiThread()
 {
     Task.Run(() =>
     {
         while (!_isExit)
         {
             var hwnds = WindowHwndBll.EnumTargetWindow();
             //todo
             Task.Delay(1000).Wait();
         }
     });
 }