Powershell GUI fronted (WPF) to run categorized console scripts

⌈⌋ ⎇ branch:  ClickyColoury


vars

Some notes on the used variables, and how they're shared between GUI and main runspace.

$GUI

The $GUI hash exists in both the main thread as well as the WPF runspace. It contains some widgets and an event queue:

  • main widgets:

    • $GUI.w == $GUI.Window
    • $GUI.Menu
    • $GUI.Ribbon (toolbar)
    • $GUI.Output (the Powershell/main output window)
    • $GUI.styles (WPF styles)
  • Notebook tabs

    • $GUI.Grid_EXTRAS

      • each other predefined notebook has a Grid_CATEGORY widget, but no variable shortcut
      • likewise there are predefined Menu_CATEGORYs; but unlike Grid_ entries, unknown categories will be auto-created (below the Extras menu)
  • Input fields:

    • $GUI.machine
    • $GUI.username
    • $GUI.bulkcsv
  • $GUI.vars a workaround hash to extract above fields together with extra plugin fields (input boxes or dropdowns in toolbock area)

  • $GUI.vars_previous keeps input box state for default+extra params across invocations. (The plan was to embed them in $meta.vars[].value; but the more global retainer turns out to be more useful.)

  • $GUI.html collects output as well

  • $GUI.tasks sends $menu entries to the main runspace, for execution by Run-GuiTask that is

  • $Splash is a reference to the Write-Splash screen; albeit resides in main thread

main

  • local vars $machine and $username get auto-created from the GUI fields.

  • $cfg.* is a global array (copied into WPF thread) for settings and defaults

  • $menu lists all plugins and their options (see plugin meta data)

  • $e is often a single entry from $menu

  • $plugins defines a few hooks to run before or after scripts (not quite finalized, type:init plugins usually register themselves)

  • $GUI.shell is a reference to the WPF runspace