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.
349 lines
19 KiB
349 lines
19 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:database="clr-namespace:StabilityMatrix.Core.Models.Database;assembly=StabilityMatrix.Core" |
|
xmlns:lang="clr-namespace:StabilityMatrix.Avalonia.Languages" |
|
x:DataType="dialogs:InstallerViewModel" |
|
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="700" |
|
d:DataContext="{x:Static mocks:DesignData.InstallerViewModel}" |
|
x:Class="StabilityMatrix.Avalonia.Views.Dialogs.InstallerDialog"> |
|
|
|
<Grid MaxHeight="900" |
|
RowDefinitions="Auto,Auto,Auto,2*,*" |
|
ColumnDefinitions="*,Auto"> |
|
<!-- Title and image --> |
|
<Grid Grid.Row="0" Grid.Column="0" |
|
Margin="16, 0, 0, 0" |
|
RowDefinitions="Auto, Auto, Auto, Auto, *, Auto"> |
|
<TextBlock Grid.Row="0" Text="{Binding SelectedPackage.DisplayName}" |
|
FontSize="24" |
|
Margin="0, 16, 0, 4" /> |
|
<TextBlock Grid.Row="1" Text="{Binding SelectedPackage.Blurb}" |
|
TextWrapping="Wrap" |
|
Margin="0, 0, 0, 4" /> |
|
<TextBlock Grid.Row="2" Text="{Binding SelectedPackage.Disclaimer}" |
|
Margin="0, 0, 0, 4" |
|
TextWrapping="Wrap" |
|
Foreground="{DynamicResource ThemeRedColor}" |
|
IsVisible="{Binding SelectedPackage.Disclaimer, Converter={x:Static StringConverters.IsNotNullOrEmpty}}" /> |
|
<ItemsRepeater Grid.Row="3" |
|
Margin="0, 0, 0, 8" |
|
ItemsSource="{Binding SelectedPackage.AvailableTorchVersions}"> |
|
<ItemsRepeater.Layout> |
|
<StackLayout Orientation="Horizontal" /> |
|
</ItemsRepeater.Layout> |
|
<ItemsRepeater.ItemTemplate> |
|
<DataTemplate DataType="{x:Type models:TorchVersion}"> |
|
<controls:Card |
|
Tag="{Binding }" |
|
HorizontalAlignment="Left" |
|
Padding="4" |
|
Margin="0,8,8,0" |
|
VerticalAlignment="Top"> |
|
|
|
<controls:Card.Styles> |
|
<Style Selector="controls|Card[Tag=Cuda]"> |
|
<Setter Property="Background" Value="{DynamicResource ThemeGreenColorTransparent}" /> |
|
<Setter Property="BorderBrush" Value="{DynamicResource ThemeGreenColorTransparent}" /> |
|
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter"> |
|
<Setter Property="Foreground" Value="{DynamicResource ButtonForeground}" /> |
|
</Style> |
|
<Setter Property="Content"> |
|
<Template> |
|
<TextBlock |
|
FontWeight="Medium" |
|
HorizontalAlignment="Center" |
|
Text="NVIDIA" |
|
TextAlignment="Center" |
|
VerticalAlignment="Center" /> |
|
</Template> |
|
</Setter> |
|
</Style> |
|
<Style Selector="controls|Card[Tag=Rocm]"> |
|
<Setter Property="Background" Value="{DynamicResource ThemeDarkRedColor}" /> |
|
<Setter Property="BorderBrush" Value="{DynamicResource ThemeDarkRedColor}" /> |
|
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter"> |
|
<Setter Property="Foreground" Value="{DynamicResource ButtonForeground}" /> |
|
</Style> |
|
<Setter Property="Content"> |
|
<Template> |
|
<TextBlock |
|
FontWeight="Medium" |
|
HorizontalAlignment="Center" |
|
Text="AMD (Linux)" |
|
TextAlignment="Center" |
|
VerticalAlignment="Center" |
|
ToolTip.Tip="For AMD GPUs that support ROCm on Linux" /> |
|
</Template> |
|
</Setter> |
|
</Style> |
|
<Style Selector="controls|Card[Tag=DirectMl]"> |
|
<Setter Property="Background" Value="{DynamicResource ThemeDarkBlueColor}" /> |
|
<Setter Property="BorderBrush" Value="{DynamicResource ThemeDarkBlueColor}" /> |
|
<Setter Property="Content"> |
|
<Template> |
|
<TextBlock |
|
FontWeight="Medium" |
|
HorizontalAlignment="Center" |
|
Text="DirectML" |
|
TextAlignment="Center" |
|
VerticalAlignment="Center" |
|
ToolTip.Tip="For any DirectX compatible GPU on Windows" /> |
|
</Template> |
|
</Setter> |
|
</Style> |
|
<Style Selector="controls|Card[Tag=Mps]"> |
|
<Setter Property="Background" Value="White" /> |
|
<Setter Property="BorderBrush" Value="White" /> |
|
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter"> |
|
<Setter Property="Foreground" Value="{DynamicResource ButtonForeground}" /> |
|
</Style> |
|
<Setter Property="Content"> |
|
<Template> |
|
<TextBlock |
|
FontWeight="Medium" |
|
HorizontalAlignment="Center" |
|
Text="macOS" |
|
TextAlignment="Center" |
|
Foreground="Black" |
|
VerticalAlignment="Center" /> |
|
</Template> |
|
</Setter> |
|
</Style> |
|
<Style Selector="controls|Card[Tag=Cpu]"> |
|
<Setter Property="Background" Value="{DynamicResource ThemeBlueGreyColor}" /> |
|
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBlueGreyColor}" /> |
|
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter"> |
|
<Setter Property="Foreground" Value="{DynamicResource ButtonForeground}" /> |
|
</Style> |
|
<Setter Property="Content"> |
|
<Template> |
|
<TextBlock |
|
FontWeight="Medium" |
|
HorizontalAlignment="Center" |
|
Text="CPU" |
|
TextAlignment="Center" |
|
VerticalAlignment="Center" /> |
|
</Template> |
|
</Setter> |
|
</Style> |
|
</controls:Card.Styles> |
|
</controls:Card> |
|
</DataTemplate> |
|
</ItemsRepeater.ItemTemplate> |
|
</ItemsRepeater> |
|
<controls:BetterAdvancedImage Grid.Row="4" |
|
Source="{Binding SelectedPackage.PreviewImageUri}" |
|
HorizontalAlignment="Left" |
|
MaxHeight="250" |
|
MaxWidth="600" |
|
Stretch="UniformToFill" /> |
|
</Grid> |
|
|
|
<Grid Grid.Column="0" Grid.Row="2" |
|
Grid.ColumnSpan="2" |
|
Margin="16,16,16,0" |
|
RowDefinitions="Auto, Auto, Auto, Auto" |
|
HorizontalAlignment="Center" |
|
ColumnDefinitions="Auto, Auto, Auto, Auto"> |
|
|
|
<Label Grid.Row="1" Grid.Column="0" |
|
Margin="8,0" |
|
Content="{x:Static lang:Resources.Label_DisplayName}" /> |
|
<TextBox Grid.Row="2" Grid.Column="0" |
|
MinWidth="250" |
|
Margin="8,0" |
|
VerticalAlignment="Stretch" |
|
VerticalContentAlignment="Center" |
|
Text="{Binding InstallName, Mode=TwoWay}" /> |
|
|
|
<StackPanel Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="4" |
|
Orientation="Horizontal" |
|
Margin="8,8,8,0" |
|
IsVisible="{Binding ShowDuplicateWarning}"> |
|
<ui:SymbolIcon |
|
Foreground="{DynamicResource ThemeRedColor}" |
|
Margin="0,0,8,0" |
|
Symbol="Alert" /> |
|
<TextBlock |
|
Foreground="{DynamicResource ThemeRedColor}" |
|
TextAlignment="Left" |
|
TextWrapping="Wrap"> |
|
<Run Text="{x:Static lang:Resources.Label_InstallationWithThisNameExists}" /> |
|
<LineBreak /> |
|
<Run Text="{x:Static lang:Resources.Label_PleaseChooseDifferentName}" /> |
|
</TextBlock> |
|
</StackPanel> |
|
|
|
<!-- Version Selector --> |
|
<Label Grid.Row="1" Grid.Column="1" |
|
Content="{Binding ReleaseLabelText}" /> |
|
<ui:FAComboBox Grid.Row="2" Grid.Column="1" |
|
ItemsSource="{Binding AvailableVersions}" |
|
MinWidth="250" |
|
VerticalAlignment="Stretch" |
|
SelectedItem="{Binding SelectedVersion}"> |
|
<ui:FAComboBox.ItemTemplate> |
|
<DataTemplate DataType="{x:Type models:PackageVersion}"> |
|
<TextBlock |
|
Name="NameTextBlock" |
|
VerticalAlignment="Center" |
|
Text="{Binding TagName}" /> |
|
</DataTemplate> |
|
</ui:FAComboBox.ItemTemplate> |
|
</ui:FAComboBox> |
|
|
|
<StackPanel Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="4" |
|
HorizontalAlignment="Center" |
|
Orientation="Horizontal" Margin="0,0,0,8" |
|
IsVisible="{Binding IsReleaseModeAvailable}"> |
|
<ToggleButton |
|
Content="{x:Static lang:Resources.Label_Releases}" |
|
IsChecked="{Binding IsReleaseMode}" |
|
IsEnabled="{Binding IsReleaseModeAvailable}" /> |
|
<ToggleButton |
|
Content="{x:Static lang:Resources.Label_Branches}" |
|
IsChecked="{Binding !IsReleaseMode}" |
|
Margin="8,0,0,0" /> |
|
</StackPanel> |
|
|
|
<!-- Advanced Options Button --> |
|
<Button Grid.Row="2" Grid.Column="2" VerticalAlignment="Stretch" |
|
Margin="8,0"> |
|
<ui:SymbolIcon FontSize="16" Margin="4" Symbol="Settings" /> |
|
<Button.Flyout> |
|
<Flyout> |
|
<!-- Advanced Options --> |
|
<StackPanel Orientation="Vertical" |
|
Margin="8" |
|
IsVisible="{Binding !IsAdvancedMode}"> |
|
|
|
<Label Content="{x:Static lang:Resources.Label_AdvancedOptions}" |
|
FontSize="18" |
|
HorizontalAlignment="Center" |
|
Margin="8,0,8,8" /> |
|
|
|
<Label Content="{x:Static lang:Resources.Label_Commit}" |
|
Margin="0,0,0,4" |
|
IsVisible="{Binding !IsReleaseMode}" /> |
|
<ui:FAComboBox |
|
IsVisible="{Binding !IsReleaseMode}" |
|
ItemsSource="{Binding AvailableCommits}" |
|
MinWidth="200" |
|
MinHeight="38" |
|
SelectedItem="{Binding SelectedCommit}"> |
|
<ui:FAComboBox.ItemTemplate> |
|
<DataTemplate DataType="{x:Type database:GitCommit}"> |
|
<TextBlock |
|
Margin="8,4,0,4" |
|
Name="NameTextBlock" |
|
Text="{Binding ShortSha}" /> |
|
</DataTemplate> |
|
</ui:FAComboBox.ItemTemplate> |
|
</ui:FAComboBox> |
|
|
|
<Label Content="{x:Static lang:Resources.Label_SharedModelFolderStrategy}" |
|
Margin="0,8,0,4" /> |
|
<ui:FAComboBox |
|
ItemsSource="{Binding SelectedPackage.AvailableSharedFolderMethods}" |
|
MinWidth="200" |
|
MinHeight="38" |
|
SelectedItem="{Binding SelectedSharedFolderMethod}"> |
|
<ui:FAComboBox.ItemTemplate> |
|
<DataTemplate DataType="{x:Type models:SharedFolderMethod}"> |
|
<TextBlock |
|
Margin="8,4,0,4" |
|
Text="{Binding }" /> |
|
</DataTemplate> |
|
</ui:FAComboBox.ItemTemplate> |
|
</ui:FAComboBox> |
|
|
|
<Label Content="{x:Static lang:Resources.Label_PyTorchVersion}" |
|
IsVisible="{Binding ShowTorchVersionOptions}" |
|
Margin="0,8,0,4" /> |
|
<ui:FAComboBox |
|
ItemsSource="{Binding SelectedPackage.AvailableTorchVersions}" |
|
MinWidth="200" |
|
MinHeight="38" |
|
IsVisible="{Binding ShowTorchVersionOptions}" |
|
SelectedItem="{Binding SelectedTorchVersion}"> |
|
<ui:FAComboBox.ItemTemplate> |
|
<DataTemplate DataType="{x:Type models:TorchVersion}"> |
|
<TextBlock |
|
Margin="8,4,0,4" |
|
Text="{Binding }" /> |
|
</DataTemplate> |
|
</ui:FAComboBox.ItemTemplate> |
|
</ui:FAComboBox> |
|
</StackPanel> |
|
</Flyout> |
|
</Button.Flyout> |
|
</Button> |
|
</Grid> |
|
|
|
<!-- Install Button --> |
|
<UniformGrid Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" |
|
Columns="2" |
|
Margin="0,16,0,0" |
|
HorizontalAlignment="Center"> |
|
<Button |
|
Content="{x:Static lang:Resources.Action_Cancel}" |
|
Command="{Binding Cancel}" |
|
FontSize="20" |
|
HorizontalAlignment="Center" |
|
Margin="8,0,4,0" |
|
Padding="16, 8, 16, 8" /> |
|
<Button |
|
Content="{x:Static lang:Resources.Action_Install}" |
|
Command="{Binding InstallCommand}" |
|
FontSize="20" |
|
IsEnabled="{Binding CanInstall}" |
|
HorizontalAlignment="Center" |
|
Classes="success" |
|
Margin="4,0,8,0" |
|
Padding="16, 8, 16, 8" /> |
|
</UniformGrid> |
|
|
|
<CheckBox Grid.Column="0" |
|
Grid.Row="4" |
|
VerticalAlignment="Bottom" |
|
Margin="16,0,0,16" |
|
Content="Show All Packages" |
|
IsChecked="{Binding ShowIncompatiblePackages}" |
|
ToolTip.Tip="Enabling "Show All Packages" will include packages that may not be compatible with your system and may run very slowly as a result."/> |
|
|
|
|
|
<!-- Available Packages --> |
|
<ScrollViewer Grid.Column="1" Grid.Row="0" |
|
Margin="8, 16" |
|
MaxHeight="400" |
|
VerticalScrollBarVisibility="Auto"> |
|
<ListBox |
|
ItemsSource="{Binding AvailablePackages}" |
|
SelectedItem="{Binding SelectedPackage}" |
|
CornerRadius="8"> |
|
<ListBox.Template> |
|
<ControlTemplate> |
|
<ItemsPresenter /> |
|
</ControlTemplate> |
|
</ListBox.Template> |
|
<ListBox.ItemTemplate> |
|
<DataTemplate DataType="{x:Type packages:BasePackage}"> |
|
<StackPanel Margin="8"> |
|
<TextBlock Text="{Binding DisplayName}" /> |
|
<TextBlock Text="{Binding ByAuthor}" /> |
|
</StackPanel> |
|
</DataTemplate> |
|
</ListBox.ItemTemplate> |
|
</ListBox> |
|
</ScrollViewer> |
|
</Grid> |
|
|
|
</controls:UserControlBase>
|
|
|