This is post https://excelfox.com/forum/showthrea...ge53#post12800
https://excelfox.com/forum/showthread.php/2408-Windows-10-and-Office-Excel/page53#Post12800
Week later 29 Apr 2022 Chris surprised me with his first WPF attempt
I was hoping Chris would not get around to doing this for a while, but he has done it very quickly following a week later from his last Live Stream which heavily mentioned the Debloat script.
Chris said he did C stuff at college, ( 22 years ago ) – strange – he said before in a video that he never went to college?
https://www.youtube.com/watch?v=xqBhFPW_LuM
9.36 Live - New Windows Tool-xqBhFPW_LuM_29 04 2022
https://drive.google.com/file/d/1qLz...?usp=drive_web
It looks like Chris has started uploading the first attempts at GitHub: From 28 April, 2022
Share ‘ChrisFirstWPFDeleted.ps1’ https://app.box.com/s/9ek7nd1hoc82nncizr91lf540sm3tblf
What’s going on..
Without looking at detail yet, just gleaning from Laymen info the video:
WPF is some tool to make a nice GUI. Its based on the .Net stuff, but optimised to make a nice GUI. WPF seems to chuck out a “Semmel” ( xml ) coding. That comes from Visual Studio. I guess we can think of it initially, approximately, as a posh GUI that does not limit you to PowerShell.
However, for now, Chris is going to use PowerShell, and the free Visual Studio. For now, we can think of Visual Studio as a development environment like the VB Editor in VBA or the ISE in PowerShell. But its somehow much more all encompassing.
Lets say that again, partly graphically , and in particular showing also what Chris is doing in the video, ( which he mentions has some limitations, but for now he accepts that to keep it all free source in PowerShell .ps1 file. Going into a full executable, will remove some limitations, and he may be in danger of going into that , by the back door… )
What’s going on..and how
Intro:
So the new stuff, somehow made a XML coding that in .Net gives us a nice GUI. Some of that is comprehendible as being obvious what it is referring to. So we can make some simple changes or additions, such as in this example, Chris added a few extra checkboxes.
XML – PowerShell GUI coding
This is an interesting bit: We can paste that XML coding in a normal .txt / .ps1 file, or rather we out that coding in a PowerShell variable, pseudo like
That above is just a random snippet. In the actual thing there is lots of Grid and other stuffCode:$inputXML = @" <Window x:Class="WinUtility.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:WinUtility" mc:Ignorable="d" Background="#777777" Title="Chris Titus Tech's Windows Utility" Height="450" Width="800"> <Viewbox> <Grid Background="#777777" ShowGridLines="False" Name="MainGrid"> # Lots of html / xml like stuff……. </Grid> </Viewbox> </Window> "@
There then follows some very complex and verbose coding that Chris does not understand and I doubt I ever will that makes the objects and there variables available to PowerShell. This worries me a bit, since understanding this coding may never take place
In that complex coding is a final function, that gets the variables from the GUI.
Get-Formvariables
That line is done once, and if I do that code line manually it in the PowerShell Window, then I will get a list of the variables.
Get-Formvariables.jpg
The running of the form also gives these variables: This text file is what comes out in PowerShell on running, followed by my manual run of Get-Formvariables
Because we have the variables we can do things to them as in the old tool script, such as adding Add_Click stuffCode:PS C:\WINDOWS\system32> D:\Temp Opt\GitHub\ChrisNewWPF\ChrisFirstWPFDeleted.ps1 If you need to reference this display again, run Get-FormVariables Found the following interactable elements from our form Name Value ---- ----- WPFadobe System.Windows.Controls.CheckBox Content:Adobe Reader DC IsChecked:False WPFadvancedip System.Windows.Controls.CheckBox Content:Advanced IP Scanner IsChecked:False WPFautohotkey System.Windows.Controls.CheckBox Content:AutoHotkey IsChecked:False WPFbrave System.Windows.Controls.CheckBox Content:Brave IsChecked:False WPFchrome System.Windows.Controls.CheckBox Content:Google Chrome IsChecked:False WPFdiscord System.Windows.Controls.CheckBox Content:Discord IsChecked:False WPFesearch System.Windows.Controls.CheckBox Content:Everything Search IsChecked:False WPFetcher System.Windows.Controls.CheckBox Content:Etcher USB Creator IsChecked:False WPFfirefox System.Windows.Controls.CheckBox Content:Firefox IsChecked:False WPFgimp System.Windows.Controls.CheckBox Content:GIMP (Image Editor) IsChecked:False WPFgithubdesktop System.Windows.Controls.CheckBox Content:GitHub Desktop IsChecked:False WPFIcon System.Windows.Controls.Image WPFimageglass System.Windows.Controls.CheckBox Content:ImageGlass (Image Viewer) IsChecked:False WPFinstall System.Windows.Controls.Button: Start Install WPFMainGrid System.Windows.Controls.Grid WPFmpc System.Windows.Controls.CheckBox Content:Media Player Classic (Video Player) IsChecke... WPFnotepadplus System.Windows.Controls.CheckBox Content:Notepad++ IsChecked:False WPFpowertoys System.Windows.Controls.CheckBox Content:Microsoft Powertoys IsChecked:False WPFputty System.Windows.Controls.CheckBox Content:Putty and WinSCP IsChecked:False WPFsevenzip System.Windows.Controls.CheckBox Content:7-Zip IsChecked:False WPFsharex System.Windows.Controls.CheckBox Content:ShareX (Screenshots) IsChecked:False WPFsumatra System.Windows.Controls.CheckBox Content:Sumatra PDF IsChecked:False WPFTab1 System.Windows.Controls.TabItem Header:Install Content: WPFTab1BT System.Windows.Controls.Button: Install WPFTab2 System.Windows.Controls.TabItem Header:Debloat Content: WPFTab2BT System.Windows.Controls.Button: Debloat WPFTab3 System.Windows.Controls.TabItem Header:Config Content: WPFTab3BT System.Windows.Controls.Button: Config WPFTab4 System.Windows.Controls.TabItem Header:Updates Content: WPFTab4BT System.Windows.Controls.Button: Updates WPFTabNav System.Windows.Controls.TabControl Items.Count:4 WPFterminal System.Windows.Controls.CheckBox Content:Windows Terminal IsChecked:False WPFTitusPB System.Windows.Controls.ProgressBar Minimum:0 Maximum:100 Value:0 WPFttaskbar System.Windows.Controls.CheckBox Content:Translucent Taskbar IsChecked:False WPFvlc System.Windows.Controls.CheckBox Content:VLC (Video Player) IsChecked:False WPFvscode System.Windows.Controls.CheckBox Content:VS Code IsChecked:False WPFvscodium System.Windows.Controls.CheckBox Content:VS Codium IsChecked:False PS C:\WINDOWS\system32> Get-FormVariables Found the following interactable elements from our form Name Value ---- ----- WPFadobe System.Windows.Controls.CheckBox Content:Adobe Reader DC IsChecked:False WPFadvancedip System.Windows.Controls.CheckBox Content:Advanced IP Scanner IsChecked:False WPFautohotkey System.Windows.Controls.CheckBox Content:AutoHotkey IsChecked:False WPFbrave System.Windows.Controls.CheckBox Content:Brave IsChecked:False WPFchrome System.Windows.Controls.CheckBox Content:Google Chrome IsChecked:False WPFdiscord System.Windows.Controls.CheckBox Content:Discord IsChecked:False WPFesearch System.Windows.Controls.CheckBox Content:Everything Search IsChecked:False WPFetcher System.Windows.Controls.CheckBox Content:Etcher USB Creator IsChecked:False WPFfirefox System.Windows.Controls.CheckBox Content:Firefox IsChecked:False WPFgimp System.Windows.Controls.CheckBox Content:GIMP (Image Editor) IsChecked:False WPFgithubdesktop System.Windows.Controls.CheckBox Content:GitHub Desktop IsChecked:False WPFIcon System.Windows.Controls.Image WPFimageglass System.Windows.Controls.CheckBox Content:ImageGlass (Image Viewer) IsChecked:False WPFinstall System.Windows.Controls.Button: Start Install WPFMainGrid System.Windows.Controls.Grid WPFmpc System.Windows.Controls.CheckBox Content:Media Player Classic (Video Player) IsChecke... WPFnotepadplus System.Windows.Controls.CheckBox Content:Notepad++ IsChecked:False WPFpowertoys System.Windows.Controls.CheckBox Content:Microsoft Powertoys IsChecked:False WPFputty System.Windows.Controls.CheckBox Content:Putty and WinSCP IsChecked:False WPFsevenzip System.Windows.Controls.CheckBox Content:7-Zip IsChecked:False WPFsharex System.Windows.Controls.CheckBox Content:ShareX (Screenshots) IsChecked:False WPFsumatra System.Windows.Controls.CheckBox Content:Sumatra PDF IsChecked:False WPFTab1 System.Windows.Controls.TabItem Header:Install Content: WPFTab1BT System.Windows.Controls.Button: Install WPFTab2 System.Windows.Controls.TabItem Header:Debloat Content: WPFTab2BT System.Windows.Controls.Button: Debloat WPFTab3 System.Windows.Controls.TabItem Header:Config Content: WPFTab3BT System.Windows.Controls.Button: Config WPFTab4 System.Windows.Controls.TabItem Header:Updates Content: WPFTab4BT System.Windows.Controls.Button: Updates WPFTabNav System.Windows.Controls.TabControl Items.Count:4 WPFterminal System.Windows.Controls.CheckBox Content:Windows Terminal IsChecked:False WPFTitusPB System.Windows.Controls.ProgressBar Minimum:0 Maximum:100 Value:0 WPFttaskbar System.Windows.Controls.CheckBox Content:Translucent Taskbar IsChecked:False WPFvlc System.Windows.Controls.CheckBox Content:VLC (Video Player) IsChecked:False WPFvscode System.Windows.Controls.CheckBox Content:VS Code IsChecked:False WPFvscodium System.Windows.Controls.CheckBox Content:VS Codium IsChecked:False PS C:\WINDOWS\system32>





Reply With Quote
Bookmarks