Logo Pastebin.fr
Pastebin

Retrouvez, créez et partagez vos snippets en temps réel.

WALID TOUMI TIMELINE 1.1 21-01-2026

Function Show-Journal {
    [string]$police = $list.SelectedItems.Text 
    $client = $list.SelectedItems.SubItems[1].Text

    # --- CONFIGURATION FENÊTRE    
    $jouForm = New-Object System.Windows.Forms.Form
    $jouForm.Text = "JOURNAL"
    $jouForm.Size = New-Object System.Drawing.Size(650, 750)
    $jouForm.BackColor = [System.Drawing.Color]::FromArgb(10, 10, 12)
    $jouForm.StartPosition = "CenterParent"
    $jouForm.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedDialog
    $jouForm.MaximizeBox = $false
    $jouForm.MinimizeBox = $false

    # --- BANDEAU SUPÉRIEUR
    $panelHeader = New-Object System.Windows.Forms.Panel
    $panelHeader.SetBounds(0, 0, 650, 100)
    $panelHeader.BackColor = [System.Drawing.Color]::FromArgb(15, 15, 25)
    $jouForm.Controls.Add($panelHeader)

    # Label Client 
    $lblClient = New-Object System.Windows.Forms.Label
    $lblClient.Text = "OPERATOR_TARGET: $($client.ToUpper())"
    $lblClient.SetBounds(25, 20, 600, 25)
    $lblClient.ForeColor = [System.Drawing.Color]::Cyan
    $lblClient.Font = New-Object System.Drawing.Font("Segoe UI", 12, [System.Drawing.FontStyle]::Bold)
    $panelHeader.Controls.Add($lblClient)

    # Label Police 
    $lblPolice = New-Object System.Windows.Forms.Label
    $lblPolice.Text = "REFERENCE_ID: $police"
    $lblPolice.SetBounds(25, 45, 600, 20)
    $lblPolice.ForeColor = [System.Drawing.Color]::Gray
    $lblPolice.Font = New-Object System.Drawing.Font("Consolas", 10)
    $panelHeader.Controls.Add($lblPolice)

    # --- LISTBOx
    $logBox = New-Object System.Windows.Forms.ListBox
    $logBox.SetBounds(25, 120, 585, 380)
    $logBox.BackColor = [System.Drawing.Color]::FromArgb(10, 10, 12)
    $logBox.ForeColor = [System.Drawing.Color]::FromArgb(140, 198, 63)
    $logBox.Font = New-Object System.Drawing.Font("Consolas", 11)
    $logBox.BorderStyle = "None"
    $jouForm.Controls.Add($logBox)

    # Séparateur Néon
    $lineSep = New-Object System.Windows.Forms.Panel
    $lineSep.SetBounds(25, 510, 585, 2)
    $lineSep.BackColor = [System.Drawing.Color]::FromArgb(0, 255, 255) # Cyan pur
    $jouForm.Controls.Add($lineSep)

    # Chargement
    if ($global:journalData.PSObject.Properties[$police]) {
        foreach ($n in $global:journalData."$police") { [void]$logBox.Items.Add($n) }
    }

    # --- INPUT ---
    $txtNote = New-Object System.Windows.Forms.TextBox
    $txtNote.Multiline = $true
    $txtNote.SetBounds(25, 540, 585, 80)
    $txtNote.BackColor = [System.Drawing.Color]::FromArgb(25, 25, 30)
    $txtNote.ForeColor = [System.Drawing.Color]::White
    $txtNote.Font = New-Object System.Drawing.Font("Segoe UI", 12)
    $txtNote.BorderStyle = "FixedSingle"
    $jouForm.Controls.Add($txtNote)

    # --- BOUTON ---
    $btnAddNote = New-Object System.Windows.Forms.Button
    $btnAddNote.Text = "CONFIRMER L'ENREGISTREMENT"
    $btnAddNote.SetBounds(25, 640, 585, 50)
    $btnAddNote.FlatStyle = "Flat"
    $btnAddNote.FlatAppearance.BorderColor = [System.Drawing.Color]::Cyan
    $btnAddNote.FlatAppearance.BorderSize = 2
    $btnAddNote.ForeColor = [System.Drawing.Color]::Cyan
    $btnAddNote.Font = New-Object System.Drawing.Font("Segoe UI", 11, [System.Drawing.FontStyle]::Bold)
    $jouForm.Controls.Add($btnAddNote)

    # Logique d'enregistrement
    $btnAddNote.Add_Click({
        if ($txtNote.Text.Trim() -ne "") {
            $ts = Get-Date -Format "dd/MM/yyyy HH:mm"
            $nouvelleNote = "[$ts] ⚡ $($txtNote.Text.Replace('"',"'"))"
            
            $notesExistantes = @()
            if ($global:journalData.PSObject.Properties[$police]) {
                $notesExistantes = @($global:journalData."$police")
            }

            $nouveauTableau = @($nouvelleNote) + $notesExistantes
            $global:journalData | Add-Member -MemberType NoteProperty -Name $police -Value $nouveauTableau -Force
            $global:journalData | ConvertTo-Json -Depth 10 | Out-File $global:journalFile -Encoding utf8

            [void]$logBox.Items.Insert(0, $nouvelleNote)
            $txtNote.Clear()
        }
    })

    $jouForm.ShowDialog()
}

Créé il y a 3 semaines.

Rechercher un Pastebin

Aucun paste trouvé.