示例#1
0
        protected override void Cleanup()
        {
            Dispatcher.CurrentDispatcher.InvokeShutdown();

            _window.BringIntoView();
            _window.Close();

            _webView.Dispose();
            _webView = null;
        }
示例#2
0
        protected override void Given()
        {
            _window = new Window
            {
                Title  = TestContext.TestName,
                Width  = 1000,
                Height = 800
            };

            _window.Loaded     += (o, e) => { WriteLine("Window.Loaded"); };
            _window.MouseEnter += (o, e) => { WriteLine("Window.MouseEnter"); };
            _window.GotFocus   += (o, e) => { WriteLine("Window.GotFocus"); };
            _window.LostFocus  += (o, e) => { WriteLine("Window.LostFocus"); };
            _window.Closing    += (o, e) => { WriteLine("Window.Closing"); };
            _window.Closed     += (o, e) => { WriteLine("Window.Closed"); };


            _webView = new Controls.WPF.WebView
            {
                Name = "WebView1",
                HorizontalAlignment = HorizontalAlignment.Stretch,
                VerticalAlignment   = VerticalAlignment.Stretch,
                Height    = _window.Height,
                Width     = _window.Width,
                MinHeight = 200,
                MinWidth  = 200
            };
            var dp = new DockPanel();

            dp.Children.Add(_webView);
            _window.Content = dp;

            _webView.NavigationCompleted += (o, e) =>
            {
                _window.Close();
            };
        }