Question Interface Graphique PowerShell

Plus d'informations
il y a 8 ans 1 semaine #21673 par Faucon
Bonjour,

Voilà je doit développer une GUI en powershell qui facilitera le travail de l'équipe exploitation pour livrer les packages SSIS sur nos serveurs SQL Server, il m'a été demandé d'afficher l'interface en ligne de commande dans mon interface graphique.

J'aurais aimé savoir si c'était possible car je n'ai rien trouvé sur le net.

Pour être plus clair vous trouverez en PJ un \"montage\" de ce que je souhaiterais faire.

Merci d'avance,

Mitakue <br><br>Message édité par: Mitakue, à: 12/04/16 09:52

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 8 ans 1 semaine #21677 par Laurent Dardenne
Salut,
as-tu envisager d'utiliser un plugin ISE ?

Tu peux associer une console à un GUI , mais pour l'intégrer dans une zone de ta fenêtre regarde l'intégration d'un host Powershell je crois. Mais là le C# est peut être préférable.
Un coup de reverse sur ISE te le confirmera.<br><br>Message édité par: Laurent Dardenne, à: 12/04/16 12:55

Tutoriels PowerShell

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 8 ans 1 semaine #21678 par Faucon
Réponse de Faucon sur le sujet Re:Interface Graphique PowerShell
Salut,

Merci pour ta réponse, j'ai fait quelques recherche sur internet et je pense changer ma façon de faire. Je souhaite afficher le résultat de ma commande dans une textbox.

J'ai donc créer une textbox malheureusement je peux en changer la longueur mais pas la hauteur.

Voici mon code :
[code:1]
#################################################
# NAME : PS1-TFS_Dispatcher.ps1
# AUTHOR : mfaucon
# DATE : 22/12/2015
# VERSION : v1.0.0
# COMMENT : Interface Graphique Script de Livraison
#################################################

# Chargement des Windows Form
#region
[void][System.Reflection.Assembly]::LoadWithPartialName(\&quot;System.Windows.Forms\&quot;«»)
[void][System.Reflection.Assembly]::LoadWithPartialName(\&quot;System.Drawing\&quot;«»)
#endregion

#################################################
# CONFIGURATION DE LA WINDOWS FORM
#################################################

# Creation de la form principale
$form = New-Object Windows.Forms.Form

# Pour bloquer le resize du form et supprimer les icones Minimize and Maximize
$form.FormBorderStyle = [System.Windows.Forms.FormBorderStyle]::FixedDialog
$form.MaximizeBox = $true
$form.MinimizeBox = $true

# Choix du titre
$form.Text = \&quot;Livraison RFC\&quot;

# Choix de la taille
$form.Size = New-Object System.Drawing.Size(1280,1024)

#################################################
# DEFINITION DES VARIABLES
#################################################

# URL vers IWS
$URL = \&quot;myit.carmignac.com/isilogwebsystem/HOMEP...amp;FieldValue\";

#Taille TextBox
$hauteur = 20
$longueur = 160
$longueur2 = 540

#################################################
# AJOUT DES COMPOSANTS
#################################################
#region

#################################################
# BOUTONS
#################################################
# Bouton RFC
$button_rfc = New-Object System.Windows.Forms.Button
$button_rfc.Text = \&quot;Rechercher\&quot;
$button_rfc.Size = New-Object System.Drawing.Size(100,25)
$button_rfc.Location = New-Object System.Drawing.Size(370,15)
$button_rfc.Anchor = \&quot;Top, Left\&quot;

# Bouton livraison
$button_livraison = New-Object System.Windows.Forms.Button
$button_livraison.Text = \&quot;Livraison\&quot;
$button_livraison.Size = New-Object System.Drawing.Size(100,25)
$button_livraison.Location = New-Object System.Drawing.Size(20,550)
$button_livraison.BackColor =[System.Drawing.Color]::CornflowerBlue
$button_livraison.Anchor = \&quot;Bottom,Left\&quot;


# Bouton Quitter
$button_quit = New-Object System.Windows.Forms.Button
$button_quit.Text = \&quot;Fermer\&quot;
$button_quit.Size = New-Object System.Drawing.Size(100,25)
$button_quit.Location = New-Object System.Drawing.Size(600,550)
$button_quit.Anchor = \&quot;Bottom,Left\&quot;

# Bouton RFC Mere
$button_url = New-Object System.Windows.Forms.Button
$button_url.Text = \&quot;IWS\&quot;
$button_url.Size = New-Object System.Drawing.Size(40,25)
$button_url.Location = New-Object System.Drawing.Size(760,15)
# $button_url.Anchor = ([System.Windows.Forms.AnchorStyles]::Right [System.Windows.Forms.AnchorStyles]::Top)
$button_url.Anchor = \&quot;Top,Right\&quot;

# Bouton Affichage log
$button_log = New-Object System.Windows.Forms.Button
$button_log.Text = \&quot;Log\&quot;
$button_log.Size = New-Object System.Drawing.Size(100,25)
$button_log.Location = New-Object System.Drawing.Size(300,550)
$button_log.BackColor =[System.Drawing.Color]::ForestGreen
$button_log.Anchor = \&quot;Bottom,Left\&quot;

# Bouton Affichage log
$button_clear = New-Object System.Windows.Forms.Button
$button_clear.Text = \&quot;Effacer\&quot;
$button_clear.Size = New-Object System.Drawing.Size(100,25)
$button_clear.Location = New-Object System.Drawing.Size(450,550)
$button_clear.Anchor = \&quot;Bottom,Left\&quot;

#################################################
# LABELS ET TEXTBOX
#################################################

#
# Label et TextBox UAT/RFC
#
$label_rfc = New-Object System.Windows.Forms.Label
$label_rfc.AutoSize = $true
$label_rfc.Location = New-Object System.Drawing.Point(20,20)
$label_rfc.Text = \&quot;Référence UAT / MEP : \&quot;

$textbox_rfc = New-Object System.Windows.Forms.TextBox
$textbox_rfc.Location = New-Object System.Drawing.Point(200,20)
$textbox_rfc.Name = 'textbox_rfc'
$textbox_rfc.Size = New-Object System.Drawing.Size($longueur,$hauteur)
$textbox_rfc.Text = \&quot;\&quot;

#
# Label et TextBox Application
#
$label_appli = New-Object System.Windows.Forms.Label
$label_appli.AutoSize = $true
$label_appli.Location = New-Object System.Drawing.Point(20,220)
$label_appli.Name = 'label_appli'
$label_appli.Text = \&quot;Application :\&quot;

$textbox_appli = New-Object System.Windows.Forms.Textbox
$textbox_appli.Location = New-Object System.Drawing.Point(200,220)
$textbox_appli.Name = 'textbox_rfc'
$textbox_appli.Size = New-Object System.Drawing.Size($longueur,$hauteur)
$textbox_appli.Text = \&quot;\&quot;

#
# Label et TextBox Chemin
#
$label_chemin = New-Object System.Windows.Forms.Label
$label_chemin.AutoSize = $true
$label_chemin.Location = New-Object System.Drawing.Point(20,260)
$label_chemin.Name = 'label_chemin'
$label_chemin.Text = \&quot;Emplacement TFS :\&quot;

$textbox_chemin = New-Object System.Windows.Forms.TextBox
$textbox_chemin.Location = New-Object System.Drawing.Point(200,260)
$textbox_chemin.Name = 'textbox_rfc'
$textbox_chemin.Size = New-Object System.Drawing.Size($longueur2,$hauteur)
$textbox_chemin.Text = \&quot;\&quot;

#
# Label et TextBox Label
#
$label_label = New-Object System.Windows.Forms.Label
$label_label.AutoSize = $true
$label_label.Location = New-Object System.Drawing.Point(20,300)
$label_label.Name = 'label_label'
$label_label.Text = \&quot;Label :\&quot;

$textbox_label = New-Object System.Windows.Forms.TextBox
$textbox_label.Location = New-Object System.Drawing.Point(200,300)
$textbox_label.Name = 'textbox_rfc'
$textbox_label.Size = New-Object System.Drawing.Size($longueur2,$hauteur)
$textbox_label.Text = \&quot;\&quot;

#
# Label et TextBox Environnement
#
$label_env = New-Object System.Windows.Forms.Label
$label_env.AutoSize = $true
$label_env.Location = New-Object System.Drawing.Point(20,340)
$label_env.Name = 'label_env'
$label_env.Text = \&quot;Environnement :\&quot;

$textbox_env = New-Object System.Windows.Forms.TextBox
$textbox_env.Location = New-Object System.Drawing.Point(200,340)
$textbox_env.Name = 'textbox_env'
$textbox_env.Size = New-Object System.Drawing.Size($longueur,$hauteur)
$textbox_env.Text = \&quot;\&quot;

#
# Label et TextBox Option
#
$label_option = New-Object System.Windows.Forms.Label
$label_option.AutoSize = $true
$label_option.Location = New-Object System.Drawing.Point(20,380)
$label_option.Name = 'label_option'
$label_option.Text = \&quot;Option :\&quot;

$textbox_option = New-Object System.Windows.Forms.TextBox
$textbox_option.Location = New-Object System.Drawing.Point(200,380)
$textbox_option.Name = 'textbox_option'
$textbox_option.Size = New-Object System.Drawing.Size($longueur,$hauteur)
$textbox_option.Text = \&quot;\&quot;

#
# Label et TextBox TFS
#
$label_tfs = New-Object System.Windows.Forms.Label
$label_tfs.AutoSize = $true
$label_tfs.Location = New-Object System.Drawing.Point(20,420)
$label_tfs.Name = 'label_tfs'
$label_tfs.Text = \&quot;Version TFS :\&quot;

$textbox_tfs = New-Object System.Windows.Forms.TextBox
$textbox_tfs.Location = New-Object System.Drawing.Point(200,420)
$textbox_tfs.Name = 'textbox_tfs'
$textbox_tfs.Size = New-Object System.Drawing.Size($longueur,$hauteur)
$textbox_tfs.Text = \&quot;\&quot;

#
# Label et TextBox Project
#
$label_project = New-Object System.Windows.Forms.Label
$label_project.AutoSize = $true
$label_project.Location = New-Object System.Drawing.Point(20,460)
$label_project.Name = 'label_project'
$label_project.Text = \&quot;Project Collection :\&quot;

$textbox_project = New-Object System.Windows.Forms.TextBox
$textbox_project.Location = New-Object System.Drawing.Point(200,460)
$textbox_project.Name = 'textbox_project'
$textbox_project.Size = New-Object System.Drawing.Size($longueur,$hauteur)
$textbox_project.Text = \&quot;\&quot;

# Label 11
#
# Label et TextBox Demandeur
#
$label_lib = New-Object System.Windows.Forms.Label
$label_lib.AutoSize = $true
$label_lib.Location = New-Object System.Drawing.Point(20,60)
$label_lib.Name = 'label_lib'
$label_lib.Text = \&quot;Libellé de la RFC :\&quot;


#$textbox_lib = New-Object System.Windows.Forms.RichTextBox
$textbox_lib = New-Object System.Windows.Forms.TextBox
$textbox_lib.Location = New-Object System.Drawing.Point(200,60)
$textbox_lib.Name = 'textbox_lib'
#$textbox_lib.Size = New-Object System.Drawing.Size($longueur2,$hauteur + 40)
$textbox_lib.Size = New-Object System.Drawing.Size($longueur2,90)
$textbox_lib.Text = \&quot;\&quot;
$textbox_lib.Enabled = $false

#
# Label et TextBox Demandeur
#
$label_owner = New-Object System.Windows.Forms.Label
$label_owner.AutoSize = $true
$label_owner.Location = New-Object System.Drawing.Point(20,180)
$label_owner.Name = 'label_owner'
$label_owner.Text = \&quot;Demandeur :\&quot;

$textbox_owner = New-Object System.Windows.Forms.TextBox
$textbox_owner.Location = New-Object System.Drawing.Point(200,180)
$textbox_owner.Name = 'textbox_lib'
$textbox_owner.Size = New-Object System.Drawing.Size($longueur,$hauteur)
$textbox_owner.Text = \&quot;\&quot;
$textbox_owner.Enabled = $false

#
# Label et TextBox Date de livraison souhaitée
#
$label_date = New-Object System.Windows.Forms.Label
$label_date.AutoSize = $true
$label_date.Location = New-Object System.Drawing.Point(420,180)
$label_date.Name = 'label_date'
$label_date.Text = \&quot;Date de livraison souhaitée :\&quot;

$textbox_date = New-Object System.Windows.Forms.TextBox
$textbox_date.Location = New-Object System.Drawing.Point(580,180)
$textbox_date.Name = 'textbox_date'
$textbox_date.Size = New-Object System.Drawing.Size($longueur,$hauteur)
$textbox_date.Text = \&quot;\&quot;
$textbox_date.Enabled = $false


#
# Label et TextBox Date de livraison souhaitée
#
$label_code = New-Object System.Windows.Forms.Label
$label_code.AutoSize = $true
$label_code.Location = New-Object System.Drawing.Point(480,20)
$label_code.Name = 'label_code'
$label_code.Text = \&quot;Référence RFC :\&quot;

# TextBox Code
$textbox_code = New-Object System.Windows.Forms.TextBox
$textbox_code.Location = New-Object System.Drawing.Point(580,20)
$textbox_code.Name = 'textbox_code'
$textbox_code.Size = New-Object System.Drawing.Size($longueur,$hauteur)
$textbox_code.Text = \&quot;\&quot;
$textbox_code.Enabled = $false


#
# Label et TextBox Categorie RFC
#
$label_category = New-Object System.Windows.Forms.Label
$label_category.AutoSize = $true
$label_category.Location = New-Object System.Drawing.Point(20,100)
$label_category.Name = 'label_category'
$label_category.Text = \&quot;Catégorie RFC :\&quot;

# TextBox Code
$textbox_category = New-Object System.Windows.Forms.TextBox
$textbox_category.Location = New-Object System.Drawing.Point(200,100)
$textbox_category.Name = 'textbox_category'
$textbox_category.Size = New-Object System.Drawing.Size($longueur,$hauteur)
$textbox_category.Text = \&quot;\&quot;
$textbox_category.Enabled = $false

$textbox_results = New-Object System.Windows.Forms.Textbox
$textbox_results.Location = New-Object System.Drawing.Point(20,600)
$textbox_results.Name = 'textbox_results'
$textbox_results.Size = New-Object System.Drawing.Size(800,800)
$textbox_results.Text = \&quot;\&quot;

# Apparition des champs une fois la RFC renseignee
$label_appli.Visible = $false
$textbox_appli.Visible = $false
$label_chemin.Visible = $false
$textbox_chemin.Visible = $false
$label_label.Visible = $false
$textbox_label.Visible = $false
$label_env.Visible = $false
$textbox_env.Visible = $false
$label_option.Visible = $false
$textbox_option.Visible = $false
$label_tfs.Visible = $false
$textbox_tfs.Visible = $false
$label_project.Visible = $false
$textbox_project.Visible = $false
$label_lib.Visible = $false
$textbox_lib.Visible = $false
$label_owner.Visible = $false
$textbox_owner.Visible = $false
$label_date.Visible = $false
$textbox_date.Visible = $false
$label_code.Visible = $false
$textbox_code.Visible = $false
$button_url.Visible = $false
$button_log.Visible = $false
$button_clear.Visible = $false
$button_livraison.Visible = $false
$label_category.Visible = $false
$textbox_category.Visible = $false


#endregion
#################################################
# GESTION DES EVENEMENTS
#################################################
#region
# Gestion event quand on clique sur le bouton Fermer
$button_quit.Add_Click(
{
$form.Close();
})



# Gestion event quand on clique sur le bouton RFC
$button_rfc.Add_Click(
{
#Recuperation des Information de la RFC via une procedure stockee
$SQLServer=\&quot;NOMSERVEUR/INSTANCE\&quot;
$SQLDBName= \&quot;DATABASE\&quot;
$SqlConnection = new-object system.data.sqlclient.sqlconnection
$SqlConnection.connectionstring = \&quot;Server= $SQLServer; database= $SQLDBName;Integrated Security = True\&quot;
$SqlConnection.Open()
$SqlQuery = \&quot;dbo.ps_Get_RFC_DeliveryInfos\&quot;

$SqlCmd = New-object system.data.sqlclient.SqlCommand
$SqlCmd.connection = $SqlConnection
$SqlCmd.commandtext = $SqlQuery
$SqlCmd.CommandType = [System.Data.CommandType]'StoredProcedure'
$SqlCmd.Parameters.Add(\&quot;@Ref_Code\&quot;,$textbox_rfc.Text) | Out-null
$SqlCmd.Parameters.Add(\&quot;@Info1\&quot;,[system.data.SqlDbType]::Nvarchar,'255') | Out-null
$SqlCmd.Parameters[\&quot;@Info1\&quot;].Direction = [system.Data.ParameterDirection]::Output
$SqlCmd.Parameters.Add(\&quot;@Info2\&quot;,[system.data.SqlDbType]::Nvarchar,'255') | Out-null
$SqlCmd.Parameters[\&quot;@Info2\&quot;].Direction = [system.Data.ParameterDirection]::Output
$SqlCmd.Parameters.Add(\&quot;@Info3\&quot;,[system.data.SqlDbType]::Nvarchar,'255') | Out-null
$SqlCmd.Parameters[\&quot;@Info3\&quot;].Direction = [system.Data.ParameterDirection]::Output
$SqlCmd.Parameters.Add(\&quot;@Info4\&quot;,[system.data.SqlDbType]::Nvarchar,'255') | Out-null
$SqlCmd.Parameters[\&quot;@Info4\&quot;].Direction = [system.Data.ParameterDirection]::Output
$SqlCmd.Parameters.Add(\&quot;@Info5\&quot;,[system.data.SqlDbType]::Nvarchar,'255') | Out-null
$SqlCmd.Parameters[\&quot;@Info5\&quot;].Direction = [system.Data.ParameterDirection]::Output
$SqlCmd.Parameters.Add(\&quot;@Info6\&quot;,[system.data.SqlDbType]::Nvarchar,'255') | Out-null
$SqlCmd.Parameters[\&quot;@Info6\&quot;].Direction = [system.Data.ParameterDirection]::Output
$SqlCmd.Parameters.Add(\&quot;@Info7\&quot;,[system.data.SqlDbType]::Nvarchar,'255') | Out-null
$SqlCmd.Parameters[\&quot;@Info7\&quot;].Direction = [system.Data.ParameterDirection]::Output
$SqlCmd.Parameters.Add(\&quot;@RFC_Title\&quot;,[system.data.SqlDbType]::Nvarchar,'255') | Out-null
$SqlCmd.Parameters[\&quot;@RFC_Title\&quot;].Direction = [system.Data.ParameterDirection]::Output
$SqlCmd.Parameters.Add(\&quot;@RFC_Owner\&quot;,[system.data.SqlDbType]::Nvarchar,'255') | Out-null
$SqlCmd.Parameters[\&quot;@RFC_Owner\&quot;].Direction = [system.Data.ParameterDirection]::Output
$SqlCmd.Parameters.Add(\&quot;@RFC_WishDt\&quot;,[system.data.SqlDbType]::Nvarchar,'255') | Out-null
$SqlCmd.Parameters[\&quot;@RFC_WishDt\&quot;].Direction = [system.Data.ParameterDirection]::Output
$SqlCmd.Parameters.Add(\&quot;@RFC_Code\&quot;,[system.data.SqlDbType]::Nvarchar,'255') | Out-null
$SqlCmd.Parameters[\&quot;@RFC_Code\&quot;].Direction = [system.Data.ParameterDirection]::Output
$SqlCmd.Parameters.Add(\&quot;@RFC_Category\&quot;,[system.data.SqlDbType]::Nvarchar,'255') | Out-null
$SqlCmd.Parameters[\&quot;@RFC_Category\&quot;].Direction = [system.Data.ParameterDirection]::Output
$SqlCmd.ExecuteNonQuery() | Out-null

#Remplissage TextBox avec infos de la RFC
$textbox_appli.Text = $SqlCmd.Parameters[\&quot;@Info1\&quot;].value
$textbox_chemin.Text = $SqlCmd.Parameters[\&quot;@Info2\&quot;].value
$textbox_label.Text = $SqlCmd.Parameters[\&quot;@Info3\&quot;].value
$textbox_env.Text = $SqlCmd.Parameters[\&quot;@Info4\&quot;].value
$textbox_option.Text = $SqlCmd.Parameters[\&quot;@Info5\&quot;].value
$textbox_tfs.Text = $SqlCmd.Parameters[\&quot;@Info6\&quot;].value
$textbox_project.Text = $SqlCmd.Parameters[\&quot;@Info7\&quot;].value
$textbox_lib.Text = $SqlCmd.Parameters[\&quot;@RFC_Title\&quot;].value
$textbox_owner.Text = $SqlCmd.Parameters[\&quot;@RFC_Owner\&quot;].value
$textbox_date.Text = $SqlCmd.Parameters[\&quot;@RFC_WishDt\&quot;].value
$textbox_code.Text = $SqlCmd.Parameters[\&quot;@RFC_Code\&quot;].value
$textbox_category.Text = $SqlCmd.Parameters[\&quot;@RFC_Category\&quot;].value
$SqlConnection.Close()

# Apparition des champs une fois la RFC renseignee
$label_appli.Visible = $true
$textbox_appli.Visible = $true
$label_chemin.Visible = $true
$textbox_chemin.Visible = $true
$label_label.Visible = $true
$textbox_label.Visible = $true
$label_env.Visible = $true
$textbox_env.Visible = $true
$label_option.Visible = $true
$textbox_option.Visible = $true
$label_tfs.Visible = $true
$textbox_tfs.Visible = $true
$label_project.Visible = $true
$textbox_project.Visible = $true
$label_lib.Visible = $true
$textbox_lib.Visible = $true
$label_owner.Visible = $true
$textbox_owner.Visible = $true
$label_date.Visible = $true
$textbox_date.Visible = $true
$label_code.Visible = $true
$textbox_code.Visible = $true
$button_url.Visible = $true
$button_log.Visible = $true
$button_clear.Visible = $true
$button_livraison.Visible = $true
$label_category.Visible = $true
$textbox_category.Visible = $true
$textbox_results.Visible = $true

})

# Gestion event quand on clique sur le bouton livraison
$button_livraison.Add_Click(
{
$textbox_results.Text = Get-Process
#. \&quot;C:\Script_Livraison\PS1-TFS_Dispatcher_V4.15.ps1\&quot; -Application $textbox_appli.Text -Chemin_Projet $textbox_chemin.Text -Label $textbox_label.Text -Env $textbox_env.Text -option $textbox_option.Text -TFS $textbox_tfs.Text -ProjectCollection $textbox_project.Text -Ref_RFC $textbox_rfc.Text

}
)

#Bouton qui permet d'afficher la RFC mere
$button_url.Add_Click(
{
$rfc = $textbox_code.Text
$URL_rfc = \&quot;$URL=$rfc\&quot;
$iexplorer = New-Object -com WScript.Shell
$iexplorer.Run(\&quot;iexplore.exe $($URL_rfc)\&quot;«»)
}
)


# Gestion event quand on clique sur le bouton Fermer
$button_clear.Add_Click(
{

$textbox_rfc.Text = \&quot;\&quot;
$textbox_appli.Text = \&quot;\&quot;
$textbox_chemin.Text = \&quot;\&quot;
$textbox_label.Text = \&quot;\&quot;
$textbox_env.Text = \&quot;\&quot;
$textbox_option.Text = \&quot;\&quot;
$textbox_tfs.Text = \&quot;\&quot;
$textbox_project.Text = \&quot;\&quot;
$textbox_lib.Text = \&quot;\&quot;
$textbox_owner.Text = \&quot;\&quot;
$textbox_date.Text = \&quot;\&quot;
$textbox_code.Text = \&quot;\&quot;
$textbox_category.Text = \&quot;\&quot;

$label_appli.Visible = $false
$textbox_appli.Visible = $false
$label_chemin.Visible = $false
$textbox_chemin.Visible = $false
$label_label.Visible = $false
$textbox_label.Visible = $false
$label_env.Visible = $false
$textbox_env.Visible = $false
$label_option.Visible = $false
$textbox_option.Visible = $false
$label_tfs.Visible = $false
$textbox_tfs.Visible = $false
$label_project.Visible = $false
$textbox_project.Visible = $false
$button_livraison.Visible = $false
$label_lib.Visible = $false
$textbox_lib.Visible = $false
$label_owner.Visible = $false
$textbox_owner.Visible = $false
$label_date.Visible = $false
$textbox_date.Visible = $false
$label_code.Visible = $false
$textbox_code.Visible = $false
$button_url.Visible = $false
$button_log.Visible = $false
$label_category.Visible = $false
$textbox_category.Visible = $false
$textbox_results.Visible = $false

})


#Bouton qui permet d'afficher la log du traitement
$button_log.Add_Click(
{
#Chemin DFS des logs de livraison
$log_path = \&quot;\\carmignac.corp\global\Applications\TEST\Livraisons\Logs\&quot;
if ($textbox_rfc -like 'MEP*')
{
$environnement = \&quot;PRD\&quot;
$appli = $textbox_appli.Text
$log_file = Get-ChildItem -Path \&quot;$log_path\$appli\&quot; -Include $textbox_rfc.Text | Sort-Object -Property CreationTime | Select-Object -Last 1
}
else
{
$environnement = \&quot;UAT\&quot;
$appli = $textbox_appli.Text
$log_file = Get-ChildItem -Path \&quot;$log_path\$appli\&quot; -Include $textbox_rfc.Text | Sort-Object -Property CreationTime | Select-Object -Last 1
}
$notepad = New-Object -ComObject WScript.Shell
$notepad.Run(\&quot;notepad.exe $($log_file.FullName)\&quot;«»)
}
)
#endregion
#################################################
# INSERTION DES COMPOSANTS
#################################################

# Ajout des composants a la Form
$form.Controls.Add($label_rfc)
$form.Controls.Add($textbox_rfc)

$form.Controls.Add($label_appli)
$form.Controls.Add($textbox_appli)
$form.Controls.Add($label_chemin)
$form.Controls.Add($textbox_chemin)
$form.Controls.Add($label_label)
$form.Controls.Add($textbox_label)
$form.Controls.Add($label_env)
$form.Controls.Add($textbox_env)
$form.Controls.Add($label_option)
$form.Controls.Add($textbox_option)
$form.Controls.Add($label_tfs)
$form.Controls.Add($textbox_tfs)
$form.Controls.Add($label_project)
$form.Controls.Add($textbox_project)
$form.Controls.Add($label_lib)
$form.Controls.Add($textbox_lib)
$form.Controls.Add($label_owner)
$form.Controls.Add($textbox_owner)
$form.Controls.Add($label_date)
$form.Controls.Add($textbox_date)
$form.Controls.Add($label_code)
$form.Controls.Add($textbox_code)
$form.Controls.Add($label_category)
$form.Controls.Add($textbox_category)
$form.Controls.Add($textbox_results)
$form.Controls.Add($button_url)
$form.Controls.Add($button_log)
$form.Controls.Add($button_clear)
$form.Controls.Add($button_livraison)


$form.Controls.Add($button_rfc)
$form.Controls.Add($button_quit)

# Affichage de la Windows
$form.ShowDialog()

#################################################
# END OF PROGRAM
#################################################
[/code:1]

J'ai vu sur internet que ce que je voulais faire était possible mais je n'y arrive pas :p.
Merci d'avance.<br><br>Message édité par: Mitakue, à: 18/05/16 17:19

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 8 ans 1 semaine #21679 par Laurent Dardenne
Mitakue écrit:

J'ai vu sur internet que ce que je voulais faire était possible mais je n'y arrive pas

Peux-tu nous communiquer l'url ?

Tutoriels PowerShell

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 8 ans 1 semaine #21680 par Faucon
Réponse de Faucon sur le sujet Re:Interface Graphique PowerShell
Hello,

Voici le lien de ce que j'avais trouvé :

www.sapien.com/blog/2014/12/15/display-o...ui-application-copy/

En faite je me suis rendu compte que la taille d'une textbox était limité à une seule ligne de longueur variable, du coup j'ai décidé d'afficher le résultat de mon clic dans une RichTextBox et ça fait exactement ce que je souhaite, en jouant sur les couleurs on se croirait dans un prompt PS.

Si ça intéresse, je pourrais poster le script quand il sera livré.

Connexion ou Créer un compte pour participer à la conversation.

Plus d'informations
il y a 7 ans 8 mois #22163 par ThomasM
Réponse de ThomasM sur le sujet Re:Interface Graphique PowerShell
Salut !

je suis en train de faire le même genre de scripte mais pour l'ajout et suppression de licences o365.

Ton script m'intéresse qui m'aidera (je l'espère) à comprendre en quoi j'ai failli sur le mien ^^

Si cela ne te dérange pas, je veux bien que tu le mettes ici :)

Bonne fin de journée, A++

Connexion ou Créer un compte pour participer à la conversation.

Temps de génération de la page : 0.104 secondes
Propulsé par Kunena