Пример #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();
        }
Пример #2
0
        private IShowCaseStyler GetSyler(ShowCaseStyle? style = null)
        {
            var styleV = style ?? _defaultStyle;

            IShowCaseStyler styler;

            if (!_stylerDict.TryGetValue(styleV, out styler))
            {
                switch (styleV)
                {
                    case ShowCaseStyle.Standart:
                        styler = new StandartCard();
                        break;
                    case ShowCaseStyle.Pink:
                        styler = new PinkLotCard();
                        break;
                    case ShowCaseStyle._23Feb:
                        styler = new _23FebCard();
                        break;
                    default:
                        throw new ArgumentOutOfRangeException("style");
                }

                _stylerDict.Add(styleV, styler);
            }

            return styler;
        }