mercredi 2 décembre 2020

How to unselect all check boxes with button

I have a button named 'ALL' witch select all check boxes, and then switch to 'NOTHING'. If user clicks, it should unselect all the checked boxes. The ''CHECK''works properly but the ''UNCHECK'' doesnt work. Someone can help me figure this?

Just Find the # ///////////// HERE ///////////////////// near the end of the script. Thank you so much.

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass 
Add-Type -AssemblyName PresentationCore, PresentationFramework


#regions ---- XAML -----
[xml]$xaml = @"
<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

        Title="Programme de tests QA" Height="515" Width="828" ResizeMode="NoResize">
    <Grid>
        <TabControl HorizontalAlignment="Left" Height="500" VerticalAlignment="Top" Width="825">

            <TabControl.Resources>
                <Style TargetType="TabItem">
                    <Setter Property="Template">
                        <Setter.Value>
                            <ControlTemplate TargetType="TabItem">
                                <Border Name="Border" BorderThickness="0,0,0,0" CornerRadius="5,5,0,0" Margin="2,0">
                                    <ContentPresenter x:Name="Tab1"
                                        VerticalAlignment="Center"
                                        HorizontalAlignment="Center"
                                        ContentSource="Header"
                                        Margin="10,2"/>
                                </Border>
                                <ControlTemplate.Triggers>
                                    <Trigger Property="IsSelected" Value="True">
                                        <Setter TargetName="Border" Property="Background" Value="#292929" />
                                    </Trigger>
                                    <Trigger Property="IsSelected" Value="False">
                                        <Setter TargetName="Border" Property="Background" Value="#FF23BBB8" />
                                    </Trigger>
                                </ControlTemplate.Triggers>
                            </ControlTemplate>
                        </Setter.Value>
                    </Setter>
                </Style>
            </TabControl.Resources>
           
            <TabItem x:Name="tab1" Header="SYNCHRONISATION" Height="40" Width="273" Background="#292929" FontFamily="Segoe UI Semibold" Foreground="white" IsSelected="True">
                <Grid Background="#292929" Width="840" Height="455" Margin="-7,1,-14,-4">
                    <Label Content="synchronisation d'une s`érie" FontFamily="Segoe UI" FontSize="20" Foreground="#797979" HorizontalAlignment="Left" Height="47" Margin="49,47,0,0" VerticalAlignment="Top" Width="723"/>
                    <Line X1="55" X2="440" Y1="200" Y2="200" Stroke="#5f5f5f" StrokeThickness="1"></Line>
                    <Line X1="55" X2="440" Y1="99" Y2="99" Stroke="#5f5f5f" StrokeThickness="1"></Line>
                    <Line X1="480" X2="770" Y1="99" Y2="99" Stroke="#5f5f5f" StrokeThickness="1"></Line>
                    <Line X1="480" X2="770" Y1="200" Y2="200" Stroke="#5f5f5f" StrokeThickness="1"></Line>
                    <TextBlock HorizontalAlignment="Left" Height="21" Margin="60,121,0,0" TextWrapping="Wrap" Text="de" VerticalAlignment="Top" Width="36" Foreground="#797979"/>
                    <TextBlock HorizontalAlignment="Left" Height="21" Margin="60,161,0,0" TextWrapping="Wrap" Text="vers" VerticalAlignment="Top" Width="36" Foreground="#797979"/>


                    <ComboBox x:Name="CBBdeRep2" HorizontalAlignment="Left" Height="20" Margin="107,120,0,0" VerticalAlignment="Top" Width="103" FontSize="10" Foreground="#797979" />
                    <ComboBox x:Name="CBBdeSerie2" HorizontalAlignment="Left" Height="20" Margin="227,120,0,0" VerticalAlignment="Top" Width="211" FontSize="10" Foreground="#797979"/>
                    <ComboBox x:Name="CBBversRep2" HorizontalAlignment="Left" Height="20" Margin="107,159,0,0" VerticalAlignment="Top" Width="103" FontSize="10" Foreground="#797979" />
                    <ComboBox x:Name="CBBversSerie2" HorizontalAlignment="Left" Height="20" Margin="227,159,0,0" VerticalAlignment="Top" Width="211" FontSize="10" Foreground="#797979" />
                    <CheckBox x:Name="CBbin2" Content=" bin" HorizontalAlignment="Left" Height="19" Margin="480,118,0,0" VerticalAlignment="Top" Width="92" Foreground="#797979"/>
                    <CheckBox x:Name="CBexport2" Content=" export" HorizontalAlignment="Left" Height="19" Margin="480,142,0,0" VerticalAlignment="Top" Width="92" Foreground="#797979"/>
                    <CheckBox x:Name="CBparam2" Content=" param" HorizontalAlignment="Left" Height="19" Margin="480,166,0,0" VerticalAlignment="Top" Width="92" Foreground="#797979"/>
                    <CheckBox x:Name="CBlist2" Content=" list" HorizontalAlignment="Left" Height="19" Margin="600,118,0,0" VerticalAlignment="Top" Width="92" Foreground="#797979"/>
                    <CheckBox x:Name="CBscript2" Content=" script" HorizontalAlignment="Left" Height="19" Margin="600,142,0,0" VerticalAlignment="Top" Width="92" Foreground="#797979"/>
                    <CheckBox x:Name="CBtemplate2" Content=" template" HorizontalAlignment="Left" Height="19" Margin="600,166,0,0" VerticalAlignment="Top" Width="92" Foreground="#797979"/>
                    
                    <Button x:Name="BTNall1" Content="TOUS" FontSize="9" HorizontalAlignment="Right" Height="20" Margin="0,138,72,0"  VerticalAlignment="Top" Foreground="white" Background="gray" Width="50"/>

                    <TextBox x:Name="TBmessages2" HorizontalAlignment="Left" Height="145" Margin="55,238,0,0" TextWrapping="Wrap"  VerticalScrollBarVisibility="Visible" Text="Affichage des messages d'exécution." Foreground="#797979" Padding="6" FontSize="10" VerticalAlignment="Top" Width="383"/>
                    <Button x:Name="BTNsynchro" Content="synchroniser la s`érie" FontSize="15" HorizontalAlignment="Left" Height="48" Margin="480,335,0,0"  VerticalAlignment="Top" Foreground="white" Background="#FF23BBB8" Width="290"/>

                </Grid>
            </TabItem>



            <TabItem x:Name="tab2" Header="CR`ÉATION" Background="#FF00565F" Height="40" Width="273" BorderBrush="#FF00565F" FontSize="12" Foreground="White" FontFamily="Segoe UI Semibold">
                <Grid Background="#292929" Width="840" Height="455" Margin="-7,1,-14,-4">
                   
                    <Label x:Name="titre1" Content="cr`éation d'une nouvelle serie" FontFamily="Segoe UI" FontSize="20" Foreground="#797979" HorizontalAlignment="Left" Height="47" Margin="49,47,0,0" VerticalAlignment="Top" Width="723"/>
                    <Line X1="55" X2="440" Y1="99" Y2="99" Stroke="#5f5f5f" StrokeThickness="1"></Line>
                    <Line X1="55" X2="440" Y1="200" Y2="200" Stroke="#5f5f5f" StrokeThickness="1"></Line>
                    <Line X1="480" X2="770" Y1="99" Y2="99" Stroke="#5f5f5f" StrokeThickness="1"></Line>
                    <Line X1="480" X2="770" Y1="200" Y2="200" Stroke="#5f5f5f" StrokeThickness="1"></Line>
                    <TextBlock HorizontalAlignment="Left" Height="21" Margin="60,121,0,0" TextWrapping="Wrap" Text="de" VerticalAlignment="Top" Width="36" Foreground="#797979"/>
                    <TextBlock HorizontalAlignment="Left" Height="21" Margin="60,161,0,0" TextWrapping="Wrap" Text="vers" VerticalAlignment="Top" Width="36" Foreground="#797979"/>
                    
                    <ComboBox x:Name="CBBdeRep1" HorizontalAlignment="Left" Height="20" Margin="107,120,0,0" VerticalAlignment="Top" Width="103"  FontSize="10" Foreground="#797979"/>
                    <ComboBox x:Name="CBBdeSerie1" HorizontalAlignment="Left" Height="20" Margin="227,120,0,0" VerticalAlignment="Top" Width="211" FontSize="10" Foreground="#797979"/>
                    <ComboBox x:Name="CBBversRep1" HorizontalAlignment="Left" Height="20" Margin="107,159,0,0" VerticalAlignment="Top" Width="103"  FontSize="10" Foreground="#797979"/>
                    <TextBox x:Name="TBversSerie1" HorizontalAlignment="Left" Height="20" Margin="227,159,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="211" Padding="2" MaxLength="33" FontSize="10" Foreground="#797979" />
                     
                     <Grid x:Name="CheckBoxGroup1">
                    <CheckBox x:Name="CBbin1" Content=" bin" HorizontalAlignment="Left" Height="19" Margin="480,118,0,0" VerticalAlignment="Top" Width="92" Foreground="#797979"/>
                    <CheckBox x:Name="CBexport1" Content=" export" HorizontalAlignment="Left" Height="19" Margin="480,142,0,0" VerticalAlignment="Top" Width="92" Foreground="#797979"/>
                    <CheckBox x:Name="CBparam1" Content=" param" HorizontalAlignment="Left" Height="19" Margin="480,166,0,0" VerticalAlignment="Top" Width="92" Foreground="#797979"/>
                    <CheckBox x:Name="CBlist1" Content=" list" HorizontalAlignment="Left" Height="19" Margin="600,118,0,0" VerticalAlignment="Top" Width="92" Foreground="#797979"/>
                    <CheckBox x:Name="CBscript1" Content=" script" HorizontalAlignment="Left" Height="19" Margin="600,142,0,0" VerticalAlignment="Top" Width="92" Foreground="#797979"/>
                    <CheckBox x:Name="CBtemplate1" Content=" template" HorizontalAlignment="Left" Height="19" Margin="600,166,0,0" VerticalAlignment="Top" Width="92" Foreground="#797979"/>
                    
                    <Button x:Name="BTNall2" Content="TOUS" FontSize="9" HorizontalAlignment="Right" Height="20" Margin="0,138,72,0"  VerticalAlignment="Top" Foreground="white" Background="gray" Width="50"/>
                    
                    </Grid>
                   
                    <Button x:Name="BTNcreation" Content="cr`éer la s`érie et synchroniser" FontSize="15" HorizontalAlignment="Left" Height="48" Margin="480,335,0,0"  VerticalAlignment="Top" Foreground="white" Background="#FF23BBB8" Width="290"/>
                    <TextBox x:Name="TBmessages1" HorizontalAlignment="Left" Height="145" Margin="55,238,0,0" TextWrapping="Wrap"  VerticalScrollBarVisibility="Visible" Text="Affichage des messages d'exécution." Foreground="#797979" Padding="6" FontSize="10" VerticalAlignment="Top" Width="383"/>

                   
                   
                    
                </Grid>


            </TabItem>



            <TabItem x:Name="tab3" Header="EX`ÉCUTION"  Background="#FF00565F" Height="40" Width="273" BorderBrush="#FF00565F" FontSize="12" Foreground="white" FontFamily="Segoe UI Semibold">
                <Grid Background="#292929" Width="840" Height="455" Margin="-7,1,-14,-4"  >
                    <Label x:Name="titre3" Content="ex`écution des tests QA" FontFamily="Segoe UI" FontSize="20" Foreground="#797979" HorizontalAlignment="Left" Height="47" Margin="49,47,0,0" VerticalAlignment="Top" Width="723"/>
                    <Line X1="55" X2="335" Y1="99" Y2="99" Stroke="#5f5f5f" StrokeThickness="1"></Line>
                    <Line X1="55" X2="335" Y1="160" Y2="160" Stroke="#5f5f5f" StrokeThickness="1"></Line>
                    <Line X1="480" X2="770" Y1="99" Y2="99" Stroke="#5f5f5f" StrokeThickness="1"></Line>
                    <Line X1="480" X2="770" Y1="250" Y2="250" Stroke="#5f5f5f" StrokeThickness="1"></Line>
                    <Line X1="480" X2="770" Y1="200" Y2="200" Stroke="#5f5f5f" StrokeThickness="1"></Line>
                    <TextBlock HorizontalAlignment="Left" Height="21" Margin="54,121,0,0" TextWrapping="Wrap" Text="version" VerticalAlignment="Top" Width="55" Foreground="#797979"/>
                    <TextBlock HorizontalAlignment="Left" Height="21" Margin="482,121,0,0" TextWrapping="Wrap" Text="`équipe" VerticalAlignment="Top" Width="55" Foreground="#797979"/>
                    <TextBlock HorizontalAlignment="Left" Height="21" Margin="482,161,0,0" TextWrapping="Wrap" Text="liste" VerticalAlignment="Top" Width="36" Foreground="#797979"/>

                    <ComboBox x:Name="CBBversion3" HorizontalAlignment="Left" Height="20" Margin="113,120,0,0" VerticalAlignment="Top" Width="70" FontSize="10" Foreground="#797979" />
                    <TextBox x:Name="TBbuild3" HorizontalAlignment="Left" Height="20" Margin="201,120,0,0"  TextWrapping="Wrap" Text="Build" VerticalAlignment="Top" Width="77" Padding="2" MaxLength="4" FontSize="10" Foreground="#797979" />
                    <TextBox x:Name="TBrevision3" HorizontalAlignment="Left" Height="20" Margin="297,120,0,0"  TextWrapping="Wrap" Text="R`év." VerticalAlignment="Top" Width="36" Padding="2" MaxLength="3" FontSize="10" Foreground="#797979" />
                    <ComboBox x:Name="CBBequipe3" HorizontalAlignment="Left" Height="20" Margin="542,120,0,0" VerticalAlignment="Top" Width="150" FontSize="10" Foreground="#797979"/>        
                    <ComboBox x:Name="CBBliste3" HorizontalAlignment="Left" Height="20" Margin="542,159,0,0" VerticalAlignment="Top" Width="150" FontSize="10" Foreground="#797979"/>
                    <CheckBox x:Name="CBrtf3" Content=" produire les fichiers en format .rtf" HorizontalAlignment="Left" Height="19" Margin="480,217,0,0" VerticalAlignment="Top" Width="230"  Foreground="#797979"/>

                    <TextBox x:Name="TBmessages3" HorizontalAlignment="Left" Height="190" Margin="55,193,0,0" VerticalScrollBarVisibility="Visible" TextWrapping="Wrap" Text="Affichage des messages d'exécution." Foreground="#797979" Padding="6" FontSize="10" VerticalAlignment="Top" Width="383"/>
                    <Button x:Name="BTNexecution" Content="lancer les tests" FontSize="15" HorizontalAlignment="Left" Height="48" Margin="480,335,0,0" VerticalAlignment="Top" Foreground="white" Background="#FF23BBB8" Width="290"/>

                </Grid>
            </TabItem>
        </TabControl>


    </Grid>
</Window>

"@

#Read XAML (Parse it)
$reader=(New-Object System.Xml.XmlNodeReader $XAML)
$Window=[Windows.Markup.XamlReader]::Load( $reader )
#endregion

#region ----- xaml objects to variables -----


#Connect to Controls TAB1
$Tab1CBB1 = $Window.FindName('CBBdeRep2')
$Tab1CBB2 = $Window.FindName('CBBdeSerie2')
$Tab1CBB3 = $Window.FindName('CBBversRep2')
$Tab1CBB4 = $Window.FindName('CBBversSerie2')
$Tab1CBbin = $Window.FindName('CBbin2')
$Tab1CBexport = $Window.FindName('CBexport2')
$Tab1CBparam = $Window.FindName('CBparam2')
$Tab1CBlist = $Window.FindName('CBlist2')
$Tab1CBscript = $Window.FindName('CBscript2')
$Tab1CBtemplate = $Window.FindName('CBtemplate2')
$Tab1TBmessages = $Window.findName("TBmessages2")
$Tab1BTNsynchro = $Window.findName("BTNsynchro")
$Tab1BTNall = $Window.findName("BTNall1")

#Connect to Controls TAB2
$Tab2CBB1 = $Window.FindName('CBBdeRep1')
$Tab2CBB2 = $Window.FindName('CBBdeSerie1')
$Tab2CBB3 = $Window.FindName('CBBversRep1')
$Tab2TB4 = $Window.FindName('TBversSerie1')
$Tab2CBbin = $Window.FindName('CBbin1')
$Tab2CBexport = $Window.FindName('CBexport1')
$Tab2CBparam = $Window.FindName('CBparam1')
$Tab2CBlist = $Window.FindName('CBlist1')
$Tab2CBscript = $Window.FindName('CBscript1')
$Tab2CBtemplate = $Window.FindName('CBtemplate1')
$Tab2TBmessages = $Window.findName("TBmessages1")
$Tab2BTNcreation = $Window.findName("BTNcreation")
$Tab2BTNall = $Window.findName("BTNall1")
$Tab2CBGroup = $Window.findName("CheckBoxGroup1")


#Connect to Controls TAB2
$Tab3CBBversion = $Window.findName("CBBversion3")
$Tab3TBbuild = $Window.findName("TBbuild3")
$Tab3TBrev = $Window.findName("TBrevision3")
$Tab3CBBequipe = $Window.findName("CBBequipe3")
$Tab3CBBliste = $Window.findName("CBBliste3")
$Tab3CBrtf = $Window.findName("CBrtf3")
$Tab3TBmessages = $Window.findName("TBmessages3")
$Tab3BTNexecution = $Window.findName("BTNexecution")
#endregion

#region ---- Path variables  ----- 
[STRING]$pathDE='E:\Scripts\BibliothequePowershell\Melanie\GUI-ProgTestQA\Simulation\DE\'
[STRING]$pathVERS='E:\Scripts\BibliothequePowershell\Melanie\GUI-ProgTestQA\Simulation\VERS\'
[STRING]$pathDBQcust01='E:\Scripts\BibliothequePowershell\Melanie\GUI-ProgTestQA\Simulation\DE\DBQcust01\Sets\' 
[STRING]$pathQA14='E:\Scripts\BibliothequePowershell\Melanie\GUI-ProgTestQA\Simulation\DE\QA14\Sets\'
[STRING]$pathQA15='E:\Scripts\BibliothequePowershell\Melanie\GUI-ProgTestQA\Simulation\DE\QA15\Sets\'
[STRING]$pathSERIE = 'E:\Scripts\BibliothequePowershell\Melanie\GUI-ProgTestQA\Simulation\DE\QA14\Sets'  #simulation
[STRING]$pathSIMULATION = 'E:\Scripts\BibliothequePowershell\Melanie\GUI-ProgTestQA\Simulation'
[STRING]$pathSPMT = 'E:\Scripts\BibliothequePowershell\Melanie\GUI-ProgTestQA\Simulation\VERS\SPMT'
[STRING]$pathOTHER = 'E:\Scripts\BibliothequePowershell\Melanie\GUI-ProgTestQA\Simulation\VERS\OTHER'

#endregion ----

#region ---- lists of series ----
$listQA14 = Get-ChildItem $pathQA14 -Directory -Name 
$listQA15 = Get-ChildItem $pathQA15 -Directory -Name 
$listDBQcust01 = Get-ChildItem $pathDBQcust01 -Directory -Name 
$FolderLists = Get-ChildItem $pathSIMULATION\Listes -Include *.txt -Name
$listSPMT = Get-ChildItem $pathSPMT -Directory -Name 
$listOTHER = Get-ChildItem $pathOTHER -Directory -Name 
$listDE = Get-ChildItem $pathDE -Directory -Name 
$listVERS = Get-ChildItem $pathVERS -Directory -Name 
#endregion




#------------- TAB1 ------------------





#region /// ComboBox 1 : DE folder
[ARRAY]$FoldersCBB1 = @($listDE)
$Tab1CBB1.Items.Add('--- choisir ---')
$Tab1CBB1.SelectedItem = '--- choisir ---'
foreach ($Folder in $FoldersCBB1) {
$Tab1CBB1.Items.Add($Folder)
}
#endregion




#region /// ComboBox 2 : DE SERIE    
$Tab1CBB1.add_SelectionChanged({
$Selection = ($Tab1CBB1.SelectedItem.ToString())

  if ($Selection -eq 'QA14') 
    { 
        $Tab1CBB2.Items.Clear()
        $Tab1CBB2.Items.Add('--- choisir une série sous QA14 ---')
        $Tab1CBB2.SelectedItem = '--- choisir une série sous QA14 ---' 
        foreach ($Serie in $listQA14) {
            $Tab1CBB2.Items.Add($Serie)
        }   
    }   
    
    elseif ($Selection -eq 'QA15') 
    {
            $Tab1CBB2.Items.Clear()
            $Tab1CBB2.Items.Add('--- choisir une série sous QA15 ---')
            $Tab1CBB2.SelectedItem = '--- choisir une série sous QA15 ---'
            foreach ($Serie in $listQA15)  {
                $Tab1CBB2.Items.Add($Serie)
            }
    }    
    
    elseif ($Selection -eq 'DBQcust01') 
    {
            $Tab1CBB2.Items.Clear()
            $Tab1CBB2.Items.Add('--- choisir une série sous DBQcust01 ---')
            $Tab1CBB2.SelectedItem = '--- choisir une série sous DBQcust01 ---'
            foreach ($Serie in $listDBQcust01) {
                 $Tab1CBB2.Items.Add($Serie)
            }
   }

    $SelectionCBB2 = ($Tab1CBB2.SelectedValue)
    $SelectionCBB3 = ($Tab1CBB3.SelectedValue)

})

#endregion




#region /// ComboBox 3 : VERS folder
$FoldersCBB3 = @($listVERS)
$Tab1CBB3.Items.Add('--- choisir ---')
$Tab1CBB3.SelectedItem = '--- choisir ---' 
foreach ($Folder in $FoldersCBB3) {
    $Tab1CBB3.Items.Add($Folder)
}

#endregion




#region /// ComboBox 4 : VERS SÉRIE

$Tab1CBB3.add_SelectionChanged({
$Selection = ($Tab1CBB3.SelectedItem.ToString())

  if ($Selection -eq 'SPMT') 
    { 
        $Tab1CBB4.Items.Clear()
        $Tab1CBB4.Items.Add('--- choisir une série sous SPMT ---')
        $Tab1CBB4.SelectedItem = '--- choisir une série sous SPMT ---' 
        foreach ($Serie in $listSPMT) {
            $Tab1CBB4.Items.Add($Serie)
        }   
    }   
    
    elseif ($Selection -eq 'OTHER') 
    {
            $Tab1CBB4.Items.Clear()
            $Tab1CBB4.Items.Add('--- choisir une série sous OTHER ---')
            $Tab1CBB4.SelectedItem = '--- choisir une série sous OTHER ---'
            foreach ($Serie in $listOTHER)  {
                $Tab1CBB4.Items.Add($Serie)
            }
    }    
    
    $SelectionCBB2 = ($Tab1CBB2.SelectedValue)
    $SelectionCBB3 = ($Tab1CBB3.SelectedValue)
    $SelectionCBB4 = ($Tab1CBB4.SelectedValue)
})
#endregion




# ///////////// HERE /////////////////////
$Tab1BTNall.Add_Click({

    If ($Tab1BTNall.Content = "ALL") 
    {
        $Tab1CBbin.IsChecked = "True"
        $Tab1CBparam.IsChecked = "True"
        $Tab1CBtemplate.IsChecked = "True"
        $Tab1CBscript.IsChecked = "True"
        $Tab1CBexport.IsChecked = "True"
        $Tab1CBlist.IsChecked = "True"
        $Tab1BTNall.Content = "NOTHING"
    }

    ElseIf ($Tab1BTNall.Content = "NOTHING") 
    {
        $Tab1CBbin.IsChecked = "False"
        $Tab1CBparam.IsChecked = "False"
        $Tab1CBtemplate.IsChecked = "False"
        $Tab1CBscript.IsChecked  = "False"
        $Tab1CBexport.IsChecked  = "False"
        $Tab1CBlist.IsChecked  = "False"
        $Tab1BTNall.Content = "ALL"
    }
    Else
    {}
})




#region /// BOUTON SYNCHRONISATION

$Tab1BTNsynchro.Add_Click({

    $SelectionCBB1 = ($Tab1CBB1.SelectedValue)
    $SelectionCBB2 = ($Tab1CBB2.SelectedValue)
    $SelectionCBB3 = ($Tab1CBB3.SelectedValue)
    $SelectionCBB4 = ($Tab1CBB4.SelectedValue)
    $Tab1TBmessages.Clear()
    $SelectedPathVers = "$pathVERS\$SelectionCBB3\$SelectionCBB4" 
    $SelectedPathBin = "$pathDE\$SelectionCBB1\sets\$SelectionCBB2\Bin"
    $SelectedPathExport = "$pathDE\$SelectionCBB1\sets\$SelectionCBB2\Export"
    $SelectedPathList = "$pathDE\$SelectionCBB1\sets\$SelectionCBB2\List"
    $SelectedPathParam = "$pathDE\$SelectionCBB1\sets\$SelectionCBB2\Param"
    $SelectedPathScript = "$pathDE\$SelectionCBB1\sets\$SelectionCBB2\QA\Script"
    $SelectedPathTemplate = "$pathDE\$SelectionCBB1\sets\$SelectionCBB2\Template"

   
   If ($Tab1CBbin.IsChecked -eq $true) { 
        $TestPath1 = Test-Path $SelectedPathBin 
        $TestPath2 = Test-Path $SelectedPathVers
        If ($TestPath1 -eq $True -and $TestPath2 -eq $True) {
        copy-item -Path $SelectedPathBin -Recurse -Destination $SelectedPathVers -Force
        $Tab1TBmessages.AddText("Dossier Bin : Copié`r`n")
        }
        else {$Tab1TBmessages.AddText("*** Dossier Bin : Non copié / Le path n'existe pas *** `r`n")
        }
    }
   
   If ($Tab1CBexport.IsChecked -eq $true) { 
        $TestPath1 = Test-Path $SelectedPathExport 
        $TestPath2 = Test-Path $SelectedPathVers
        If ($TestPath1 -eq $True -and $TestPath2 -eq $True) {
        copy-item -Path $SelectedPathExport -Recurse -Destination $SelectedPathVers -Force
        $Tab1TBmessages.AddText("Dossier Export : Copié`r`n")
        }
        else {$Tab1TBmessages.AddText("*** Dossier Export : Non copié / Le path n'existe pas *** `r`n")
        }

    }
   
   If ($Tab1CBlist.IsChecked -eq $true) {
        $TestPath1 = Test-Path $SelectedPathList
        $TestPath2 = Test-Path $SelectedPathVers
        If ($TestPath1 -eq $True -and $TestPath2 -eq $True) {
        copy-item -Path $SelectedPathList -Recurse -Destination $SelectedPathVers -Force
        $Tab1TBmessages.AddText("Dossier List : Copié`r`n")
        }
        else {$Tab1TBmessages.AddText("*** Dossier List : Non copié / Le path n'existe pas *** `r`n")
        }
    }
 
   If ($Tab1CBparam.IsChecked -eq $true) {
        $TestPath1 = Test-Path $SelectedPathParam
        $TestPath2 = Test-Path $SelectedPathVers
        If ($TestPath1 -eq $True -and $TestPath2 -eq $True) {
        copy-item -Path $SelectedPathParam -Recurse -Destination $SelectedPathVers -Force
        $Tab1TBmessages.AddText("Dossier Param : Copié`r`n")
        }
        else {$Tab1TBmessages.AddText("*** Dossier Param : Non copié / Le path n'existe pas *** `r`n")
        }
   }
  
   If ($Tab1CBscript.IsChecked -eq $true) {
        $TestPath1 = Test-Path $SelectedPathScript
        $TestPath2 = Test-Path $SelectedPathVers
        If ($TestPath1 -eq $True -and $TestPath2 -eq $True) {
        copy-item -Path $SelectedPathScript -Recurse -Destination "$SelectedPathVers\QA\Script" -Force
        $Tab1TBmessages.AddText("Dossier Script : Copié`r`n")
        }
        else {$Tab1TBmessages.AddText("*** Dossier Script : Non copié / Le path n'existe pas *** `r`n")
        }
    }

   If ($Tab1CBtemplate.IsChecked -eq $true) {
        $TestPath1 = Test-Path $SelectedPathTemplate
        $TestPath2 = Test-Path $SelectedPathVers
        If ($TestPath1 -eq $True -and $TestPath2 -eq $True) {
        copy-item -Path $SelectedPathTemplate -Recurse -Destination $SelectedPathVers -Force
        $Tab1TBmessages.AddText("Dossier Template : Copié`r`n")
        }
        else {$Tab1TBmessages.AddText("*** Dossier Template : Non copié / Le path n'existe pas *** `r`n")
        }
    }

   else{
   }
 $Tab1TBmessages.AddText("
---------------------------------------------------------------------------------
Les dossiers copiés avec succès se retrouvent sous :
$PathSIMULATION\$SelectionCBB3\$SelectionCBB4
---------------------------------------------------------------------------------")


})

#endregion










#------------- TAB2 ------------------










#------------- TAB3 ------------------






#Displays the Window
$Window.ShowDialog() | out-null



Aucun commentaire:

Enregistrer un commentaire