1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
Add-Type -AssemblyName PresentationFramework $xaml = @" <Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" x:Name="Window" Title="Navegador Web" Height="500" Width="800"> <StackPanel> <TextBox x:Name="urlTextBox" Width="600"/> <Button x:Name="searchButton" Content="Buscar" Width="100"/> <WebBrowser x:Name="webBrowser"/> </StackPanel> </Window> "@ $reader=[System.XML.XMLReader]::Create([System.IO.StringReader]$xaml) $form=[Windows.Markup.XamlReader]::Load( $reader ) $searchButton = $form.FindName("searchButton") $urlTextBox = $form.FindName("urlTextBox") $webBrowser = $form.FindName("webBrowser") $searchButton.Add_Click({ $webBrowser.Source = [System.Uri]::new($urlTextBox.Text) }) $form.ShowDialog() |
