Private/Show-Finalform.ps1

function Show-Finalform {
    # Load configuration
    $Config = Read-Config

    # Extract configuration values
    $AppName     = $Config["Variables"]["AppName"]
    $SupportURL  = $Config["Variables"]["SupportURL"]
    $IconBase64  = $Config["Images"]["MainIcon"]
    $ImagePath   = $Config["Images"]["MainImage"]
    $LogoffPath  = $Config["Images"]["LogoffImage"]

    # Initialize form
    [void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
    [void][System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
    [System.Windows.Forms.Application]::EnableVisualStyles()

    # Create Form
    $form3 = New-Object System.Windows.Forms.Form
    $form3.Text = $AppName
    $form3.Size = New-Object System.Drawing.Size(600, 400)
    $form3.StartPosition = "CenterScreen"
    $form3.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedDialog
    $form3.MaximizeBox = $false
    if (Test-Path $IconBase64) {
        $form3.Icon = New-Object System.Drawing.Icon($IconBase64)
    }

    # Left-side Image
    $pictureBox = New-Object System.Windows.Forms.PictureBox
    $pictureBox.ImageLocation = $ImagePath
    $pictureBox.SizeMode = [System.Windows.Forms.PictureBoxSizeMode]::StretchImage
    $pictureBox.Size = New-Object System.Drawing.Size(200, 400)
    $pictureBox.Location = New-Object System.Drawing.Point(0, 0)
    $form3.Controls.Add($pictureBox)

    # RichTextBox for Description
    $richTextBoxDescription = New-Object System.Windows.Forms.RichTextBox
    $richTextBoxDescription.Location = New-Object System.Drawing.Point(220, 10)
    $richTextBoxDescription.Size = New-Object System.Drawing.Size(350, 170)
    $richTextBoxDescription.ReadOnly = $true
    $richTextBoxDescription.BorderStyle = [System.Windows.Forms.BorderStyle]::None
    $richTextBoxDescription.BackColor = $form3.BackColor

    $richTextBoxDescription.SelectionFont = New-Object System.Drawing.Font("Arial", 12, [System.Drawing.FontStyle]::Bold)
    $richTextBoxDescription.SelectionColor = [System.Drawing.Color]::Green
    $richTextBoxDescription.AppendText("Your Data is successfully Migrated`n`n")

    $richTextBoxDescription.SelectionFont = New-Object System.Drawing.Font("Arial", 10, [System.Drawing.FontStyle]::Regular)
    $richTextBoxDescription.SelectionColor = [System.Drawing.Color]::Black
    $richTextBoxDescription.AppendText("Do make sure to sign out from the VDI and sign in back to access your data.`n`n")
    $richTextBoxDescription.AppendText("- If you have selected the Full Profile Migration, sign out from the VDI and sign in back.`n`n")
    $richTextBoxDescription.AppendText("- If you encounter issues, please contact Citrix Support.")

    $linkText = "Citrix Support"
    $startIndex = $richTextBoxDescription.Text.IndexOf($linkText)
    $richTextBoxDescription.Select($startIndex, $linkText.Length)
    $richTextBoxDescription.SelectionColor = [System.Drawing.Color]::Blue
    $richTextBoxDescription.SelectionFont = New-Object System.Drawing.Font($richTextBoxDescription.Font, [System.Drawing.FontStyle]::Underline)
    $richTextBoxDescription.Select(0, 0)

    $form3.Controls.Add($richTextBoxDescription)

    # Log Off Button
    $buttonLogOff = New-Object System.Windows.Forms.Button
    $buttonLogOff.Location = New-Object System.Drawing.Point(450, 175)
    $buttonLogOff.Size = New-Object System.Drawing.Size(45, 45)
    if (Test-Path $LogoffPath) {
        $icon = [System.Drawing.Image]::FromFile($LogoffPath)
        $resizedIcon = New-Object System.Drawing.Bitmap($icon, 40, 40)
        $buttonLogOff.Image = $resizedIcon
        $buttonLogOff.ImageAlign = [System.Drawing.ContentAlignment]::MiddleCenter
    }
    $buttonLogOff.FlatStyle = [System.Windows.Forms.FlatStyle]::Flat
    $buttonLogOff.FlatAppearance.BorderSize = 0
    $buttonLogOff.FlatAppearance.MouseOverBackColor = $buttonLogOff.BackColor
    $buttonLogOff.FlatAppearance.MouseDownBackColor = $buttonLogOff.BackColor
    $buttonLogOff.BackColor = [System.Drawing.SystemColors]::Control

    $buttonLogOff.Add_Click({
        $result = [System.Windows.Forms.MessageBox]::Show("Are you sure you want to log off?", "Confirm Log Off", [System.Windows.Forms.MessageBoxButtons]::YesNo, [System.Windows.Forms.MessageBoxIcon]::Question)
        if ($result -eq [System.Windows.Forms.DialogResult]::Yes) {
            Start-Process -FilePath "C:\Windows\System32\shutdown.exe" -ArgumentList "/l"
        }
    })

    $form3.Controls.Add($buttonLogOff)

    # Logoff Label
    $logoffbuttonlabel = New-Object System.Windows.Forms.Label
    $logoffbuttonlabel.Text = "Click here to Sign out from the VDI: "
    $logoffbuttonlabel.Location = New-Object System.Drawing.Point(225, 190)
    $logoffbuttonlabel.Size = New-Object System.Drawing.Size(250, 34)
    $logoffbuttonlabel.Font = New-Object System.Drawing.Font("Arial", 10, [System.Drawing.FontStyle]::Bold)
    $form3.Controls.Add($logoffbuttonlabel)

    # Close Button
    $buttonNext = New-Object System.Windows.Forms.Button
    $buttonNext.Text = "Close"
    $buttonNext.Location = New-Object System.Drawing.Point(475, 310)
    $buttonNext.Size = New-Object System.Drawing.Size(80, 30)
    $buttonNext.BackColor = [System.Drawing.Color]::SteelBlue
    $buttonNext.ForeColor = [System.Drawing.Color]::White
    $buttonNext.Font = New-Object System.Drawing.Font("Arial", 10, [System.Drawing.FontStyle]::Bold)
    $buttonNext.Add_Click({
        $form3.Close()
        $form3.Dispose()
    })

    $form3.Controls.Add($buttonNext)

    # Show the form
    $form3.ShowDialog()
}