feat: implement verificationcodeitem and corresponding delete operation.
This commit is contained in:
@@ -3,11 +3,14 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:u="https://irihi.tech/ursa"
|
||||
xmlns:vm="using:Ursa.Demo.ViewModels"
|
||||
x:DataType="vm:VerificationCodeDemoViewModel"
|
||||
x:CompileBindings="True"
|
||||
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
|
||||
x:Class="Ursa.Demo.Pages.VerificationCodeDemo">
|
||||
<StackPanel>
|
||||
<u:VerificationCode CountOfDigit="4" Name="v4"/>
|
||||
<u:VerificationCode Count="4" Name="v4" CompleteCommand="{Binding CompleteCommand}"/>
|
||||
<ListBox ItemsSource="{Binding #v4.Digits}"></ListBox>
|
||||
<u:VerificationCode CountOfDigit="6" PasswordChar="*" />
|
||||
<u:VerificationCode Count="6" PasswordChar="•" Complete="VerificationCode_OnComplete" />
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Avalonia;
|
||||
using Avalonia.Controls;
|
||||
using Avalonia.Markup.Xaml;
|
||||
using Ursa.Controls;
|
||||
|
||||
namespace Ursa.Demo.Pages;
|
||||
|
||||
@@ -10,4 +11,10 @@ public partial class VerificationCodeDemo : UserControl
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private async void VerificationCode_OnComplete(object? sender, VerificationCodeCompleteEventArgs e)
|
||||
{
|
||||
var text = string.Join(string.Empty, e.Code);
|
||||
await MessageBox.ShowOverlayAsync(text);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,26 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using Avalonia.Collections;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Ursa.Controls;
|
||||
|
||||
namespace Ursa.Demo.ViewModels;
|
||||
|
||||
public class VerificationCodeDemoViewModel: ObservableObject
|
||||
{
|
||||
|
||||
public ICommand CompleteCommand { get; set; }
|
||||
|
||||
public VerificationCodeDemoViewModel()
|
||||
{
|
||||
CompleteCommand = new AsyncRelayCommand<IList<string>>(OnComplete);
|
||||
}
|
||||
|
||||
private async Task OnComplete(IList<string>? obj)
|
||||
{
|
||||
if (obj is null) return;
|
||||
var code = string.Join("", obj);
|
||||
await MessageBox.ShowOverlayAsync(code);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user