Monitoring_End_Notification.ps1

#================================================================================================================
#
# Script Part : MDT Monitoring series
# Script purpose : MDT Loght Monitor Tool
# Author : Damien VAN ROBAEYS
# Twitter : https://twitter.com/syst_and_deploy
# Blog : http://www.systanddeploy.com/
#
#================================================================================================================


#******************************************************************** LOAD PARAMETERS FROM MonitoringData_Deploy_Analyze.PS1 ***************************************************************************
param
    (
        [String]$MainText,    
        [String]$LowText,
        [String]$PercentStatus
    )

    
#******************************************************************** LOAD ASSEMBLY ********************************************************************************************************************
[System.Reflection.Assembly]::LoadWithPartialName('presentationframework')                 | out-null
[System.Reflection.Assembly]::LoadFrom('assembly\MahApps.Metro.dll')                       | out-null

#******************************************************************** LOAD XAML ************************************************************************************************************************
function LoadXml ($global:filename)
{
    $XamlLoader=(New-Object System.Xml.XmlDocument)
    $XamlLoader.Load($filename)
    return $XamlLoader
}

# Load MainWindow
$XamlMainWindow=LoadXml("Monitoring_End_Notification.xaml")
$Reader=(New-Object System.Xml.XmlNodeReader $XamlMainWindow)
$Form=[Windows.Markup.XamlReader]::Load($Reader)


########################################################################################################################################################################################################
#*******************************************************************************************************************************************************************************************************
# BUTTONS AND LABELS INITIALIZATION
#*******************************************************************************************************************************************************************************************************
########################################################################################################################################################################################################
$Title_Text = $Form.findname("Title_Text")
$ProgressStatusText = $Form.findname("ProgressStatusText")
# $Progress = $Form.findname("Progress")
$Monitor_Status = $Form.findname("Monitor_Status")
$ProgressPercent = $Form.findname("ProgressPercent")

########################################################################################################################################################################################################
#*******************************************************************************************************************************************************************************************************
# VARIABLES DEFINITION
#*******************************************************************************************************************************************************************************************************
########################################################################################################################################################################################################

########################################################################################################################################################################################################
########################################################################### BASIC VARIABLES ############################################################################################################
########################################################################################################################################################################################################

$Global:Current_Folder =(get-location).path 
$Title_Text.Content = $MainText
$Title_Text.Foreground = "Blue"
$ProgressStatusText.Content = $LowText
$ProgressPercent.Content = $PercentStatus + " %"



If ($MainText -eq "Deployment completed")
    {
        $Monitor_Status.ImageSource = "Monitor_OK.png"    
    }
ElseIf (($MainText -eq "Deployment unresponsive") -or ($MainText -eq "Deployment failed"))
    {
        $Monitor_Status.ImageSource = "Monitor_KO.png"
        $Title_Text.Foreground = "red"                
    }




$Form.ShowDialog()# | Out-Null