function Load_gaming {
    param ($root)
    [XML]$Form = @"
<?xaml encoding="utf-8"?>
<Window 
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Name="Window" Title="HDS Admin Panel - gaming Script" Height="171" Width="237" Icon="{Binding Icon}" ResizeMode="NoResize" WindowStyle="None">
    <Grid Background="#00344E">
        <Button Name="btnok" Content="Close" HorizontalAlignment="Center" Margin="0,120,0,0" VerticalAlignment="Top" Width="100" Height="36" BorderThickness="0" Background="#00b8d4" Foreground="White">
            <Button.Resources>
                <Style TargetType="Border">
                    <Setter Property="CornerRadius" Value="2"/>
                </Style>
            </Button.Resources>
            <Button.Style>
                <Style TargetType="Button">
                    <Style.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Background" Value="Red"/>
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </Button.Style>
        </Button>
        <Label Content="Gaming" HorizontalAlignment="Left" VerticalAlignment="Top" Width="240" HorizontalContentAlignment="Center" Foreground="White" FontSize="20" FontWeight="Bold"/>
        <Label x:Name="l2" Content="MEG" HorizontalAlignment="Left" Margin="45,47,0,0" VerticalAlignment="Top" Width="36" Height="26" FontSize="12" Foreground="White"/>
        <Button TabIndex="4" x:Name="btnmeg" Content="Touch" ToolTip="aps the PowerButton of MEG" BorderThickness="0" HorizontalAlignment="Left" Margin="12,76,0,0" VerticalAlignment="Top" Width="102" Height="26" FontSize="13" Background="#00b8d4" Foreground="White" FontWeight="Medium">
            <Button.Resources>
                <Style TargetType="{x:Type Border}">
                    <Setter Property="CornerRadius" Value="2"/>
                </Style>
            </Button.Resources>
        </Button>
        <Label x:Name="l2_Kopieren" Content="ITM" HorizontalAlignment="Left" Margin="157,45,0,0" VerticalAlignment="Top" Width="36" Height="26" FontSize="12" Foreground="White"/>
        <Button TabIndex="4" x:Name="btnitm" Content="Touch" ToolTip="Taps the PowerButton of ITM" BorderThickness="0" HorizontalAlignment="Left" Margin="124,76,0,0" VerticalAlignment="Top" Width="102" Height="26" FontSize="13" Background="#00b8d4" Foreground="White" FontWeight="Medium">
            <Button.Resources>
                <Style TargetType="{x:Type Border}">
                    <Setter Property="CornerRadius" Value="2"/>
                </Style>
            </Button.Resources>
        </Button>
    </Grid>
</Window>
"@
    
    # Lädt das Fenster
    $window=[Windows.Markup.XamlReader]::Load((New-Object System.Xml.XmlNodeReader $Form))
    $NR=(New-Object System.Xml.XmlNodeReader $Form)
    $window=[Windows.Markup.XamlReader]::Load($NR)

    # Objekt - Variablen Verknüpfung

    $Script:gaming_btn_meg = $window.FindName("btnmeg")
    $Script:gaming_btn_itm = $window.findName("btnitm")
    $Script:gaming_ok = $window.findName("btnok")

    # Verknüpft feste Elemente
    $window.Title = $Script:Version
    $window.icon="$root/Source/Logo.png"
    return $window
}

$Script:gaming = Load_gaming $args[0]       # Variable: $gaming

$gaming.Add_MouseLeftButtonDown({
    $gaming.DragMove()
})

$gaming_btn_itm.Add_Click({
    $Password = "Ob>Q%T\;Cf(9\+T+-7lNQl*i*)(3;Egl"
    $servername = '192.168.178.4'
    $username = 'spaethf'
    Write-Admin-Log "BTN ITM pressed"
    if (confirm "Bei dem Server gaming Server ITM wird eine Power Aktion ausgeführt") {
        $command = 'python tap_itm.py'
        #Execute SSH command
        echo y | &($plinkpath + "\plink.exe") -pw $password $username@$servername $command
    }
})


$gaming_btn_meg.Add_Click({
    $Password = "Ob>Q%T\;Cf(9\+T+-7lNQl*i*)(3;Egl"
    $servername = '192.168.178.4'
    $username = 'spaethf'
    Write-Admin-Log "BTN MEG pressed"
    if (confirm "Bei dem Server gaming Server MEG wird eine Power Aktion ausgeführt") {
        $command = 'python tap_meg.py'
        #Execute SSH command
        echo y | &($plinkpath + "\plink.exe") -pw $password $username@$servername $command
    }
})

$gaming_ok.Add_Click({
    $gaming.Hide()
})