Ejemplo n.º 1
0
        public void Execute()
        {
            styler = GetSyler();
            styler.Host.Visibility = Visibility.Visible;

            Action act = () =>
            {
                Thread.Sleep(1000);
                foreach (var t in tasks)
                {
                    Action updateVisual = () =>
                    {
                        //styler.Host.Visibility = Visibility.Hidden;
                        styler.Init(t.Product, t.Price, t.PriceOld, t.SourcePath,t.PriceTopRight);
                        //styler.Host.Visibility = Visibility.Visible;
                    };

                    styler.Host.Dispatcher.Invoke(updateVisual);

                    bool goNext = false;
                    while (!goNext)
                    {
                        Thread.Sleep(200);
                        styler.Host.Dispatcher.Invoke(() => goNext = styler.Inited);
                    }

                    Action makeScreenShot = () =>
                    {
                        MakeScreenShot(styler.ScreenShotGrid, t.SavePath);
                    };

                    styler.Host.Dispatcher.Invoke(makeScreenShot);

                }

                tasks.Clear();

                Action closeWin = () => styler.Host.Visibility = Visibility.Hidden;
                styler.Host.Dispatcher.BeginInvoke(closeWin);
            };

            var thread = new Thread(() => act());
            thread.Start();
        }