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.
233 lines
11 KiB
233 lines
11 KiB
1 year ago
|
<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:vm="clr-namespace:StabilityMatrix.Avalonia.ViewModels"
|
||
|
xmlns:ui="using:FluentAvalonia.UI.Controls"
|
||
|
xmlns:md="https://github.com/whistyun/Markdown.Avalonia"
|
||
|
xmlns:mocks="clr-namespace:StabilityMatrix.Avalonia.DesignData"
|
||
|
xmlns:system="clr-namespace:System;assembly=System.Runtime"
|
||
|
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:octokit="clr-namespace:Octokit;assembly=Octokit"
|
||
|
xmlns:mdxaml="https://github.com/whistyun/Markdown.Avalonia.Tight"
|
||
|
x:DataType="dialogs:InstallerViewModel"
|
||
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||
|
d:DataContext="{x:Static mocks:DesignData.InstallerViewModel}"
|
||
|
x:Class="StabilityMatrix.Avalonia.Views.Dialogs.InstallerDialog">
|
||
|
|
||
|
<controls:UserControlBase.Resources>
|
||
|
</controls:UserControlBase.Resources>
|
||
|
|
||
|
<Grid>
|
||
|
<Grid.RowDefinitions>
|
||
|
<RowDefinition Height="Auto" />
|
||
|
<RowDefinition Height="Auto" />
|
||
|
<RowDefinition Height="*" />
|
||
|
</Grid.RowDefinitions>
|
||
|
|
||
|
<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="16"
|
||
|
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
|
||
|
Grid.Column="1"
|
||
|
Margin="16,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,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 octokit:GitHubCommit}">
|
||
|
<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 SelectedPackage.DisplayName}" />
|
||
|
|
||
|
<StackPanel Orientation="Horizontal">
|
||
|
<Button
|
||
|
Command="{Binding InstallCommand}"
|
||
|
Content="Install"
|
||
|
Height="50"
|
||
|
IsEnabled="{Binding !ShowDuplicateWarning}"
|
||
|
Margin="0,16,0,0"
|
||
|
VerticalAlignment="Top"
|
||
|
Width="100" />
|
||
|
<controls:ProgressRing
|
||
|
Height="25"
|
||
|
IsIndeterminate="True"
|
||
|
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>
|
||
|
|
||
|
<mdxaml:MarkdownScrollViewer
|
||
|
Grid.Column="2"
|
||
|
Margin="16"
|
||
|
Source="{Binding ReleaseNotes, Mode=OneWay}"/>
|
||
|
<ContentPresenter
|
||
|
Grid.Column="0"
|
||
|
Grid.ColumnSpan="3"
|
||
|
x:Name="InstallerContentDialog" />
|
||
|
</Grid>
|
||
|
</Grid>
|
||
|
|
||
|
</controls:UserControlBase>
|