Private/Get-SasDialog.ps1
Function Get-SasDialog($AzureSharedAccessSignatureToken) { [reflection.assembly]::loadwithpartialname("System.Windows.Forms") | Out-Null [reflection.assembly]::loadwithpartialname("System.Drawing") | Out-Null $Form = New-Object system.Windows.Forms.Form $Form.ClientSize = "460,280" $Form.TopMost = $true $Form.Text = "Enter Azure Shared Access Signature" $Form.StartPosition = "CenterScreen" $label = New-Object System.Windows.Forms.Label $label.Location = New-Object System.Drawing.Point(10, 20) $label.Size = New-Object System.Drawing.Size(450, 20) $label.Text = "Please enter the Azure SAS Token below:" $Form.Controls.Add($label) $TextBox = New-Object system.Windows.Forms.TextBox $TextBox.multiline = $true $TextBox.width = 350 $TextBox.height = 70 $TextBox.Location = New-Object System.Drawing.Point(10, 40) $TextBox.Font = 'Microsoft Sans Serif,10' $Form.Controls.Add($textBox) $labelPrefix = New-Object System.Windows.Forms.Label $labelPrefix.Location = New-Object System.Drawing.Point(10, 170) $labelPrefix.Size = New-Object System.Drawing.Size(450, 20) $labelPrefix.Text = "Please enter a short Prefix to identify your jobs (Example YourInitial-DE4711:)" $Form.Controls.Add($labelPrefix) $TextBoxPrefix = New-Object system.Windows.Forms.TextBox $TextBoxPrefix.width = 350 $TextBoxPrefix.height = 20 $TextBoxPrefix.Location = New-Object System.Drawing.Point(10, 190) $TextBoxPrefix.Font = 'Microsoft Sans Serif,10' $Form.Controls.Add($TextBoxPrefix) $Form.Topmost = $true $CheckBox = New-Object System.Windows.Forms.CheckBox $CheckBox.text = "Enable Checkbox for import to Exchange Online Archive" $CheckBox.AutoSize = $false $CheckBox.width = 380 $CheckBox.height = 20 $CheckBox.enabled = $true $CheckBox.location = New-Object System.Drawing.Point(10, 130) $CheckBox.Font = 'Microsoft Sans Serif,10' $CheckBox.TabIndex = 3 $Checkbox.Checked = $true $Form.Controls.Add($Checkbox) $OKButton = New-Object System.Windows.Forms.Button $OKButton.Location = New-Object System.Drawing.Point(75, 230) $OKButton.Size = New-Object System.Drawing.Size(90, 25) $OKButton.Text = "OK" $OKButton.TabIndex = 2 $OKButton.DialogResult = [System.Windows.Forms.DialogResult]::OK $Form.AcceptButton = $OKButton $Form.Controls.Add($OKButton) $CancelButton = New-Object System.Windows.Forms.Button $CancelButton.Location = New-Object System.Drawing.Point(170, 230) $CancelButton.Size = New-Object System.Drawing.Size(90, 25) $CancelButton.Text = "Cancel" $CancelButton.DialogResult = [System.Windows.Forms.DialogResult]::Cancel $Form.CancelButton = $CancelButton $Form.Controls.Add($CancelButton) $Form.Add_Shown( { $textBox.Select() }) $result = $Form.ShowDialog() If ($result -eq [System.Windows.Forms.DialogResult]::OK) { If ($Checkbox.Checked) { $isArchive = $true } else { $isArchive = $false } Return $TextBox.Text, $isArchive, $TextBoxPrefix.Text } else { exit } } |