Posted on Leave a comment

PowerShell Tools 4.7.0 Release Notes

Support for High DPI Windows Forms applications

The packager now supports high DPI forms applications. Use the High DPI Support package setting to enable support. You can also enable this setting via the Merge-Script package config file.

High DPI Setting in Visual Studio

Fixed window flash on start and exit of packaged application

When hide console window is selected, no console will be shown at all. When you exit your application, a console used to flash. This is no longer the case.

Fixed app crash of packaged application

Occasionally, the application would crash when exiting due to a FileNotFoundException.

Posted on Leave a comment

PowerShell Universal Dashboard – 2.4.1

Bug Fixes

Bug in UD 2.4: running in IIS locally fails w/ Enterprise w/o license – Reported by bielawb

Error while loading UD 2.4 on raspbian – Reported by DanielSSilva

UDTable size and position are not saved in a UDGridLayout – Reported by adamdriscoll

Cannot type in any textbox that is in the UDGridLayout – Reported by adamdriscoll

New-UDMonitor does not update on 2.4 – Reported by rickyxsosa

New-UDButton -Icon wont show selected icon on the button after starting dashboard – Reported by wsl2001

Warning Message in browser after 2.4.0 deployed – Reported by wsl2001

2.4.0: breaking changes or issue in buttons when passing variables? – Reported by PorreKaj

2.4.0 Grid sort is always descending – Reported by PorreKaj

2.4.0 – Hamburger menu icons vary in size – Reported by PorreKaj

Components are always white in 2.4.0 – Reported by PorreKaj

Posted on Leave a comment

PowerShell Tools for Visual Studio and PowerShell Pro Tools 4.6.2 – Release Notes

Hide Item Templates for non-PowerShell Projects

PowerShell item templates would show up in web projects and default to the first item in the list. This is not ideal because the project was primarily a C# project. PowerShell item templates will now only show up in PowerShell Projects.

Fix bundling of resource data files in some circumstances

If a resource file was added to a Windows Form by adding an icon, font or changing the language and then the resource file was deleted, the bundler would fail with a FileNotFoundException.

Fix installation issue on Visual Studio 16.1

Visual Studio 16.1 complains during installation of PowerShell Tools that the target .NET framework was installed when it was actually installed. Removed .NET version check until it can be determined how to correctly enforce it.

Posted on 2 Comments

Universal Dashboard – 2.4 Release

After a couple months of development, Universal Dashboard 2.4 is now available on the PowerShell Gallery! This release fixes many issues and implements some really cool features. Check out the notes below to find out more or head over to your favorite command prompt to get the latest.

Install-Module UniversalDashboard -AcceptLicense 

Grid Layout

One issue with dashboards is that it is difficult and time consuming to layout many controls. In UD 2.4, you can now layout controls directly in your web browser. The layout is then output as a JSON string that you can store with your dashboards PS1 file. This reduces the nesting of New-UDRow and New-UDColumn calls and makes it way easier to organize your pages.

You can learn more about the grid layout and how to save your layouts to your dashboards on the doc site.

Material UI Controls

Material UI is the most popular Material Design library for React. It has tons of controls and very customizable. In addition to controls, it provides theming as part of the framework. As we move toward a v3 release of UD, we will be looking at replacing Materialize with Material UI. As we work towards that, we will be bringing in new controls. You can take advantage of some of them right now. Check out the Avatar, Button, Card, Chip, Paper and Typography controls in UD 2.4.

More information can be found on the docs site.

Font Awesome v5

UD2.4 now uses Font Awesome version 5. Previously, it had been using Font Awesome version 4.7. With the introduction of v5, you’ll have access to way more icons. Care has been taken to map existing v4.7 icon names to their v5 counterparts. If you encounter any errors with icons, please open a GitHub issue.

Materialize v1

A change in Chrome introduced a change that caused OnClick event handlers to require two clicks to function. This affected many JavaScript libraries; including Materialize. Because of issues like this, UD2.4 now uses the v1 version of Materialize. This also fixed some issues with date pickers as well as other controls.

Simplified New-UDGrid

New-UDGrid no longer requires passing the Headers and Properties parameters. You can just pass your data to Out-UDGridData. Headers and Properties proved redundant in many scenarios. You can still use Headers and Properties to customize these features.

    New-UDGrid -Title "Processes" -Endpoint {
        Get-Process | Select-Object Name,Path | Out-UDGridData
    }

Improved Custom React Components

Due to enhancements in custom component support, the entire Material UI component library is defined with only JavaScript and PowerShell. There is no need for C# code. This PowerShell to React binding makes it extremely easy to introduce new components. UD can load webpack chunks, CSS and even source maps for custom component libraries.

If you want to see what this looks like, head over to the Universal Dashboard GitHub repository. Full documentation for this feature is in the works and you’ll see many more React controls being brought into the UD ecosystem.

Access to Authorization Policies

You can now access Authorization Policies via Get-UDAuthorizationPolicy. Rather than just limiting which page a user has access to, you can now use this cmdlet in your Endpoints to adjust how the page itself behaves based on that authorization policy. For example, you can check the authorization policy to see if a user is an admin and then hide a control based on if they are not.

Here’s an example of doing just that.

$AuthPolicy = Get-UDAuthorizationPolicy 

if ($AuthPolicy -contains 'AdminPolicy') {
     New-UDHeading -Text "Only Admins See This"
}  

A Word about the Designer

In the 2.4-beta1, the ability to use a basic designer was available. This feature did not make it into the 2.4 release. The designer itself was not very useful in it’s current implementation so it was decided to instead implement the grid layout and work some more on the designer for a future release. Working longer on the designer would have delayed the 2.4 build that had a lot of much needed fixes.

Documentation

Documentation has been updated for the 2.4 release. Additionally, documentation for the 2.3 release is still available. Instead of continuing a single stream of docs, we will now be taking advantage of GitBook Releases. Beginning with the 2.3 release, this will allow for you to access older versions of documentation specific to the UD version you are using.

You can select the doc version by clicking the drop down in the top left navigation menu of the docs site.

And Much More

Check out the full list of release notes here.

Posted on Leave a comment

PowerShell Pro Tools – 4.6.0 Release Notes

Event Handler Support for the PowerShell Windows Form Designer

The PowerShell Pro Tools form designer now supports generating event handler code. You can click the event tab on the properties grid to view events that are available for the currently selected control.

Events Tab

Event handlers that are already connected to script blocks will show the variable name in the text field. To generate a new event handler, type the name of the variable you’d like to use and hit enter. Once you save the form with Ctrl+s or by clicking the Save button in the toolbar, the event handler will be generated in the code.

Event handler code
Posted on Leave a comment

Building Cross-Platform WPF-Style Applications in PowerShell Core

With PowerShell Pro Tools 4.5.0, you can now take advantage of the Avalonia project in PowerShell Core. Avalonia is a WPF-inspired cross-platform XAML-based UI framework providing a flexible styling system and supporting a wide range of OSs: Windows (.NET Framework, .NET Core), Linux (GTK), MacOS, Android and iOS. PowerShell Pro Tools bridges the gap between PowerShell Core and Avalonia.

Avalonia is currently in beta so there may be some bugs. These cmdlets only work in PowerShell Core.

Creating a basic application

Simple to WPF, Avalonia uses XAML to define the look and feel of the application. Many of the control names and concepts are very similar. To create a basic Avalonia PowerShell application, you first need to define some XAML.

$Xaml = '<Window xmlns="https://github.com/avaloniaui"
        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"
        mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
        x:Class="avaloniaui.MainWindow"
        Title="avaloniaui">
   <StackPanel>
	<Button Width="160" Name="button">My Button</Button>
        <TextBox HorizontalAlignment="Left" Margin="12,12,0,0" Name="txtDemo" VerticalAlignment="Top" Width="500" Height="25" />
    </StackPanel>
</Window>'

This particluar form has a single textbox and button. They fall within a StackPanel. All these controls should seem very similar to WPF.
In order to create a new Avalonia window, you can use the PowerShell Pro Tools ConvertTo-AvaloniaWindow cmdlet to create a new window.

$window = ConvertTo-AvaloniaWindow -Xaml $Xaml

After creating a window, you may want to adjust the behavior of the button and textbox. To do so, you can find the control using the Find-AvaloniaControl cmdlet.

$Button = Find-AvaloniaControl -Name 'button' -Window $Window
$txtDemo = Find-AvaloniaControl -Name 'txtDemo' -Window $Window

Next, very similar to WPF, we can now add event handlers to the controls that we just found. This event handler is invoked when the button is clicked. It then sets the textbox’s value to “Hello, World from (Operating System) running PowerShell Core (Version)!”

$Button.add_Click({$txtDemo.Text = "Hello, World from $($PSVersionTable.OS) running PowerShell Core $($PSVersionTable.PSVersion)"})

Finally, we display the window using Show-AvaloniaWindow.

Show-AvaloniaWindow -Window $Window

If you run this script on Windows, you’ll see the following.

Running Avalonia on Windows

Here is the exact same script running from a Ubuntu Linux machine.

Running Avalonia on Linux

This functionality is part of the PowerShell Pro Tools module. This is also included with the PowerShell Pro Tools extension for VS Code.

Posted on Leave a comment

PowerShell Tools for Visual Studio and PowerShell Pro Tools – Version 4.4.0 Release Notes

PowerShell Pro Tools – Module Explorer

The PowerShell Pro Tools extension for VS Code now provides a new tree view in the activity bar to view and update modules. It will list all the modules that are currently installed and flag any modules that are out of date. You can then upgrade the module directly from VS Code.

Updating the Polaris Module with the Module Explorer

If you wish to hide the Module Explorer, just change the Module Explorer Visibility setting.

Improved Performance of VS Code Extension

Previously, the VS Code extension would execute all the PowerShell script necessary for its functions in the terminal window. Not only was this slow but it would pollute the history of the terminal. With the 4.4.0 release, the VS Code extension now uses a background runspace for operation. This improves performance and ensures a clean terminal history.

Improved Dependency Check Warnings

The packager requires both .NET Core and the .NET Framework Developer Pack installed to function. Previously, the warning messages were cryptic. These messages have been improved and contain links to where to download the missing dependencies.

Fixed an issue with the Form Designer Licensing

The form designer would reprompt for a license even after it had been installed in VS Code.