Getting started with PowerShell TUIs (Creating Console GUI PowerShell Tools) - Jeffery Hicks - …

PowerShell Conference EU
PowerShell Conference EU
4.4 هزار بار بازدید - 12 ماه پیش - In this session, we dive
In this session, we dive into the world of PowerShell and explore Terminal User Interfaces (TUIs) with our expert speaker. The speaker expresses their passion for PowerShell and notes the growth of PowerShell events globally.

They introduce TUIs as their current focus in PowerShell, explaining how they allow for the creation of console-based forms. While the speaker emphasizes PowerShell 7, they mention that the tools showcased are cross-platform compatible.

The Microsoft.PowerShell.ConsoleGUITools module is mentioned as an option for creating TUI-based tools, but the speaker's intention is to demonstrate how to create customized TUIs using the Terminal.GUI assembly. They highlight features like mouse and keyboard input, tab paths, and tab-based app creation.

The speaker briefly mentions additional features such as clipboard support, loops, timers, and event handlers. They assure the audience that all the demos shown in the podcast are available on GitHub.

Moving on, the speaker demonstrates the 'Out-ConsoleGridView' command, showcasing its ability to select and return items in the pipeline. They inform the audience that the upcoming demos require certain setup steps.

In the next segment, the speaker discusses the process of setting up the necessary packages for running terminal GUI scripts. They provide guidance on adjusting the package source and reference specific folders and files required for installation. The Terminal GUI and nstack packages are mentioned, and instructions on how to install and load them are provided. The speaker then walks through a basic "Hello World" example, explaining the steps involved in creating a terminal GUI window. They emphasize the importance of initializing the Terminal GUI application and provide details on customizing the window. The speaker also addresses the blocking nature of the script, exiting the application, and the need for proper cleanup. They touch on color scheme variations and a bug related to leftover artifacts in Windows Terminal. Another "Hello World 2" example is briefly mentioned, along with the potential conflicts that may arise from loading previous versions of Terminal GUI.

In the subsequent segment, the speaker discusses changes made to a demo. They explain the use of the ASCII key value for the escape key due to inconsistencies in using the quit key in PowerShell. The process of creating a GUI window, adding properties and a button is elaborated on. The speaker also showcases the use of mouse interaction in the GUI and gives an example of creating a window with a title and a text box. They mention that the escape key field cannot be changed on the fly and recommend documenting it in the code. The speaker demonstrates adding frames, creating multiple frames with titles and elements, and creating lists in the GUI. They mention the need for trial and error in positioning elements. Lastly, an example is shown where process details are retrieved and displayed using a hash table and a list view in the GUI. Clicking on items in the list triggers an event handler to display corresponding properties in another frame.

In the subsequent segment, the speaker takes the audience through the process of creating menus in a terminal GUI. They note that menus can be trickier to work with, requiring menu objects and included items. The importance of reading documentation or referring to examples is emphasized. The speaker demonstrates running the code, explaining the different menus and menu items created. They showcase specific actions triggered by clicking on menu items, such as displaying a message box or opening a webpage. The speaker emphasizes the usefulness of menus for building full-blown applications and mentions plans to expand on the current project. Progress bars, file dialog boxes, and a TUI credential prompt are briefly discussed as additional topics.
12 ماه پیش در تاریخ 1402/04/24 منتشر شده است.
4,417 بـار بازدید شده
... بیشتر