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.
 
 
 

127 lines
6.2 KiB

<controls:UserControlBase 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"
xmlns:viewModels="clr-namespace:StabilityMatrix.Avalonia.ViewModels"
xmlns:mocks="clr-namespace:StabilityMatrix.Avalonia.DesignData;assembly=StabilityMatrix.Avalonia"
xmlns:ui="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia"
xmlns:models="clr-namespace:StabilityMatrix.Core.Models;assembly=StabilityMatrix.Core"
xmlns:controls="clr-namespace:StabilityMatrix.Avalonia.Controls"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:DataType="viewModels:PackageManagerViewModel"
x:CompileBindings="True"
d:DataContext="{x:Static mocks:DesignData.PackageManagerViewModel}"
x:Class="StabilityMatrix.Avalonia.Views.PackageManagerPage">
<Grid Margin="16" RowDefinitions="Auto,*">
<StackPanel
Grid.Row="0"
Orientation="Vertical"
IsVisible="{Binding ProgressBarVisibility, FallbackValue=True}">
<ProgressBar
IsIndeterminate="{Binding IsIndeterminate, FallbackValue=False}"
Maximum="100"
Value="{Binding ProgressValue, FallbackValue=10}"
Width="500" />
<TextBlock
HorizontalAlignment="Center"
Padding="8"
Text="{Binding ProgressText, FallbackValue=Installing...}" />
</StackPanel>
<StackPanel
Grid.Row="1"
HorizontalAlignment="Left"
Margin="16"
Orientation="Horizontal">
<StackPanel Orientation="Vertical">
<Button
Command="{Binding ShowInstallDialogCommand}"
Height="40"
HorizontalAlignment="Stretch"
Margin="0,0,0,16"
Classes="success"
VerticalContentAlignment="Center">
<StackPanel Orientation="Horizontal">
<ui:SymbolIcon Symbol="Add" />
<Label
Content="Add Package"
Margin="8,0,0,0"
VerticalContentAlignment="Center" />
</StackPanel>
</Button>
<ListBox
ItemsSource="{Binding Packages}"
SelectedItem="{Binding SelectedPackage, Mode=TwoWay}"
IsVisible="{Binding !!Packages.Count}">
<ListBox.Template>
<ControlTemplate>
<Border
BorderBrush="#FFCCCCCC"
BorderThickness="1"
CornerRadius="5">
<ItemsPresenter />
</Border>
</ControlTemplate>
</ListBox.Template>
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type models:InstalledPackage}">
<StackPanel Margin="8" VerticalAlignment="Top">
<TextBlock Margin="0,5,0,5" Text="{Binding DisplayName}" />
<TextBlock Margin="0,0,0,5" Text="{Binding DisplayVersion}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
<StackPanel Margin="32,0,0,0" Orientation="Vertical">
<TextBlock
FontSize="24"
FontWeight="Bold"
Text="{Binding SelectedPackage.DisplayName,
FallbackValue='Click &quot;Add Package&quot; to install a package'}" />
<TextBlock FontSize="12" Margin="0,5,0,5">
<Run Text="{Binding SelectedPackage.PackageName, FallbackValue=''}" />
<Run Text="{Binding SelectedPackage.DisplayVersion, FallbackValue=''}" />
</TextBlock>
<TextBlock
FontSize="12"
Margin="0,5,0,5"
Text="{Binding SelectedPackage.FullPath, FallbackValue=''}" />
<StackPanel Margin="0,16,0,0" Orientation="Horizontal" Spacing="16">
<Button
Command="{Binding Launch}"
Content="{Binding InstallButtonText}"
Height="50"
VerticalAlignment="Top"
IsEnabled="{Binding InstallButtonEnabled}"
IsVisible="{Binding InstallButtonEnabled}"
Classes="success"
Width="100" />
<Button
Command="{Binding Uninstall}"
Content="Uninstall"
Height="50"
VerticalAlignment="Top"
Classes="danger"
IsEnabled="{Binding !IsUninstalling}"
IsVisible="{Binding InstallButtonEnabled}"
Width="100" />
</StackPanel>
<StackPanel Orientation="Horizontal" IsVisible="{Binding IsUninstalling}">
<controls:ProgressRing Height="24" Width="24"
Margin="8, 16, 8, 8"
VerticalAlignment="Center"
BorderThickness="4"
IsIndeterminate="True" HorizontalAlignment="Left" />
<TextBlock Text="Uninstalling..." VerticalAlignment="Center" Margin="0,8,0,0" />
</StackPanel>
</StackPanel>
</StackPanel>
</Grid>
</controls:UserControlBase>