PoshCode Archive  Artifact [f1788e3c62]

Artifact f1788e3c629322256a98579b8b409e991065c790701d7996676318f137a44837:

  • File Close-Control.ps1 — part of check-in [2048f2251d] at 2018-06-10 13:39:02 on branch trunk — This file was uploaded by a PowerGUI Script Editor Add-on. (user: Anonymous size: 744)

# encoding: ascii
# api: powershell
# title: Close-Control.ps1
# description: This file was uploaded by a PowerGUI Script Editor Add-on.
# version: 0.1
# type: function
# author: Anonymous
# license: CC0
# function: Close-Control
# x-poshcode-id: 4284
# x-archived: 2013-07-09T04:38:22
# x-published: 2013-07-02T11:37:00
#
#
function Close-Control
{
    param(
    [Parameter(Mandatory=$true,
        ValueFromPipeline=$true)]
    [Windows.Media.Visual]
    $Visual
    )
    
    process {
        if ($Visual -is [Windows.Window]) {
            $Visual.Close()
        }
        if ($Visual.Parent -is [Windows.Window]) {
            $Visual.Close()
        }
        $Visual.Visibility = "Collapsed"
    }
}