forked from LykosAI/StabilityMatrix
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
99 additions
and
6 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
StabilityMatrix.Avalonia/ViewModels/Dialogs/ConfirmPackageDeleteDialogViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System; | ||
using CommunityToolkit.Mvvm.ComponentModel; | ||
using StabilityMatrix.Avalonia.ViewModels.Base; | ||
using StabilityMatrix.Avalonia.Views.Dialogs; | ||
using StabilityMatrix.Core.Attributes; | ||
|
||
namespace StabilityMatrix.Avalonia.ViewModels.Dialogs; | ||
|
||
[View(typeof(ConfirmPackageDeleteDialog))] | ||
[ManagedService] | ||
[Transient] | ||
public partial class ConfirmPackageDeleteDialogViewModel : ContentDialogViewModelBase | ||
{ | ||
public required string ExpectedPackageName { get; set; } | ||
|
||
[ObservableProperty] | ||
[NotifyPropertyChangedFor(nameof(IsValid))] | ||
private string packageName = string.Empty; | ||
|
||
public bool IsValid => ExpectedPackageName.Equals(PackageName, StringComparison.Ordinal); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
StabilityMatrix.Avalonia/Views/Dialogs/ConfirmPackageDeleteDialog.axaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<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:lang="clr-namespace:StabilityMatrix.Avalonia.Languages" | ||
xmlns:dialogs="clr-namespace:StabilityMatrix.Avalonia.ViewModels.Dialogs" | ||
xmlns:controls1="clr-namespace:FluentAvalonia.UI.Controls;assembly=FluentAvalonia" | ||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" | ||
x:DataType="dialogs:ConfirmPackageDeleteDialogViewModel" | ||
x:Class="StabilityMatrix.Avalonia.Views.Dialogs.ConfirmPackageDeleteDialog"> | ||
<Grid RowDefinitions="Auto, Auto, Auto, Auto, *" | ||
Margin="8"> | ||
<TextBlock Text="{x:Static lang:Resources.Text_PackageUninstall_Details}" | ||
FontWeight="Bold" | ||
FontSize="20" | ||
TextAlignment="Center" | ||
TextWrapping="Wrap"/> | ||
<TextBlock Grid.Row="1" | ||
Margin="0,32,0,8" | ||
TextAlignment="Center"> | ||
<Run Text="Please type"/> | ||
<Run FontWeight="Bold" Text="{Binding ExpectedPackageName}"/> | ||
<Run Text="to confirm the deletion of the package:"/> | ||
</TextBlock> | ||
|
||
<TextBox Grid.Row="2" | ||
Text="{Binding PackageName, Mode=TwoWay}" | ||
Margin="0,16,0,0"/> | ||
|
||
<controls1:InfoBar Grid.Row="3" | ||
Margin="0,16,0,0" | ||
IsClosable="False" | ||
IsOpen="True" | ||
Title="{x:Static lang:Resources.Label_ActionCannotBeUndone}" | ||
Severity="Warning"/> | ||
|
||
<UniformGrid Grid.Row="4" HorizontalAlignment="Stretch" | ||
VerticalAlignment="Bottom" | ||
Margin="0,32,0,0"> | ||
<Button Content="{x:Static lang:Resources.Action_Delete}" | ||
Classes="danger" | ||
IsEnabled="{Binding IsValid}" | ||
HorizontalAlignment="Stretch" | ||
Margin="0,0,4,0" | ||
Command="{Binding OnPrimaryButtonClick}" | ||
FontSize="16"/> | ||
<Button Content="{x:Static lang:Resources.Action_Cancel}" | ||
Command="{Binding OnCloseButtonClick}" | ||
Margin="4,0,0,0" | ||
HorizontalAlignment="Stretch" | ||
FontSize="16"/> | ||
</UniformGrid> | ||
</Grid> | ||
</controls:UserControlBase> |
13 changes: 13 additions & 0 deletions
13
StabilityMatrix.Avalonia/Views/Dialogs/ConfirmPackageDeleteDialog.axaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
using StabilityMatrix.Avalonia.Controls; | ||
using StabilityMatrix.Core.Attributes; | ||
|
||
namespace StabilityMatrix.Avalonia.Views.Dialogs; | ||
|
||
[Transient] | ||
public partial class ConfirmPackageDeleteDialog : UserControlBase | ||
{ | ||
public ConfirmPackageDeleteDialog() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} |