|
|
|
<controls:UserControlBase
|
|
|
|
x:Class="StabilityMatrix.Avalonia.Views.LaunchPageView"
|
|
|
|
xmlns="https://github.com/avaloniaui"
|
|
|
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
|
|
xmlns:avaloniaEdit="clr-namespace:AvaloniaEdit;assembly=AvaloniaEdit"
|
|
|
|
xmlns:controls="clr-namespace:StabilityMatrix.Avalonia.Controls"
|
|
|
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
|
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
|
|
xmlns:mocks="clr-namespace:StabilityMatrix.Avalonia.DesignData"
|
|
|
|
xmlns:models="clr-namespace:StabilityMatrix.Core.Models;assembly=StabilityMatrix.Core"
|
|
|
|
xmlns:ui="using:FluentAvalonia.UI.Controls"
|
|
|
|
xmlns:vm="clr-namespace:StabilityMatrix.Avalonia.ViewModels"
|
|
|
|
xmlns:system="clr-namespace:System;assembly=System.Runtime"
|
|
|
|
d:DataContext="{x:Static mocks:DesignData.LaunchPageViewModel}"
|
|
|
|
d:DesignHeight="450"
|
|
|
|
d:DesignWidth="700"
|
|
|
|
x:CompileBindings="True"
|
|
|
|
x:DataType="vm:LaunchPageViewModel"
|
|
|
|
mc:Ignorable="d">
|
|
|
|
|
|
|
|
<controls:UserControlBase.Resources>
|
|
|
|
<system:Boolean x:Key="True">True</system:Boolean>
|
|
|
|
<system:Boolean x:Key="False">False</system:Boolean>
|
|
|
|
</controls:UserControlBase.Resources>
|
|
|
|
|
|
|
|
<Grid RowDefinitions="Auto,*,Auto">
|
|
|
|
<Grid ColumnDefinitions="Auto,*,Auto"
|
|
|
|
Margin="0,8,0, 8">
|
|
|
|
<Grid ColumnDefinitions="0.8*,0.2*" Margin="16,8,0,0">
|
|
|
|
<!-- Use split if extra commands, otherwise normal launch button -->
|
|
|
|
<Grid
|
|
|
|
x:Name="LaunchButtonGrid"
|
|
|
|
Grid.Row="0"
|
|
|
|
Grid.Column="0">
|
|
|
|
<Button
|
|
|
|
Width="72"
|
|
|
|
IsVisible="{Binding !SelectedBasePackage.ExtraLaunchCommands.Count, FallbackValue=False}"
|
|
|
|
Classes="success"
|
|
|
|
HorizontalAlignment="Left"
|
|
|
|
VerticalAlignment="Stretch"
|
|
|
|
Command="{Binding LaunchCommand}"
|
|
|
|
Content="Launch" />
|
|
|
|
<SplitButton
|
|
|
|
Width="104"
|
|
|
|
IsVisible="{Binding !!SelectedBasePackage.ExtraLaunchCommands.Count, FallbackValue=False}"
|
|
|
|
Classes="success"
|
|
|
|
HorizontalAlignment="Left"
|
|
|
|
VerticalAlignment="Stretch"
|
|
|
|
Command="{Binding LaunchCommand}"
|
|
|
|
Content="Launch">
|
|
|
|
<SplitButton.Flyout>
|
|
|
|
<ui:FAMenuFlyout
|
|
|
|
Placement="Bottom"
|
|
|
|
ItemsSource="{Binding SelectedPackageExtraCommands}">
|
|
|
|
<ui:FAMenuFlyout.ItemTemplate>
|
|
|
|
<DataTemplate x:DataType="{x:Type system:String}">
|
|
|
|
<!-- ReSharper disable Xaml.PossibleNullReferenceException -->
|
|
|
|
<!-- ReSharper disable Xaml.BindingWithContextNotResolved -->
|
|
|
|
<ui:MenuFlyoutItem
|
|
|
|
Text="{Binding}"
|
|
|
|
CommandParameter="{Binding}"
|
|
|
|
Command="{ReflectionBinding
|
|
|
|
#LaunchButtonGrid.DataContext.LaunchCommand}"/>
|
|
|
|
<!-- ReSharper restore Xaml.BindingWithContextNotResolved -->
|
|
|
|
<!-- ReSharper restore Xaml.PossibleNullReferenceException -->
|
|
|
|
</DataTemplate>
|
|
|
|
</ui:FAMenuFlyout.ItemTemplate>
|
|
|
|
</ui:FAMenuFlyout>
|
|
|
|
</SplitButton.Flyout>
|
|
|
|
</SplitButton>
|
|
|
|
</Grid>
|
|
|
|
|
|
|
|
<ui:TeachingTip Grid.Row="0" Grid.Column="0" Name="TeachingTip1"
|
|
|
|
Target="{Binding #LaunchButtonGrid}"
|
|
|
|
Title="Click Launch to get started!"
|
|
|
|
PreferredPlacement="BottomRight"
|
|
|
|
IsOpen="{Binding IsLaunchTeachingTipsOpen}"/>
|
|
|
|
|
|
|
|
<Grid
|
|
|
|
x:Name="StopButtonGrid"
|
|
|
|
IsVisible="{Binding RunningPackage, Converter={x:Static ObjectConverters.IsNotNull}}"
|
|
|
|
Grid.Row="0"
|
|
|
|
Grid.Column="0">
|
|
|
|
<Button
|
|
|
|
Width="72"
|
|
|
|
HorizontalAlignment="Left"
|
|
|
|
VerticalAlignment="Stretch"
|
|
|
|
Classes="danger"
|
|
|
|
Command="{Binding Stop}"
|
|
|
|
Content="Stop"
|
|
|
|
IsVisible="{Binding !SelectedBasePackage.ExtraLaunchCommands.Count, FallbackValue=False}" />
|
|
|
|
<Button
|
|
|
|
Width="104"
|
|
|
|
HorizontalAlignment="Left"
|
|
|
|
VerticalAlignment="Stretch"
|
|
|
|
Classes="danger"
|
|
|
|
Command="{Binding Stop}"
|
|
|
|
Content="Stop"
|
|
|
|
IsVisible="{Binding !!SelectedBasePackage.ExtraLaunchCommands.Count, FallbackValue=False}" />
|
|
|
|
</Grid>
|
|
|
|
|
|
|
|
<Button
|
|
|
|
Grid.Row="0"
|
|
|
|
Grid.Column="1"
|
|
|
|
Width="48"
|
|
|
|
Margin="8,0,0,0"
|
|
|
|
Command="{Binding ConfigCommand}"
|
|
|
|
HorizontalAlignment="Left"
|
|
|
|
VerticalAlignment="Stretch"
|
|
|
|
FontSize="16">
|
|
|
|
<ui:SymbolIcon FontSize="16" Symbol="Settings" />
|
|
|
|
</Button>
|
|
|
|
</Grid>
|
|
|
|
|
|
|
|
<ComboBox
|
|
|
|
x:Name="SelectPackageComboBox"
|
|
|
|
Grid.Row="0"
|
|
|
|
Grid.Column="1"
|
|
|
|
Margin="8,8,0,0"
|
|
|
|
HorizontalAlignment="Stretch"
|
|
|
|
VerticalAlignment="Top"
|
|
|
|
ItemsSource="{Binding InstalledPackages}"
|
|
|
|
SelectedItem="{Binding SelectedPackage}">
|
|
|
|
<ComboBox.Styles>
|
|
|
|
<Style Selector="ComboBox /template/ ContentControl#ContentPresenter > StackPanel > TextBlock:nth-child(2)">
|
|
|
|
<Setter Property="IsVisible" Value="False" />
|
|
|
|
</Style>
|
|
|
|
</ComboBox.Styles>
|
|
|
|
|
|
|
|
<ComboBox.ItemTemplate>
|
|
|
|
<DataTemplate DataType="{x:Type models:InstalledPackage}">
|
|
|
|
<StackPanel Margin="10,0,0,0" VerticalAlignment="Top">
|
|
|
|
<TextBlock
|
|
|
|
Name="NameTextBlock"
|
|
|
|
Margin="0,5,0,5"
|
|
|
|
Text="{Binding DisplayName, Mode=OneWay}" />
|
|
|
|
<TextBlock Text="{Binding FullPath, Mode=OneWay}" />
|
|
|
|
</StackPanel>
|
|
|
|
</DataTemplate>
|
|
|
|
</ComboBox.ItemTemplate>
|
|
|
|
</ComboBox>
|
|
|
|
|
|
|
|
<!-- Keyboard button to show manual input info bar -->
|
|
|
|
<ToggleButton
|
|
|
|
Grid.Column="2"
|
|
|
|
Width="48"
|
|
|
|
Margin="8,8,16,0"
|
|
|
|
IsChecked="{Binding ShowManualInputPrompt}"
|
|
|
|
ToolTip.Tip="Send Input"
|
|
|
|
HorizontalAlignment="Left"
|
|
|
|
VerticalAlignment="Stretch"
|
|
|
|
FontSize="16">
|
|
|
|
<ui:SymbolIcon FontSize="18" Symbol="Keyboard" />
|
|
|
|
</ToggleButton>
|
|
|
|
</Grid>
|
|
|
|
|
|
|
|
<avaloniaEdit:TextEditor
|
|
|
|
x:Name="Console"
|
|
|
|
Grid.Row="1"
|
|
|
|
Margin="8,8,16,10"
|
|
|
|
DataContext="{Binding Console}"
|
|
|
|
Document="{Binding Document}"
|
|
|
|
FontFamily="Cascadia Code,Consolas,Menlo,Monospace"
|
|
|
|
IsReadOnly="True"
|
|
|
|
LineNumbersForeground="DarkSlateGray"
|
|
|
|
ShowLineNumbers="True"
|
|
|
|
VerticalScrollBarVisibility="Auto"
|
|
|
|
WordWrap="True" />
|
|
|
|
|
|
|
|
<Grid Grid.Row="1" ColumnDefinitions="0.5*,*">
|
|
|
|
<StackPanel Grid.Column="1" Margin="8" Spacing="4">
|
|
|
|
<!-- Info bar for manual input -->
|
|
|
|
<ui:InfoBar
|
|
|
|
Severity="Warning"
|
|
|
|
Title="Input"
|
|
|
|
IsIconVisible="False"
|
|
|
|
IsClosable="False"
|
|
|
|
IsOpen="{Binding ShowManualInputPrompt, Mode=TwoWay}"
|
|
|
|
Margin="0">
|
|
|
|
<ui:InfoBar.ActionButton>
|
|
|
|
<Grid ColumnDefinitions="*,auto">
|
|
|
|
<TextBox Name="ManualInputBox" Margin="0,0,8,0" />
|
|
|
|
<Button Grid.Column="1" Margin="0,0,8,0" Content="Send"
|
|
|
|
Command="{Binding SendManualInputCommand}"
|
|
|
|
CommandParameter="{Binding #ManualInputBox.Text}"/>
|
|
|
|
</Grid>
|
|
|
|
</ui:InfoBar.ActionButton>
|
|
|
|
</ui:InfoBar>
|
|
|
|
<!-- Info bar for auto prompts -->
|
|
|
|
<ui:InfoBar
|
|
|
|
Severity="Warning"
|
|
|
|
Title="Input required"
|
|
|
|
IsOpen="{Binding ShowConfirmInputPrompt, Mode=TwoWay}"
|
|
|
|
Margin="0"
|
|
|
|
Message="Confirm?">
|
|
|
|
<ui:InfoBar.ActionButton>
|
|
|
|
<StackPanel Orientation="Horizontal" Spacing="8">
|
|
|
|
<Button Classes="accent" Content="Yes"
|
|
|
|
Command="{Binding SendConfirmInputCommand}"
|
|
|
|
CommandParameter="{StaticResource True}"/>
|
|
|
|
<Button Content="No" Command="{Binding SendConfirmInputCommand}"
|
|
|
|
CommandParameter="{StaticResource False}"/>
|
|
|
|
</StackPanel>
|
|
|
|
</ui:InfoBar.ActionButton>
|
|
|
|
</ui:InfoBar>
|
|
|
|
</StackPanel>
|
|
|
|
</Grid>
|
|
|
|
|
|
|
|
<Button
|
|
|
|
Grid.Row="2"
|
|
|
|
Grid.ColumnSpan="2"
|
|
|
|
Margin="24,0,24,8"
|
|
|
|
HorizontalAlignment="Stretch"
|
|
|
|
Classes="success"
|
|
|
|
Content="Open Web UI"
|
|
|
|
Command="{Binding OpenWebUi}"
|
|
|
|
IsVisible="{Binding ShowWebUiButton}"
|
|
|
|
FontSize="12" />
|
|
|
|
</Grid>
|
|
|
|
|
|
|
|
</controls:UserControlBase>
|