locked
webView - Handle several LoadCompleted RRS feed

  • Question

  • My windows 8 app contains a unique webview. While app is run, the webview source is changed sometimes. I need run a command when a second page is completely load, and another when the third page is loaded. All this in same webview. Is possible?

    I try with LoadCompleted, but don't works fine for more than one load.

     private void loginCadastrarCupom_Click(object sender, RoutedEventArgs e)
        {
            gridLogin.Visibility = Visibility.Collapsed;
            gridFormCadastro.Visibility = Visibility.Visible;
    
            string user = insUser.Text;
            string pass = insPass.Password;
    
            string[] usuario = { "document.getElementById(\"UserName\").value = \"" + user + "\"" };
            string[] senha = { "document.getElementById(\"Password\").value = \"" + pass + "\"" };
            string[] botao = { "var botoes = document.getElementById(\"Login\")" };
            string[] enviar = { "botoes.click()" };
    
    wbV.LoadCompleted += new Windows.UI.Xaml.Navigation.LoadCompletedEventHandler(WebView1_LoadCompleted);
    
        }
    
    void WebView1_LoadCompleted(object sender, Windows.UI.Xaml.Navigation.NavigationEventArgs e)
        {
            Uri uri = new Uri("https://www.page2.com");
            wbV.Navigate(uri);
        }

    Tuesday, July 7, 2015 4:13 PM