Ejemplo n.º 1
0
        /// <summary>
        /// Test variation initialization
        /// </summary>
        /// <param name="v"></param>
        public override void Init(Variation v)
        {
            base.Init(v);
            string ml = v["matchlevel"];

            colorTolerance = (ml == null) ? 2 : StringConverter.ToDouble(ml);

            if (Variation.NewWindowPerVariation)
            {
                if (window != null)
                {
                    window.Dispose();
                    window = null;
                }
                window = RenderingWindow.Create(v);
                Log("");
                Log("BitDepth detected: {0}", ColorOperations.BitDepth);
            }
            else
            {
                if (window == null)
                {
                    window = RenderingWindow.Create(Variation.GlobalParameters);
                    Log("");
                    Log("BitDepth detected: {0}", ColorOperations.BitDepth);
                }
            }

            // We need to change background color per variation.
            // Global Variation won't have the right value, so there's no sense in doing this in the constructor.
            window.SetBackgroundColor(v.BackgroundColor);
        }
Ejemplo n.º 2
0
        /// <summary/>
        protected override RenderingWindow GetNewWindow()
        {
            Point oldPosition = variation.WindowPosition;

            variation.WindowPosition = referenceWindowPosition;

            RenderingWindow window = RenderingWindow.Create(variation);

            variation.WindowPosition = oldPosition;

            return(window);
        }
Ejemplo n.º 3
0
        /// <summary/>
        protected void ExchangeWindows()
        {
            DispatcherOperationCallback callback =
                delegate(object foo)
            {
                return(GetNewWindow());
            };
            RenderingWindow newWindow = (RenderingWindow)Invoke(DispatcherPriority.Normal, callback, null);

            if (newWindow != null)
            {
                window.Dispose();
                window = newWindow;
            }
        }