Powershell 「Use Grid and StackPanel to create a simple weather app(microsoft grid-tutorial)」のPowershell対応

PowerShell

Microsoftの「Use Grid and StackPanel to create a simple weather app」にあるxamlをつかった画面をPowershellで実行できるよう修正した例

サンプルコード

チュートリアルでは、partially-cloudy.png の扱い方が Visual studio前提となっている。

のソリューション エクスプローラーで Assets フォルダーを右クリックし、[追加] ->[既存の項目…] を選択します。ポップアップ表示されるブラウザーで partially-cloudy.png を見つけて選択し、[追加] を選択します。

Grid と StackPanel を使った単純なアプリの作成。 – Windows apps | Microsoft Docs

しかし、PowershellではVisual studioの上記のような使い方が機能しないので、Ps1ファイル上で、自身の実行パスから、partially-cloudy.png 用の絶対パスを生成し、$Image.Sourceに設定するようにした。

実行結果

チュートリアル Use Grid and StackPanel to create a simple weather app

Use Grid and StackPanel to create a simple app. - Windows apps
This tutorial walks through how to create a basic application user interface. It explains and demonstrates the use of Grid and StackPanel, two of the most commo...

github

PowerShell_WPF_XAML_GUI_SampleCodes/WPF_SimpleWeatherFormSample at main · papanda925/PowerShell_WPF_XAML_GUI_SampleCodes
PowerShell_WPF_XAML_GUI_SampleCodes. Contribute to papanda925/PowerShell_WPF_XAML_GUI_SampleCodes development by creating an account on GitHub.

最近、XamlによるGUIを使ったpoershellアプリに興味あり

コメント

タイトルとURLをコピーしました