コード例 #1
0
        public void TestDebug()
        {
            MainHelper testClass = null;
            var        one       = new MonitorLocation();

            one.X      = 1247;
            one.Y      = 311;
            one.Width  = 50;
            one.Height = 18;
            one.Name   = "买一";

            var two = new MonitorLocation();

            two.X      = 1139;
            two.Y      = 88;
            two.Height = 23;
            two.Width  = 79;
            two.Name   = "股票名称";

            System.Collections.Generic.List <MonitorLocation> list = new System.Collections.Generic.List <MonitorLocation>();
            list.Add(one);
            list.Add(two);

            testClass = new MainHelper(Newtonsoft.Json.JsonConvert.SerializeObject(list).ToString(), false);

            Stopwatch sw = new Stopwatch();

            sw.Start();
            var bmp = testClass.Screenshot();

            sw.Stop();
            Console.WriteLine("截图花费:" + sw.ElapsedMilliseconds.ToString());
            sw.Reset();
            sw.Start();
            Parallel.Invoke(() => testClass.CatImage((Bitmap)bmp.Clone(), 0), () => testClass.CatImage((Bitmap)bmp.Clone(), 1));
            //testClass.CatImage(bmp, 0);
            //testClass.CatImage(bmp, 1);
            sw.Stop();
            Console.WriteLine("并行切图花费:" + sw.ElapsedMilliseconds.ToString());
        }