Hi All,
I have a question about a programm I’m creating for my collegues, the setup is as follow:
Use a .cmd file to start the main form:
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ExecutionPolicy Bypass -file "%WorkingDir%\Bin\LaunchConsole.ps1"
In this file I call all the functions and set some start variables:
# Set start location and include other scripts $ScriptPath = split-path -parent $MyInvocation.MyCommand.Definition $ProgramRoot = Split-Path -Path $ScriptPath -Parent # Load all scripts Get-ChildItem ( Join-Path ( $ScriptPath ) \Lib\ ) | Where { $_.Name -notlike '_*' -and $_.Name -notlike 'ext_*' -and $_.Name -like '*.ps1'} | ForEach { #Write-Host $_.FullName #<-- Uncomment this to show / print all included files. . $_.FullName } Form-Main # Remove leftover functions Remove-Item function:\add*
The Form-Main is a “Windows Form” Form, a while ago I started with some experiments on WPF (Link) and would linke to create some more WPF functions and convert my pop-ups and progressbars to WPF. I’ve created a Edit Settings screen that pop-s up after clicking Options–> Settings but there are some things that are going wrong. The function that is called is View-Settings and I use a XML file to save and load settings for the app and customers:
XML Contents
The total function for the View-Settings and Edit-Settings form is uploaded here.
My question is, am I making stupid mistakes in my functions (Edit-Settings and View-Settings) The functions are not working properly, they did when they were Windows.Forms but I wanted to use the Runspaces and WPF My Thoughts were to start the form in View-Settings and do something like:
$SettingsForm = EditSettings (this should return $True to save the form, $False to only close the form) If ($SettingsForm -eq $True) { Save all XML values provided in the GUI and the DataGrid, after this, close the form }
Currently the form is started and I get some Null variable errors and the first textbox is not filled (CustomerName) If I test the source variable the value is ok… I don’t get it…
I also would like to add the progress script in my functions but how can I do this the best way.
Link to EditSettings and ViewSettings
Hope to hear, many thanks in advance and bare with me I’m a system engineer no programer
Regards, Paul