mardi 24 novembre 2020

jquery select all checkbox doesn't trigger change event on individual checkbox

I have a selectAll checkbox that, when clicked, checks/unchecks all other checkboxes with class name all_serp_results_selector.

<p>Select All</p>
<input type="checkbox" id="selectAll">

<p> Individual checkboxes </p>
<input type="checkbox" class="all_serp_results_selector">
<input type="checkbox" class="all_serp_results_selector">
<input type="checkbox" class="all_serp_results_selector">
<input type="checkbox" class="all_serp_results_selector">

Jquery scripts:

$("#selectAll").on( "click", function(e) {
    $(':checkbox.all_serp_results_selector').prop('checked', this.checked);
});

When these individual checkboxes are changed, this event handler is called:

$('.all_serp_results_selector').on('change', function() {
    console.log('changed');
});

But selectAll only checks/unchecks these checkboxes and doesn't trigger this event handler.

How can I make selectAll to also trigger change event for each individual checkboxes?

Here's jsfiddle link: https://jsfiddle.net/92gem6zr/




lundi 23 novembre 2020

How to change the state of the checkbox using a method?

I need to create a method and change the state of the checkbox from checked to unchecked and vice versa by calling a method.

onEventListener: (event,props) => {
      if (event.key === " ") {
         console.log ("Check box is "+ !event.target.checked );
           props.onEventListener({onChecked: !event.target.checked});
       }

onChecked will be used to change the state , It is a boolean .

render (
<div>
 <input
            type="checkBox"
            onKeyDown={props.onEventListener}
            defaultChecked = {props.onChecked}

          />
</div>
)



I want to make an e-commerce Filter By Category in Angular

I tried but, I guess I coded exactly opposite that what I wanted.

1. all-trades.component.html

<div
  fxLayout="row"
  fxLayout.lt-md="column"
  fxLayoutAlign="space-between start"
  fxLayoutAlign.lt-md="start stretch"
  *ngIf="crops$ | async"
>
  <div class="container-outer" fxFlex="20">
    <div class="filters">
      <section class="example-section">
        <span class="example-list-section">
          <h1>Select Crop</h1>
        </span>
        <span class="example-list-section">
          <ul>
            <li *ngFor="let filter of nameFilters$ | async">
              <mat-checkbox
                [checked]="filter.checked"
                (change)="onNameFilterChange(filter)"
              >
                
              </mat-checkbox>
            </li>
          </ul>
        </span>
      </section>

      <section class="example-section">
        <span class="example-list-section">
          <h1>Select District</h1>
        </span>
        <span class="example-list-section">
          <ul>
            <li *ngFor="let filter of filteredDistrictCheckboxes$ | async">
              <mat-checkbox
                [checked]="filter.checked"
                (change)="onDistrictFilterChange(filter)"
              >
                
              </mat-checkbox>
            </li>
          </ul>
        </span>
      </section>
    </div>
  </div>
  <div class="content container-outer" fxFlex="80">
    <mat-card
      class="crop-card"
      style="min-width: 17%"
      *ngFor="let crop of filteredCrops$ | async"
      [hidden]="!crop.checked"
    >
      <a [routerLink]="[crop.name]">
        <mat-card-header>
          <img
            mat-card-avatar
            class="example-header-image"
            src="/assets/icons/crops/.PNG"
            alt="crop-image"
          />
          <mat-card-title></mat-card-title>
          <mat-card-subtitle>100 Kgs</mat-card-subtitle>
        </mat-card-header>
      </a>
      <mat-card-content>
        <p>PRICE</p>
      </mat-card-content>
      <mat-card-content>
        <p></p>
      </mat-card-content>
    </mat-card>
  </div>
</div>

2.all-trades.component.ts

import { OnInit } from '@angular/core';
import { Component } from "@angular/core";
import { BehaviorSubject, combineLatest, Observable } from "rxjs";
import { map, shareReplay, switchMap, tap } from "rxjs/operators";
import { Crop } from 'src/app/shared/crop.model';
import { CropService } from '../crop.service';

// dialog box
interface Filter {
  name: string;
  checked: boolean;
}

@Component({
  selector: 'app-all-trades',
  templateUrl: './all-trades.component.html',
  styleUrls: ['./all-trades.component.css'],
})
export class AllTradesComponent implements OnInit {

  crops$: Observable<Crop[]>;
  filteredCrops$: Observable<Crop[]>;
  nameFilters$ = new BehaviorSubject<Filter[]>([]);
  districtFilters$ = new BehaviorSubject<Filter[]>([]);
  filteredDistrictCheckboxes$: Observable<Filter[]>;

  constructor(private cropService: CropService) { }
  ngOnInit(): void {
    this.crops$ = this.cropService.getAllCrops().pipe(
      tap(crops => {
        const names = Array.from(new Set(crops.map(crop => crop.name)));
        this.nameFilters$.next(
          names.map(name => ({ name, checked: true } as Filter))
        );
        const dictricts = Array.from(new Set(crops.map(crop => crop.district)));
        this.districtFilters$.next(
          dictricts.map(name => ({ name, checked: true } as Filter))
        );
      }),
      shareReplay(1)
    );
    this.filteredCrops$ = combineLatest(
      this.crops$,
      this.nameFilters$,
      this.districtFilters$
    ).pipe(
      map(
        ([crops, nameFilters, districtFilters]: [
          Crop[],
          Filter[],
          Filter[]
        ]) => {
          let items = [...crops];
          items = items.filter(item => {
            const associatedNameFilter = nameFilters.find(
              filter => filter.name === item.name
            );
            const associatedDistrictFilter = districtFilters.find(
              filter => filter.name === item.district
            );
            return (
              associatedNameFilter.checked && associatedDistrictFilter.checked
            );
          });
          return items;
        }
      )
    );

    this.filteredDistrictCheckboxes$ = this.nameFilters$.pipe(
      switchMap((nameFilters: Filter[]) => {
        return this.crops$.pipe(
          map(crops => {
            const enabledNames = nameFilters
              .filter(item => item.checked)
              .map(filter => filter.name);
            const enabledDistricts = Array.from(
              new Set(
                crops
                  .filter(crop => enabledNames.includes(crop.name))
                  .map(crop => crop.district)
              )
            );
            const result = this.districtFilters$.value.filter(item =>
              enabledDistricts.includes(item.name)
            );
            return result;
          })
        );
      })
    );
  }
  onChange(event, index, item) {
    item.checked = !item.checked;
    console.log(index, event, item);
  }

3. crop.data.ts

import { Crop } from "./crop.model";

export const CROPS: Crop[] = [
    {
        name: "Rice", // I want this Rice
        checked: true,
        district: "Thane",
        subCategory: [
            {
                id: 1,
                name: "Basmati",
                checked: true
            },
            {
                id: 2,
                name: "Ammamore",
                checked: true
            }
        ]
    },
    {
        name: "Rice", // also this one but on clicking on single Checkbox with name as Rice
        checked: true,
        district: "Nashik",
        subCategory: [
            {
                id: 1,
                name: "Basmati",
                checked: true
            },
            {
                id: 2,
                name: "Ammamore",
                checked: true
            }
        ]
    },
    {
        name: "Wheat",
        checked: true,
        district: "Nashik",
        subCategory: [
            {
                id: 1,
                name: "Durum",
                checked: true
            },
            {
                id: 2,
                name: "Emmer",
                checked: true
            }
        ]
    },
    {
        name: "Barley",
        checked: true,
        district: "Ratnagiri",
        subCategory: [
            {
                id: 1,
                name: "Hulless Barley",
                checked: true
            },
            {
                id: 2,
                name: "Barley Flakes",
                checked: true
            }
        ]
    },
    {
        name: "Barley",
        checked: true,
        district: "Thane",
        subCategory: [
            {
                id: 1,
                name: "Hulless Barley",
                checked: true
            },
            {
                id: 2,
                name: "Barley Flakes",
                checked: true
            }
        ]
    }
];

4. crop.model.ts

export class Crop {
    name: string;
    checked: boolean;
    district: string
    subCategory: Subcategory[];
}

export class Subcategory {
    id: number;
    name: string;
    checked: boolean;
}


Here I am sharing my output result

enter image description here

I want output like this

enter image description here

As you can see on left hand side there is filter, when someone check that checkboxes the result display according to that. But in my scenario all the checkbox is selected by default. i want to make it working excatly like e-commerece filter. Please share code on stackblitz




Issues with CSS checkbox checked not working in nav ul

I have a checkbox like this,

<input type="checkbox" id="check" >
            <label for="check" class="checkbtn">
                <i class="fas fa-bars"></i>
            </label>

but, the check box doesn't work on the check box selector and I don't know why. this is my css nav and check box.

 nav ul{
            position: fixed;
            width: 100%;
            height: 200px;
            background: #2c3e50;
            top: 47px;
            display: none;
            text-align: center;
            padding-left: 0;
            transition: all .5s;
    
        }
    #check:checked ~ nav ul {
            display: block;
        }



how to fill all array values in JSP, if they are empty

I'm doing my first WEB project for college that I just started, and I need that JSP file to send the informations to my data bank, but to send all checkbox values I need to deal with a String array variable, that variable should put the right values in the SQL comand, but it only works if all the 3 checkboxes are checked, and I know it's because I called 3 list itens in the SQL comand, so if the user only checks 2, the 3º one doesn't exist, so I tried to put something like a (If array[1] == null){put a "XXX" value on that array}, but I couldn't make it work.

I tried something like this just to put some value in the empty ones: ` String vserv1; String vserv2; String vserv3;

if(vservA[0] == null){
String vserv1 = "XXX";
}
else{
String vserv1 = vservA[0];
}

if(vservA[1] == null){
String vserv2 = "XXX";
}
else{
String vserv2 = vservA[1];
}

if(vservA[2] == null){
String vserv3 = "XXX";
}
else{
String vserv3 = vservA[2];
}

`

By now I only know some things about HTML, CSS, and just a tiny little about JavaScript and JSP.

And I'm still learning English so... I'm sorry if I wrote something wrong = (.

Thats my code:

<head>
    <link rel="shortcut icon" href="img/ico/top.ico">
    <meta name="viewport" content="device=device-width, initial-scale=1.0">
    <title>Crie sua conta Top Show Pet </title>
    <meta charset = "UTF-8">
  <!--<meta http-equiv="refresh" content="0; URL='http://localhost:9999/TopPet/Pagina-Pet/Top-Pet-(PetForm).html'"/>-->
</head>
<body>

<%@page language="java" import="java.sql.*" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>

<%
  // cria as variaveis e obtem os dados digitados pelo usuario
  String[] vservA       = request.getParameterValues("checkservico");
  String vanimal        = request.getParameter("PetEsc");
  String vdia           = request.getParameter("Data");
  String vhora          = request.getParameter("Hora");


  // variaveis para acessar o banco de dados
  String banco   = "toppetcadastro";
  String usuario = "root";
  String senha   = "";
  String url     = "jdbc:mysql://localhost:3306/" + banco;
  String driver  = "com.mysql.jdbc.Driver";

  // carrega o driver na memoria
    Class.forName( driver );

    // criar variavel para conectar com banco de dados
    Connection conexao ;

  // abrir a conexao com o banco
  conexao = DriverManager.getConnection( url , usuario , senha ) ;
  String select = "SELECT cliente.cpf, cliente.Nome, pet.id from cliente join pet on cliente.CPF = pet.Dono WHERE Email = '"+session.getAttribute("user")+"' and pet.Nome = '"+vanimal+"';";

  // cria o statement
    Statement stm = conexao.createStatement() ;

  // executa o comando do SQL
  ResultSet rs = stm.executeQuery(select);
    rs.next();

    String insert = "INSERT INTO agendado (Servico, Proprietario, Nome_Dono, Animal, Nome_Animal, Dia, Hora) VALUES('"+vservA[0]+" - "+vservA[1]+" - "+vservA[2]+"','"+rs.getString("CPF")+"','"+rs.getString("Nome")+"',"+rs.getString("id")+",'"+vanimal+"','"+vdia+"','"+vhora+"');";

    // executa o comando do SQL
    stm.executeUpdate( insert ) ;

  rs.close();
    stm.close() ;
    conexao.close() ;

    out.print("<br><br>") ;
    out.print("Dados gravados com sucesso!!!") ;

    out.print("<br><br>") ;
    out.print("<a href='http://localhost:9999/TopPet/Pagina-Agendar/Agendamento.jsp'>Continuar</a>") ;
%>

</body>
</html>```



Databinding when data types are different

I have a DataGridview sourced from an Access database. When I choose a row in the DataGridview it populates the respective controls in the UI. This works great.

The UI has a series of checkboxes for usability purposes. My problem is the column in Access is not boolean. For example, when I add a record one checkbox says something like, "student is separated". When adding a record the field(column) in the database is entered as either separated or retained. This is because I export reports that would make no sense to the end user with "yes" or "no".

But I am completely lost doing this in reverse. That is to say, when I select a row that says "separated" in that column, the checkbox in the UI needs to be checked. I don't know how to do this, and I can't even find any posts describing what I am trying to do.

How can I make the checkbox show what I want when the source data isn't a boolean?

I would have no issue writing conditional statements to figure out the data, but since databinding is basically a one-click operation in the properties window, I'm not sure where I would place any conditionals.




How to select checked boxes names when clicking button in Powershell

Action ADD CLICK on my button $Tab1BTNCreation: i want to copy a folder including some subfolders (mentionnned by checked checkboxes) to a certain destination. The selected checkboxes indicates exaclty wich folder to copy. I've tried a lot of options but nothing is working at that point. The concerned variables are $Checkboxes and $CheckboxesNames in TAB1. I've gave names to my checkboxes variables so the '-unclude' parameter can recognize the folder name... Scroll down till '///// HERE //// Bouton Creation /////////' Thank you for your help.

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass 
Add-type -Assembly System.Windows.Forms 

[void][System.Reflection.Assembly]::LoadWithPartialName('presentationframework')

[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="CR`ÉATION" 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 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" BorderBrush="#FF23BBB8" BorderThickness="0" FontSize="10" Foreground="#797979"/>
                    <ComboBox x:Name="CBBdeSerie1" HorizontalAlignment="Left" Height="20" Margin="227,120,0,0" VerticalAlignment="Top" Width="211" BorderBrush="#FF23BBB8" BorderThickness="0" FontSize="10" Foreground="#797979"/>
                    <ComboBox x:Name="CBBversRep1" HorizontalAlignment="Left" Height="20" Margin="107,159,0,0" VerticalAlignment="Top" Width="103" BorderBrush="#FF23BBB8" BorderThickness="0" 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"/>
                    </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'erreurs." Foreground="#797979" Padding="6" FontSize="10" VerticalAlignment="Top" Width="383"/>

                </Grid>
            </TabItem>



            <TabItem x:Name="tab2" Header="SYNCHRONISATION" 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 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"/>
                    
                    <TextBox x:Name="TBmessages2" HorizontalAlignment="Left" Height="145" Margin="55,238,0,0" TextWrapping="Wrap"  VerticalScrollBarVisibility="Visible" Text="Affichage des messages d'erreurs." 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="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" BorderBrush="#FF23BBB8" BorderThickness="0" FontSize="10" Foreground="#797979"/>        
                    <ComboBox x:Name="CBBliste3" HorizontalAlignment="Left" Height="20" Margin="542,159,0,0" VerticalAlignment="Top" Width="150" BorderBrush="#FF23BBB8" BorderThickness="0" 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'erreurs." 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 )

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

#Connect to Controls TAB2
$Tab1CBB1 = $Window.FindName('CBBdeRep1')
$Tab1CBB2 = $Window.FindName('CBBdeSerie1')
$Tab1CBB3 = $Window.FindName('CBBversRep1')
$Tab1TB4 = $Window.FindName('TBversSerie1')
($Tab1CBbin = $Window.FindName('CBbin1')).Name = 'Bin'
($Tab1CBexport = $Window.FindName('CBexport1')).Name = 'Export'
($Tab1CBparam = $Window.FindName('CBparam1')).Name = 'Param'
($Tab1CBlist = $Window.FindName('CBlist1')).Name = 'List'
($Tab1CBscript = $Window.FindName('CBscript1')).Name = 'QA\Script'
($Tab1CBtemplate = $Window.FindName('CBtemplate1')).Name = 'Template'
$Tab1TBmessages = $Window.findName("TBmessages1")
$Tab1BTNcreation = $Window.findName("BTNcreation")


#Connect to Controls TAB2
$Tab2CBB1 = $Window.FindName('CBBdeRep2')
$Tab2CBB2 = $Window.FindName('CBBdeSerie2')
$Tab2CBB3 = $Window.FindName('CBBversRep2')
$Tab2CBB4 = $Window.FindName('CBBversSerie2')
$Tab2CBbin = $Window.FindName('CBbin2')
$Tab2CBexport = $Window.FindName('CBbin2')
$Tab2CBparam = $Window.FindName('CBparam2')
$Tab2CBlist = $Window.FindName('CBlist2')
$Tab2CBscript = $Window.FindName('CBscript2')
$Tab2CBtemplate = $Window.FindName('CBtemplate2')
$Tab2TBmessages = $Window.findName("TBmessages2")
$Tab2BTNsynchro = $Window.findName("BTNsyncro")

#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  ----- 
$pathDE='E:\Scripts\BibliothequePowershell\Melanie\GUI-ProgTestQA\Simulation\DE\'
$pathVERS='E:\Scripts\BibliothequePowershell\Melanie\GUI-ProgTestQA\Simulation\VERS\'
$pathDBQcust01='E:\Scripts\BibliothequePowershell\Melanie\GUI-ProgTestQA\Simulation\DE\DBQcust01\Sets\' 
$pathQA14='E:\Scripts\BibliothequePowershell\Melanie\GUI-ProgTestQA\Simulation\DE\QA14\Sets\'
$pathQA15='E:\Scripts\BibliothequePowershell\Melanie\GUI-ProgTestQA\Simulation\DE\QA15\Sets\'
$pathSERIE = 'E:\Scripts\BibliothequePowershell\Melanie\GUI-ProgTestQA\Simulation\DE\QA14\Sets'  #simulation
$pathSIMULATION = 'E:\Scripts\BibliothequePowershell\Melanie\GUI-ProgTestQA\Simulation'
#endregion ----

#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



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

#region /// ComboBox 1 : DE folder
$FoldersCBB1 = @('--- choisir ---','DBQcust01','QA14','QA15')
$Tab1CBB1.SelectedItem = '--- choisir ---'
foreach ($Folder in $FoldersCBB1) {
$Tab1CBB1.Items.Add($Folder)
}
#endregion



#region /// ComboBox 2 : DE SERIE    (éventuellement changer pour SWITCH)
$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)
            }
   }

})

#endregion




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

#endregion




#region /// TextBox 4 : VERS Série 
#à venir (essayer de mettre le contenu des sélections des cbb automatiquement dans le textbox)

$Tab1TB4.text = "SÉRIE+ÉQUIPE"
#endregion




#region ///// HERE //// Bouton Creation  /////////

$Tab1BTNcreation.Add_Click({


    $SelectionCBB1 = ($Tab1CBB1.SelectedValue)
    $SelectionCBB2 = ($Tab1CBB2.SelectedValue)
    $SelectionCBB3 = ($Tab1CBB3.SelectedValue)
    $SelectionTB4 = ($Tab1TB4.Text)
    

    $CheckedBoxes = get-variable $Tab1CB* | Where-object {$_.IsChecked = $true}
    $CheckBoxesNames= $CheckedBoxes.Name


   New-item -ItemType Directory -Path "$pathVERS\$SelectionCBB3" -Name "$SelectionTB4"
   
   Copy-Item -Path "$pathDE\$SelectionCBB1\$SelectionCBB2" -include $CheckedBoxesNames -Recurse -Destination "$pathVERS\$SelectionCBB3\$SelectionTB4" 

})

#endregion






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

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






$Window.ShowDialog() | out-null