Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Asynchronous PSAvalonia #6

Open
pinuke opened this issue Mar 16, 2023 · 1 comment
Open

Asynchronous PSAvalonia #6

pinuke opened this issue Mar 16, 2023 · 1 comment

Comments

@pinuke
Copy link

pinuke commented Mar 16, 2023

The current problem with PSAvalonia is the fact that it can't run the App asynchronously. This kind of defeats the purpose of GUI apps in PowerShell.

It may be worth while to write a cmdlet that starts the GUI in a separate PowerShell Runspace, similarly to:
https://stackoverflow.com/questions/34440599/using-dispatcher-invoke-with-a-runspace-in-powershell

In theory, you would be able to use Avalonia's Dispatcher to similarly to how you would do it in WPF

@pinuke
Copy link
Author

pinuke commented Mar 21, 2023

After a bit of investigation, @MaynardMiner's fork inside of a powershell runspace seems to make this feature achievable, however I'm getting a black screen:

image

This is the 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"
    Width="800" Height="450"
    Title="Test">
    <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>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant