Multi-Platform Package Manager for Stable Diffusion
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

177 lines
7.6 KiB

<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*">
<Button
Grid.Row="0"
Grid.Column="0"
Width="72"
Name="LaunchBtn"
Margin="16,8,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Stretch"
Classes="success"
Command="{Binding LaunchCommand}"
Content="Launch" />
<ui:TeachingTip Grid.Row="0" Grid.Column="0" Name="TeachingTip1"
Target="{Binding #LaunchBtn}"
Title="Click Launch to get started!"
PreferredPlacement="BottomRight"
IsOpen="{Binding IsLaunchTeachingTipsOpen}"/>
<Button
Grid.Row="0"
Grid.Column="0"
Width="72"
Margin="16,8,0,0"
HorizontalAlignment="Left"
VerticalAlignment="Stretch"
Classes="danger"
Command="{Binding Stop}"
Content="Stop"
IsVisible="{Binding RunningPackage, Converter={x:Static ObjectConverters.IsNotNull}}" />
<Button
Grid.Row="0"
Grid.Column="1"
Width="48"
Margin="8,8,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 &gt; StackPanel &gt; 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
Title="Input"
IsIconVisible="False"
IsClosable="False"
Severity="Informational"
Opacity="1"
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
Title="Input required"
Severity="Informational"
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>