#region VARIABLES ##################
$Font               = 'Segoe UI,10'
$Font_Summary       = 'Segoe UI,11'
$Font_SummaryValue  = 'Segoe UI,30'
$Font_NavBtn        = 'Segoe UI,14'
$Font_Title         = 'Segoe UI,16'
$Font_DGVRowHeader  = 'Segoe UI,9'
$Font_GroupTitle    = 'Segoe UI,14'
$Forecolor          = 'White'
$Backcolor          = '#272B33' #Dark Gray
$GroupBackColor     = '#416C7B' #Teal
$LeftNavBackColor   = '416C7B'
#endregion #########################

#region ASSEMBLIES #################
Add-Type -AssemblyName System.Windows.Forms
#endregion #########################

#region Style definitions
$StyleWhiteBorder = New-Object System.Windows.Forms.PictureBox
$StyleWhiteBorder.BackColor = '#ffffff'
$StyleWhiteBorder.Size = New-Object System.Drawing.Size(34,34)
$StyleWhiteBorder.Location = New-Object System.Drawing.Point(500,500)
$StyleWhiteBorder.SendToBack()

$Style1 = New-Object System.Windows.Forms.PictureBox
$Style1.BackColor = '#8D4648'
$Style1.Cursor = 'Hand'
$Style1.Size = New-Object System.Drawing.Size(32,32)
$Style1.Location = New-Object System.Drawing.Point(30,45)
$Style1.Add_Click({
    $StyleWhiteBorder.Location = New-Object System.Drawing.Point(
        ($Style1.Left - 1),($Style1.Top - 1))
    $Style1.BringToFront()
    $Backcolor      = '#2b1515'
    $GroupBackColor = '#8d4648'
    ApplyTheme
})

$Style2 = New-Object System.Windows.Forms.PictureBox
$Style2.BackColor = '#815C4D'
$Style2.Cursor = 'Hand'
$Style2.Size = New-Object System.Drawing.Size(32,32)
$Style2.Location = New-Object System.Drawing.Point(
    ($Style1.Left + $Style1.Width + 20),$Style1.Top)
$Style2.Add_Click({
    $StyleWhiteBorder.Location = New-Object System.Drawing.Point(
        ($Style2.Left - 1),($Style2.Top - 1))
    $Style2.BringToFront()
})

$Style3 = New-Object System.Windows.Forms.PictureBox
$Style3.BackColor = '#445246'
$Style3.Cursor = 'Hand'
$Style3.Size = New-Object System.Drawing.Size(32,32)
$Style3.Location = New-Object System.Drawing.Point(
    ($Style2.Left + $Style2.Width + 20),$Style1.Top)
$Style3.Add_Click({
    $StyleWhiteBorder.Location = New-Object System.Drawing.Point(
        ($Style3.Left - 1),($Style3.Top - 1))
    $Style3.BringToFront()
})

$Style4 = New-Object System.Windows.Forms.PictureBox
$Style4.BackColor = '#416C7B'
$Style4.Cursor = 'Hand'
$Style4.Size = New-Object System.Drawing.Size(32,32)
$Style4.Location = New-Object System.Drawing.Point(
    ($Style3.Left + $Style3.Width + 20),$Style1.Top)
$Style4.Add_Click({
    $StyleWhiteBorder.Location = New-Object System.Drawing.Point(
        ($Style4.Left - 1),($Style4.Top - 1))
    $Style4.BringToFront()
})

$Style5 = New-Object System.Windows.Forms.PictureBox
$Style5.BackColor = '#132B40'
$Style5.Cursor = 'Hand'
$Style5.Size = New-Object System.Drawing.Size(32,32)
$Style5.Location = New-Object System.Drawing.Point(
    ($Style1.Left),($Style1.Top + $Style1.Height + 15))
$Style5.Add_Click({
    $StyleWhiteBorder.Location = New-Object System.Drawing.Point(
        ($Style5.Left - 1),($Style5.Top - 1))
    $Style5.BringToFront()
})

$Style6 = New-Object System.Windows.Forms.PictureBox
$Style6.BackColor = '#20242B'
$Style6.Cursor = 'Hand'
$Style6.Size = New-Object System.Drawing.Size(32,32)
$Style6.Location = New-Object System.Drawing.Point(
    ($Style5.Left + $Style5.Width + 20),$Style5.Top)
$Style6.Add_Click({
    $StyleWhiteBorder.Location = New-Object System.Drawing.Point(
        ($Style6.Left - 1),($Style6.Top - 1))
    $Style6.BringToFront()
})

$Style7 = New-Object System.Windows.Forms.PictureBox
$Style7.BackColor = '#20242B'
$Style7.Cursor = 'Hand'
$Style7.Size = New-Object System.Drawing.Size(32,32)
$Style7.Location = New-Object System.Drawing.Point(
    ($Style6.Left + $Style6.Width + 20),$Style5.Top)
$Style7.Add_Click({
    $StyleWhiteBorder.Location = New-Object System.Drawing.Point(
        ($Style7.Left - 1),($Style7.Top - 1))
    $Style7.BringToFront()
})
            
#endregion


#region Assign colors to form elements
function ApplyTheme{
    # Write-Host $GroupBackColor
    # form
    $form.BackColor                     = $Backcolor
    $pnlTop.BackColor                   = $GroupBackColor
    $pnlLeft.BackColor                  = $GroupBackColor
    # PubAssist
    $dgvProfiles.RowTemplate.DefaultCellStyle.BackColor  = $BackColor
    $pnlLMDTitle.BackColor              - $GroupBackColor
    $dgvLMD.BackgroundColor             = $GroupBackColor
    $pnlProfiles.BackColor              = $Backcolor
    $pnlProfilesTitle.BackColor         = $GroupBackcolor
    $txtProfileName.BackColor           = $Backcolor
    $txtProfileSource.BackColor         = $Backcolor
    $txtProfileServer.BackColor         = $Backcolor
    $txtProfileProject.BackColor        = $Backcolor
    $txtProfileDitamap.BackColor        = $Backcolor


    # Settings
    $pnlGeneralSettingsTitle.BackColor  = $GroupBackColor
    $pnlThemesTitle.BackColor           = $GroupBackColor
    $pnlPATitle.BackColor               = $GroupBackColor

    $form.Close()
    $form.Dispose()
    CreateForm
}

#endregion

#region Dark Mode
# $cbDarkMode             = New-Object System.Windows.Forms.CheckBox
# # $cbDarkMode.Location    = '700,20'
# $cbDarkMode.size        = '120,20'
# $cbDarkMode.Checked     = $true
# $cbDarkMode.Text        = "Dark Mode"
# $cbDarkMode.Font        = 'Segoe UI,8'
# $cbDarkMode.Dock        = "Right"
# $cbDarkMode.Add_Click({
#     If ($cbDarkMode.Checked -eq $true){
#         $Forcolor = 'White'
#         $Backcolor = "#272B33"
#     }
#     else{
#         $Forcolor = 'Black'
#         $Backcolor = "#ffffff"
        
#     }
#     $form.ForeColor = $Forcolor
#     $form.BackColor     = $Backcolor
#     $dgvProfiles.BackColor  = $Backcolor
#     $dgvProfiles.ForeColor  = $Forecolor

# })
#endregion

