PSEC - Powershell Enhanced Capability
Version 1.2.1

PSEC - Restart Facility

Description

PSEC internally uses the class facility of .NET extensively. These classes, when loaded, set up a complex internal structure with many interdependent pointer references. It is virtually impossible to replace an individual class in such a network of pointers.

This page speaks to the issue - how to replace an existing class with a new class definition.

Solution

A primary Powershell window is started that acts as the restarter. The GUI is started as a secondary window.

The GUI facility has 2 modes of running - with a console and with no console. See GUI Modes

The GUI facility starts a new Powershell process and monitors the return code of that process. A special exit code of 901 will trigger the restart logic.

In addition the Form class has a bRestart flag that will invoke the restart logic.

Depending on the GUI Modes, the logic will signal the primary Powershell window to restart the secondary window in the same way as before.

Implementation

To trigger the restart from a GUI Form the keyboard input looks for a // keyboard sequence. When seen the restart logic is invoked. This is used when an underlying class is changed (such as a Flow Task logic).

As a convenience the .. keyboard sequence closes the window without issuing a restart.

These hot keys can be changed by altering the Form.exitRestartSeq and Form.exitExitSeq which have // and .. as their respective default values.

The restart logic trigger specifically looks for a Flow object in start-gui-v4.psm1. Other GUI systems can also be triggered by adding them to the logic in that module.

PSEC - Powershell Enhanced Capability
1.2.1

Copyright © 2018-2021, 2022, Rexcel System Inc.

 

 

 

 

 

X