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 29 30 31 32 33 34 |
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="Simulación de Navegador Web" Width="800" Height="600"> <Grid> <Grid.RowDefinitions> <RowDefinition Height="Auto"/> <RowDefinition Height="*"/> </Grid.RowDefinitions> <StackPanel Grid.Row="0" Orientation="Horizontal"> <TextBox x:Name="AddressBox" Width="600"/> <Button x:Name="GoButton" Content="Go" Width="50"/> </StackPanel> <WebBrowser x:Name="Browser" Grid.Row="1"/> </Grid> </Window> "@ $reader = [System.XML.XMLReader]::Create([System.IO.StringReader]$xaml) $form = [Windows.Markup.XamlReader]::Load($reader) $AddressBox = $form.FindName("AddressBox") $GoButton = $form.FindName("GoButton") $Browser = $form.FindName("Browser") $GoButton.Add_Click({ $Browser.Navigate($AddressBox.Text) }) $form.ShowDialog() | Out-Null |
