Anlage des Repos
This commit is contained in:
30
test/PS_WPF_Sample.ps1
Normal file
30
test/PS_WPF_Sample.ps1
Normal file
@@ -0,0 +1,30 @@
|
||||
cls
|
||||
Add-Type -AssemblyName PresentationFramework
|
||||
Add-Type -AssemblyName System
|
||||
|
||||
if (test-path -Path "D:\PS_WPF_Sample.xaml"){
|
||||
[XML]$XAML = Get-Content D:\PS_WPF_Sample.xaml
|
||||
}
|
||||
|
||||
$XAML.Window.RemoveAttribute("x:Class")
|
||||
$Reader = New-Object System.Xml.XmlNodeReader $XAML
|
||||
$Form = [Windows.Markup.XamlReader]::Load($Reader)
|
||||
|
||||
$btnOKClick = {$PSLabel.Content = $PSText.Text}
|
||||
|
||||
$btnExitClick = {$Form.Close()}
|
||||
|
||||
Function GenerateForm {
|
||||
#create objects from controls
|
||||
$PSText = $Form.FindName('PSText')
|
||||
$PSLabel = $Form.FindName('PSLabel')
|
||||
$PSBtnOK = $Form.FindName('PSBtnOK')
|
||||
$PSBtnExit = $Form.FindName('PSBtnExit')
|
||||
|
||||
#Add the events to the controls
|
||||
$PSBtnOK.Add_Click($btnOKClick)
|
||||
$PSBtnExit.Add_Click($btnExitClick)
|
||||
|
||||
$Form.ShowDialog()| Out-Null
|
||||
}
|
||||
GenerateForm
|
||||
Reference in New Issue
Block a user