JT
8 months ago
committed by
GitHub
4 changed files with 99 additions and 6 deletions
@ -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); |
||||||
|
} |
@ -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> |
@ -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(); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue