SHARE
TWEET

FoxDeploy GUI Template - XiPher

1RedOne May 4th, 2017 271 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="WpfApplication2.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:WpfApplication2"
  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"  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" 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"  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" ToolTip="Single Server deployment"/>
  27.         <RadioButton x:Name="radioButton1" Content="XL" HorizontalAlignment="Left" Margin="398,197,0,0" VerticalAlignment="Top" ToolTip="High Available deployment"/>
  28.         <RadioButton x:Name="radioButton2" Content="XXL&#xD;&#xA;" HorizontalAlignment="Left" Margin="435,197,0,0" VerticalAlignment="Top" 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" >
  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"  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"  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"  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"  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{
  57.    $error[0]
  58.    Write-Host "Unable to load Windows.Markup.XamlReader. Double-check syntax and ensure .net is installed."
  59.    break
  60.    }
  61.  
  62. #===========================================================================
  63. # Load XAML Objects In PowerShell
  64. #===========================================================================
  65.  
  66. $xaml.SelectNodes("//*[@Name]") | %{Set-Variable -Name "WPF$($_.Name)" -Value $Form.FindName($_.Name)}
  67.  
  68. Function Get-FormVariables{
  69. if ($global:ReadmeDisplay -ne $true){Write-host "If you need to reference this display again, run Get-FormVariables" -ForegroundColor Yellow;$global:ReadmeDisplay=$true}
  70. write-host "Found the following interactable elements from our form" -ForegroundColor Cyan
  71. get-variable WPF*
  72. }
  73.  
  74. Get-FormVariables
  75.  
  76. #===========================================================================
  77. # Actually make the objects work
  78. #===========================================================================
  79.  
  80. #Sample entry of how to add data to a field
  81.  
  82. #$vmpicklistView.items.Add([pscustomobject]@{'VMName'=($_).Name;Status=$_.Status;Other="Yes"})
  83.  
  84. #===========================================================================
  85. # Shows the form
  86. #===========================================================================
  87. write-host "To show the form, run the following" -ForegroundColor Cyan
  88. $Form.ShowDialog() | out-null
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top