Esempio n. 1
0
        public void WaitforDraw(SystemWindow containingWindow, int maxSeconds = 30)
        {
            var resetEvent = new AutoResetEvent(false);

            EventHandler <DrawEventArgs>   afterDraw = (s, e) => resetEvent.Set();
            EventHandler <ClosedEventArgs> closed    = (s, e) => resetEvent.Set();

            containingWindow.AfterDraw += afterDraw;
            containingWindow.Closed    += closed;

            containingWindow.Invalidate();

            resetEvent.WaitOne(maxSeconds * 1000);

            containingWindow.AfterDraw -= afterDraw;
            containingWindow.Closed    -= closed;
        }