Guest User

AMP Deployer

a guest
May 4th, 2017
88
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #ERASE ALL THIS AND PUT XAML BELOW between the @" "@
  2. $inputXML = @"
  3. <Window x:Class="WpfApp1.MainWindow"
  4.        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  5.        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  6.        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
  7.        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
  8.        xmlns:local="clr-namespace:WpfApp1"
  9.        mc:Ignorable="d"
  10.        Title="AMP Deployer" Height="558.437" Width="525">
  11.    <Grid>
  12.        <GroupBox x:Name="groupBox2" Header="Email Addresses" Height="100" Margin="11,341,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="490" Foreground="#FFC2C3C9"/>
  13.         <GroupBox x:Name="groupBox1" Header="Details" Height="129" Margin="11,100,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="490" Foreground="#FFC2C3C9"/>
  14.  
  15.         <GroupBox x:Name="groupBox" Header="SIP Domains" Height="100" Margin="11,235,0,0" VerticalAlignment="Top" HorizontalAlignment="Left" Width="490" Foreground="#FFC2C3C9"/>
  16.  
  17.         <Image x:Name="image" HorizontalAlignment="Left" Height="49" Margin="0,10,-0.333,0" VerticalAlignment="Top" Width="519" Source="C:\Users\User\Pictures\Logo\Logo.png"/>
  18.         <TextBox x:Name="textBoxCustomerName" HorizontalAlignment="Left" Height="23" Margin="128,122,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="348" TextChanged="textBox_TextChanged" ToolTip="Enter the customer name"/>
  19.         <Button x:Name="btnCancel" Content="Cancel" HorizontalAlignment="Left" Margin="419,466,0,0" VerticalAlignment="Top" Width="75" ToolTip="Cancel the deployment"/>
  20.         <Button x:Name="btnDeploy" Content="Deploy" HorizontalAlignment="Left" Margin="329,466,0,0" VerticalAlignment="Top" Width="75" Click="button_Copy_Click" ToolTip="Start the deployment"/>
  21.         <Label x:Name="label" Content="Customer Name" HorizontalAlignment="Left" Margin="-1,122,0,0" VerticalAlignment="Top" Height="23" Width="117" FlowDirection="RightToLeft"/>
  22.         <TextBlock x:Name="textBlock" HorizontalAlignment="Left" Margin="10,64,0,0" TextWrapping="Wrap" Text="Welcome to AMP Deployer. Use this tool to deploy a new environment on a vmware datacenter. Just answer the questions below and press Deploy." VerticalAlignment="Top" Height="36" Width="499"/>
  23.         <TextBox x:Name="textBox1" HorizontalAlignment="Left" Height="23" Margin="127.667,155.792,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="46" TextChanged="textBox_TextChanged" UseLayoutRounding="False" MaxLength="3" ToolTip="Example: uc025"/>
  24.         <Label x:Name="label1" Content="Environment Nr" HorizontalAlignment="Left" Margin="23,154,0,0" VerticalAlignment="Top" Height="23" Width="93" FlowDirection="RightToLeft"/>
  25.         <Label x:Name="label2" Content="Type" HorizontalAlignment="Left" Margin="317,190,0,0" VerticalAlignment="Top" FlowDirection="RightToLeft"/>
  26.         <RadioButton x:Name="radioButton" Content="L" HorizontalAlignment="Left" Margin="361,197,0,0" VerticalAlignment="Top" Checked="radioButton_Checked" ToolTip="Single Server deployment"/>
  27.         <RadioButton x:Name="radioButton1" Content="XL" HorizontalAlignment="Left" Margin="398,197,0,0" VerticalAlignment="Top" Checked="radioButton_Checked" ToolTip="High Available deployment"/>
  28.         <RadioButton x:Name="radioButton2" Content="XXL&#xD;&#xA;" HorizontalAlignment="Left" Margin="435,197,0,0" VerticalAlignment="Top" Checked="radioButton_Checked" IsEnabled="False" Height="15" ToolTip="Geo Redundant deployment"/>
  29.         <Label x:Name="label3" Content="Anywhere365" HorizontalAlignment="Left" Margin="34,190,0,0" VerticalAlignment="Top" FlowDirection="RightToLeft"/>
  30.         <ComboBox x:Name="comboBox" HorizontalAlignment="Left" Margin="128,192,0,0" VerticalAlignment="Top" Width="120" SelectionChanged="comboBox_SelectionChanged">
  31.             <ComboBoxItem Content="No" HorizontalAlignment="Left" Width="118"/>
  32.             <ComboBoxItem Content="Yes, Single Server" HorizontalAlignment="Left" Width="118"/>
  33.             <ComboBoxItem Content="Yes, High Available" HorizontalAlignment="Left" Width="118"/>
  34.         </ComboBox>
  35.         <TextBox x:Name="textBox_Copy" HorizontalAlignment="Left" Height="23" Margin="128,258,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="348" TextChanged="textBox_TextChanged" ToolTip="Primary SIP Domain"/>
  36.         <Label x:Name="label_Copy" Content="Primary" HorizontalAlignment="Left" Margin="-1,258,0,0" VerticalAlignment="Top" Height="23" Width="117" FlowDirection="RightToLeft"/>
  37.         <TextBox x:Name="textBox_Copy1" HorizontalAlignment="Left" Height="23" Margin="128,295,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="348" TextChanged="textBox_TextChanged" ToolTip="Additional SIP Domains (comma seperated)"/>
  38.         <Label x:Name="label_Copy1" Content="Additional" HorizontalAlignment="Left" Margin="-1,295,0,0" VerticalAlignment="Top" Height="23" Width="117" FlowDirection="RightToLeft"/>
  39.         <TextBox x:Name="textBox_Copy2" HorizontalAlignment="Left" Height="23" Margin="128,364,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="348" TextChanged="textBox_TextChanged" ToolTip="Email address of the Technical Consultant"/>
  40.         <Label x:Name="label_Copy2" Content="Tech. Consultant" HorizontalAlignment="Left" Margin="-1,364,0,0" VerticalAlignment="Top" Height="23" Width="117" FlowDirection="RightToLeft"/>
  41.         <TextBox x:Name="textBox_Copy3" HorizontalAlignment="Left" Height="23" Margin="128,400,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="348" TextChanged="textBox_TextChanged" ToolTip="Email address of the project manager"/>
  42.         <Label x:Name="label_Copy3" Content="Project Manager" HorizontalAlignment="Left" Margin="-1,401,0,0" VerticalAlignment="Top" Height="23" Width="117" FlowDirection="RightToLeft"/>
  43.         <StatusBar HorizontalAlignment="Left" Height="31" Margin="0,498,-0.333,0" VerticalAlignment="Top" Width="519" ToolTip="Status information is displayed here"/>
  44.     </Grid>
  45. </Window>
  46. "@      
  47.  
  48. $inputXML = $inputXML -replace 'mc:Ignorable="d"','' -replace "x:N",'N'  -replace '^<Win.*', '<Window'
  49.  
  50. [void][System.Reflection.Assembly]::LoadWithPartialName('presentationframework')
  51. [xml]$XAML = $inputXML
  52. #Read XAML
  53.  
  54.    $reader=(New-Object System.Xml.XmlNodeReader $xaml)
  55.  try{$Form=[Windows.Markup.XamlReader]::Load( $reader )}
  56. catch{Write-Host "Unable to load Windows.Markup.XamlReader. Double-check syntax and ensure .net is installed."}
  57.  
  58. #===========================================================================
  59. # Load XAML Objects In PowerShell
  60. #===========================================================================
  61.  
  62. $xaml.SelectNodes("//*[@Name]") | %{Set-Variable -Name "WPF$($_.Name)" -Value $Form.FindName($_.Name)}
  63.  
  64. Function Get-FormVariables{
  65. if ($global:ReadmeDisplay -ne $true){Write-host "If you need to reference this display again, run Get-FormVariables" -ForegroundColor Yellow;$global:ReadmeDisplay=$true}
  66. write-host "Found the following interactable elements from our form" -ForegroundColor Cyan
  67. get-variable WPF*
  68. }
  69.  
  70. Get-FormVariables
  71.  
  72. #===========================================================================
  73. # Actually make the objects work
  74. #===========================================================================
  75.  
  76. #Sample entry of how to add data to a field
  77.  
  78. #$vmpicklistView.items.Add([pscustomobject]@{'VMName'=($_).Name;Status=$_.Status;Other="Yes"})
  79.  
  80. #===========================================================================
  81. # Shows the form
  82. #===========================================================================
  83. write-host "To show the form, run the following" -ForegroundColor Cyan
  84. '$Form.ShowDialog() | out-null'
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×