コード例 #1
0
ファイル: Form1.cs プロジェクト: wutijat/webview-samples
        private void OnWebViewDOMCOntentLoaded(object sender, Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.WebViewControlDOMContentLoadedEventArgs e)
        {
            this.Text = this._webView1.DocumentTitle;
#pragma warning disable 4014
            this._webView1.SetFavIconAsync(this);
#pragma warning restore 4014
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: vhanla/MusicEdge
        private void webView1_DOMContentLoaded(object sender, Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.WebViewControlDOMContentLoadedEventArgs e)
        {
            if (webView1.Source.ToString().Contains("https://play.google.com/music"))
            {
                currentClient = (byte)Sources.GMusic;
            }
            else if (webView1.Source.ToString().Contains("https://soundcloud.com"))
            {
                currentClient = (byte)Sources.SoundCloud;
            }
            else if (webView1.Source.ToString().Contains("https://www.jamendo.com"))
            {
                currentClient = (byte)Sources.Jamendo;
            }

            switch (currentClient)
            {
            case GMUSIC:
                string script = "(function(){" +
                                "var style=document.getElementById('gmusic_custom_css');" +
                                "if(!style){ style = document.createElement('STYLE');" +
                                "style.type='text/css';" +
                                "style.id='gmusic_custom_css'; " +
                                "style.innerText = \"" + Style + "\";" +
                                "document.getElementsByTagName('HEAD')[0].appendChild(style);" +
                                "} } )()";
                webView1.InvokeScriptAsync("eval", new string[] { script });

                break;
            }
        }
コード例 #3
0
        private void webView1_DOMContentLoaded(object sender, Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.WebViewControlDOMContentLoadedEventArgs e)
        {
            string script = "(function(){" +
                            "var style=document.getElementById('gmusic_custom_css');" +
                            "if(!style){ style = document.createElement('STYLE');" +
                            "style.type='text/css';" +
                            "style.id='gmusic_custom_css'; " +
                            "style.innerText = \"" + Style + "\";" +
                            "document.getElementsByTagName('HEAD')[0].appendChild(style);" +
                            "} } )()";

            webView1.InvokeScriptAsync("eval", new string[] { script });
        }
コード例 #4
0
        private void WvMain_DOMContentLoaded(object sender, Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.WebViewControlDOMContentLoadedEventArgs e)
        {
            Uri currentUri = (e.Uri != null) ? e.Uri : new Uri("https://blocked.content/");


            myHistory.Navigated(currentUri, wvMain.DocumentTitle);
            string newURL = currentUri.ToString();

            txtURL.BackColor = (newURL.StartsWith("https")) ? Color.FromArgb(192, 255, 192) : Color.FromArgb(255, 192, 192);
            txtURL.Text      = newURL;

            lblTitle.Text = wvMain.DocumentTitle;
            onTitleChange?.Invoke(myPage, wvMain.DocumentTitle);

            isHTMLContentLoaded = (e.Uri != null); // only on real websites
            setStatus("DOM Content Loaded");
        }
コード例 #5
0
        private void Web_DOMContentLoaded(object sender, Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.WebViewControlDOMContentLoadedEventArgs e)
        {
            Console.WriteLine("dsa");
            string[] cmd = new string[] {
                "document.getElementById('user_login').value = 'Meiomundo';" +
                "document.getElementById('user_pass').value = 'Mundo19!#$';"
            };

            web.InvokeScriptAsync("eval", cmd);

            System.Threading.Thread.Sleep(500);
            string login = "******";

            web.InvokeScriptAsync("eval", login);

            if (e.Uri.PathAndQuery == "/wp-admin/")
            {
                web.Navigate(new Uri("https://www.papelariameiomundo.com/wp-admin/edit.php?post_type=product"));
            }
        }
コード例 #6
0
        private void webViewAuth_DOMContentLoaded(object sender, Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.WebViewControlDOMContentLoadedEventArgs e)
        {
            // получить токен, распарсив Uri
            if (e.Uri.ToString().IndexOf("access_token") != -1)
            {
                Regex uri = new Regex(@"(?<name>[\w\d\x5f]+)=(?<value>[^\x26\s]+)",
                                      RegexOptions.IgnoreCase | RegexOptions.Singleline);
                foreach (Match m in uri.Matches(e.Uri.ToString()))
                {
                    if (m.Groups["name"].Value == "access_token")
                    {
                        user.AccessToken = m.Groups["value"].Value;
                    }
                    else if (m.Groups["name"].Value == "user_id")
                    {
                        user.UserId = m.Groups["value"].Value;
                    }
                }
            }

            VkClientShow();
        }
コード例 #7
0
 private void _webView_DOMContentLoaded(object sender, Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.WebViewControlDOMContentLoadedEventArgs e)
 {
     _loaded = true;
     _log?.AppendLine("_webView_DOMContentLoaded called");
 }
コード例 #8
0
 private void webView1_DOMContentLoaded(object sender, Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.WebViewControlDOMContentLoadedEventArgs e)
 {
 }
コード例 #9
0
 private void WvMain_FrameDOMContentLoaded(object sender, Microsoft.Toolkit.Win32.UI.Controls.Interop.WinRT.WebViewControlDOMContentLoadedEventArgs e)
 {
     //setStatus("Frame content loaded.");
     //isHTMLContentLoaded = true;
 }