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.
 
 
 

239 lines
11 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:controls="clr-namespace:StabilityMatrix.Avalonia.Controls"
xmlns:ui="using:FluentAvalonia.UI.Controls"
xmlns:mocks="clr-namespace:StabilityMatrix.Avalonia.DesignData"
xmlns:dialogs="clr-namespace:StabilityMatrix.Avalonia.ViewModels.Dialogs"
xmlns:packages="clr-namespace:StabilityMatrix.Core.Models.Packages;assembly=StabilityMatrix.Core"
xmlns:models="clr-namespace:StabilityMatrix.Core.Models;assembly=StabilityMatrix.Core"
xmlns:mdxaml="https://github.com/whistyun/Markdown.Avalonia.Tight"
xmlns:database="clr-namespace:StabilityMatrix.Core.Models.Database;assembly=StabilityMatrix.Core"
xmlns:icons="clr-namespace:Projektanker.Icons.Avalonia;assembly=Projektanker.Icons.Avalonia"
x:DataType="dialogs:InstallerViewModel"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="500"
d:DataContext="{x:Static mocks:DesignData.InstallerViewModel}"
x:Class="StabilityMatrix.Avalonia.Views.Dialogs.InstallerDialog">
<Grid RowDefinitions="Auto,Auto,Auto,*">
<!-- Close button -->
<Grid HorizontalAlignment="Right">
<Button
Margin="0,8,8,0"
Classes="transparent"
IsEnabled="{Binding !InstallProgress.IsProgressVisible}"
Command="{Binding OnCloseButtonClick}"
icons:Attached.Icon="fa-solid fa-xmark"/>
</Grid>
<StackPanel
Grid.Row="1"
Margin="16,8,16,0"
Orientation="Vertical"
DataContext="{Binding InstallProgress}"
IsVisible="{Binding IsProgressVisible}">
<TextBlock
HorizontalAlignment="Center"
Padding="8"
Text="{Binding Text}" />
<ProgressBar
IsIndeterminate="{Binding IsIndeterminate}"
Maximum="100"
Width="500"
Value="{Binding Value}" />
<TextBlock
FontSize="10"
HorizontalAlignment="Center"
Padding="4"
Text="{Binding Description}"
TextWrapping="Wrap" />
</StackPanel>
<Grid Grid.Row="2" HorizontalAlignment="Left" ColumnDefinitions="Auto,*,Auto">
<ListBox
Margin="8,16"
IsEnabled="{Binding !InstallProgress.IsProgressVisible}"
ItemsSource="{Binding AvailablePackages}"
SelectedItem="{Binding SelectedPackage, Mode=TwoWay}">
<!--<ListView.Style>
<Style TargetType="ListView">
<Setter Property="Background" Value="#191919" />
</Style>
</ListView.Style>-->
<ListBox.Template>
<ControlTemplate>
<!-- BorderBrush="{KeyboardFocusBorderColorBrush}" -->
<Border
BorderThickness="1"
CornerRadius="5">
<ItemsPresenter />
</Border>
</ControlTemplate>
</ListBox.Template>
<ListBox.ItemTemplate>
<DataTemplate DataType="{x:Type packages:BasePackage}">
<StackPanel Margin="8" VerticalAlignment="Top">
<TextBlock Margin="0,5,0,5" Text="{Binding DisplayName}" />
<TextBlock Margin="0,0,0,5" Text="{Binding ByAuthor}" />
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
<StackPanel
MinWidth="400"
Grid.Column="1"
Margin="8,16,0,16"
Orientation="Vertical">
<TextBlock
FontSize="24"
FontWeight="Bold"
Text="{Binding SelectedPackage.DisplayName, FallbackValue=Stable Diffusion Web UI}" />
<TextBlock FontSize="12" Text="{Binding SelectedPackage.ByAuthor, FallbackValue=by Automatic111}" />
<Button
Background="Transparent"
BorderBrush="Transparent"
Command="{Binding ShowPreviewCommand}"
Content="UI Preview"
Margin="0,8,0,0">
<!--<Button.Style>
<Style BasedOn="{StaticResource {x:Type Button}}" TargetType="{x:Type Button}">
<Setter Property="Foreground">
<Setter.Value>
<SolidColorBrush Color="{DynamicResource SystemAccentColorSecondary}" />
</Setter.Value>
</Setter>
</Style>
</Button.Style>-->
</Button>
<ui:HyperlinkButton Margin="0,0,0,0" NavigateUri="{Binding SelectedPackage.LicenseUrl}">
<TextBlock TextWrapping="Wrap">
<Run Text="{Binding SelectedPackage.LicenseType, Mode=OneWay}" />
<Run Text="License" />
</TextBlock>
</ui:HyperlinkButton>
<ui:HyperlinkButton Margin="0,0,0,8" NavigateUri="{Binding SelectedPackage.GithubUrl}">
<TextBlock TextWrapping="Wrap">
<Run Text="GitHub Page:" />
<Run Text="{Binding SelectedPackage.GithubUrl, Mode=OneWay}" TextDecorations="Underline" />
</TextBlock>
</ui:HyperlinkButton>
<StackPanel Orientation="Horizontal">
<ToggleButton
Content="Releases"
IsChecked="{Binding IsReleaseMode}"
IsEnabled="{Binding IsReleaseModeAvailable}" />
<ToggleButton
Content="Branches"
IsChecked="{Binding !IsReleaseMode}"
Margin="8,0,0,0" />
</StackPanel>
<StackPanel Margin="0,16,0,0" Orientation="Horizontal">
<StackPanel Orientation="Vertical">
<Label Content="{Binding ReleaseLabelText, FallbackValue=Version}" />
<ComboBox
ItemsSource="{Binding AvailableVersions}"
MinWidth="200"
SelectedItem="{Binding SelectedVersion}">
<ComboBox.ItemTemplate>
<DataTemplate DataType="{x:Type models:PackageVersion}">
<StackPanel Margin="8,0,0,0" VerticalAlignment="Top">
<TextBlock
Margin="0,4,0,4"
Name="NameTextBlock"
Text="{Binding TagName}" />
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
<StackPanel
Margin="8,0,0,0"
Orientation="Vertical"
IsVisible="{Binding !IsReleaseMode}">
<Label Content="Commit" />
<ComboBox
ItemsSource="{Binding AvailableCommits}"
MinWidth="100"
SelectedItem="{Binding SelectedCommit}">
<ComboBox.ItemTemplate>
<DataTemplate DataType="{x:Type database:GitCommit}">
<StackPanel Margin="8,0,0,0" VerticalAlignment="Top">
<TextBlock
Margin="0,4,0,4"
Name="NameTextBlock"
Text="{Binding Sha}" />
</StackPanel>
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
</StackPanel>
</StackPanel>
<Label Content="Display Name" Margin="0,16,0,0" />
<StackPanel Orientation="Horizontal" IsVisible="{Binding ShowDuplicateWarning}">
<ui:SymbolIcon
Foreground="{DynamicResource ThemeRedColor}"
Margin="8"
Symbol="Alert" />
<TextBlock
Foreground="{DynamicResource ThemeRedColor}"
Margin="0,8,8,8"
TextAlignment="Left"
TextWrapping="Wrap">
<Run Text="An installation with this name already exists." />
<LineBreak />
<Run Text="Please choose a different name or select a different Install Location." />
</TextBlock>
</StackPanel>
<TextBox
Margin="0,0,0,8"
Text="{Binding InstallName, Mode=TwoWay}" />
<StackPanel Orientation="Horizontal">
<Button
Command="{Binding InstallCommand}"
Content="Install"
Classes="success"
Height="50"
IsEnabled="{Binding !ShowDuplicateWarning}"
Margin="0,16,0,0"
VerticalAlignment="Top"
Width="100" />
<controls:ProgressRing
Height="25"
IsIndeterminate="True"
BorderThickness="4"
Margin="8,16,0,0"
VerticalAlignment="Center"
IsVisible="{Binding InstallProgress.IsProgressVisible}"
Width="25" />
<TextBlock
Margin="8,16,0,0"
Text="Installing..."
VerticalAlignment="Center"
IsVisible="{Binding InstallProgress.IsProgressVisible}" />
</StackPanel>
</StackPanel>
<ScrollViewer Grid.Column="2"
MaxWidth="300"
Margin="16"
MaxHeight="600">
<mdxaml:MarkdownScrollViewer
Markdown="{Binding ReleaseNotes, Mode=OneWay}"/>
</ScrollViewer>
</Grid>
</Grid>
</controls:UserControlBase>