Browse Source

Fix text display & change line offset for scrollToBottomRequested in PackageModificationDialog

pull/117/head
JT 1 year ago
parent
commit
523e575345
  1. 12
      StabilityMatrix.Avalonia/ViewModels/Dialogs/InstallerViewModel.cs
  2. 2
      StabilityMatrix.Avalonia/Views/Dialogs/InstallerDialog.axaml
  3. 4
      StabilityMatrix.Avalonia/Views/Dialogs/PackageModificationDialog.axaml
  4. 2
      StabilityMatrix.Avalonia/Views/Dialogs/PackageModificationDialog.axaml.cs

12
StabilityMatrix.Avalonia/ViewModels/Dialogs/InstallerViewModel.cs

@ -69,9 +69,11 @@ public partial class InstallerViewModel : ContentDialogViewModelBase
private bool isAdvancedMode;
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(CanInstall))]
private bool showDuplicateWarning;
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(CanInstall))]
private string? installName;
[ObservableProperty]
@ -108,6 +110,8 @@ public partial class InstallerViewModel : ContentDialogViewModelBase
AvailableVersionTypes.HasFlag(PackageVersionType.GithubRelease);
public bool ShowTorchVersionOptions => SelectedTorchVersion != TorchVersion.None;
public bool CanInstall => !string.IsNullOrWhiteSpace(InstallName) && !ShowDuplicateWarning;
public ProgressViewModel InstallProgress { get; } = new();
public IEnumerable<IPackageStep> Steps { get; set; }
@ -303,7 +307,7 @@ public partial class InstallerViewModel : ContentDialogViewModelBase
version ??= AvailableVersions.FirstOrDefault(x => x.TagName == "main");
// If still not found, just use the first one
version ??= AvailableVersions[0];
version ??= AvailableVersions.FirstOrDefault();
SelectedVersion = version;
}
@ -388,14 +392,14 @@ public partial class InstallerViewModel : ContentDialogViewModelBase
return;
AvailableCommits = new ObservableCollection<GitCommit>(commits);
SelectedCommit = AvailableCommits[0];
SelectedCommit = AvailableCommits.FirstOrDefault();
UpdateSelectedVersionToLatestMain();
}
InstallName = SelectedPackage.DisplayName;
LatestVersionText = IsReleaseMode
? $"Latest version: {SelectedVersion.TagName}"
: $"Branch: {SelectedVersion.TagName}";
? $"Latest version: {SelectedVersion?.TagName}"
: $"Branch: {SelectedVersion?.TagName}";
})
.SafeFireAndForget();
}

2
StabilityMatrix.Avalonia/Views/Dialogs/InstallerDialog.axaml

@ -197,7 +197,7 @@
Content="Install"
Command="{Binding InstallCommand}"
FontSize="20"
IsEnabled="{Binding !ShowDuplicateWarning}"
IsEnabled="{Binding CanInstall}"
HorizontalAlignment="Center"
Classes="success"
Margin="4,0,8,0"

4
StabilityMatrix.Avalonia/Views/Dialogs/PackageModificationDialog.axaml

@ -13,8 +13,9 @@
<TextBlock Grid.Row="0" Text="{Binding Text}"
FontSize="16"
Margin="4"
TextWrapping="WrapWithOverflow"
TextAlignment="Center"
HorizontalAlignment="Center"/>
HorizontalAlignment="Stretch"/>
<TextBlock Grid.Row="1" Text="{Binding Description}"
Margin="4"
@ -49,7 +50,6 @@
<Button Grid.Row="5" Content="Close"
FontSize="20"
Margin="8"
HorizontalAlignment="Center"
Command="{Binding OnCloseButtonClick}"/>
</Grid>

2
StabilityMatrix.Avalonia/Views/Dialogs/PackageModificationDialog.axaml.cs

@ -43,7 +43,7 @@ public partial class PackageModificationDialog : UserControlBase
var editor = this.FindControl<TextEditor>("Console");
if (editor?.Document == null)
return;
var line = Math.Max(editor.Document.LineCount - 5, 1);
var line = Math.Max(editor.Document.LineCount - 1, 1);
editor.ScrollToLine(line);
});
};

Loading…
Cancel
Save