Exemplo n.º 1
0
        public void OnCreate_OfflineElement_ButtonClicked(object sender, RoutedEventArgs args)
        {
            if (_wv2_Programmatic_Offline != null)
            {
                RemoveWebViewEventHandlers(_wv2_Programmatic_Offline);
                _wv2_Programmatic_Offline.Close();
            }

            var myWebView = new WebView2 {
                Name = "WV2_Programmatic_Offline"
            };

            AddWebViewEventHandlers(myWebView);
            _wv2_Programmatic_Offline = myWebView;
        }
Exemplo n.º 2
0
        public void OnCreate_ConcurrentCreationElement_ButtonClicked(object sender, RoutedEventArgs args)
        {
            if (_wv2_ConcurrentCreation != null)
            {
                RemoveWebViewEventHandlers(_wv2_ConcurrentCreation);
                _wv2_ConcurrentCreation.Close();
            }

            var myWebView = new WebView2 {
                Name = "WV2_ConcurrentCreation"
            };

            AddWebViewEventHandlers(myWebView);
            _wv2_ConcurrentCreation   = myWebView;
            WebView2_Container4.Child = _wv2_ConcurrentCreation;
        }
Exemplo n.º 3
0
        public void OnCreate_LiveElement_ButtonClicked(object sender, RoutedEventArgs args)
        {
            if (_wv2_Programmatic_Live != null)
            {
                RemoveWebViewEventHandlers(_wv2_Programmatic_Live);
                _wv2_Programmatic_Live.Close();
            }

            var myWebView = new WebView2 {
                Name = "WV2_Programmatic_Live"
            };

            AddWebViewEventHandlers(myWebView);
            _wv2_Programmatic_Live    = myWebView;
            WebView2_Container2.Child = _wv2_Programmatic_Live;
        }
Exemplo n.º 4
0
        public void OnCreate_MarkupElement_Blank_ButtonClicked(object sender, RoutedEventArgs args)
        {
            if (_wv2_Markup != null)
            {
                RemoveWebViewEventHandlers(_wv2_Markup);
                _wv2_Markup.Close();
            }

            var myWebView = (WebView2)XamlReader.Load(@"
                <controls:WebView2 xmlns='http://schemas.microsoft.com/winfx/2006/xaml/presentation'
                          xmlns:controls='using:Microsoft.UI.Xaml.Controls'
                          xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml'
                          x:Name='WV2_Markup'/>");

            AddWebViewEventHandlers(myWebView);
            _wv2_Markup = myWebView;
            WebView2_Container3.Child = _wv2_Markup;
        }
Exemplo n.º 5
0
        public void OnCreate_CoreProcessFailed_ButtonClicked(object sender, RoutedEventArgs args)
        {
            if (_wv2_CoreProcessFailed != null)
            {
                RemoveWebViewEventHandlers(_wv2_CoreProcessFailed);
                _wv2_CoreProcessFailed.Close();
            }

            var myWebView = new WebView2 {
                Name = "WV2_CoreProcessFailed"
            };

            AddWebViewEventHandlers(myWebView);
            _wv2_CoreProcessFailed    = myWebView;
            WebView2_Container5.Child = _wv2_CoreProcessFailed;
        }