diff --git a/samples/Avalonia.Labs.Catalog/ViewModels/QrViewModel.cs b/samples/Avalonia.Labs.Catalog/ViewModels/QrViewModel.cs index cf43861..adc8c92 100644 --- a/samples/Avalonia.Labs.Catalog/ViewModels/QrViewModel.cs +++ b/samples/Avalonia.Labs.Catalog/ViewModels/QrViewModel.cs @@ -4,6 +4,8 @@ using Avalonia.Media; using Avalonia.Labs.Qr; using ReactiveUI; +using System.Collections.ObjectModel; +using static Avalonia.Labs.Qr.QrCode; namespace Avalonia.Labs.Catalog.ViewModels { @@ -80,6 +82,8 @@ public Color QrCodeBackgroundColor2 set => this.RaiseAndSetIfChanged(ref _qrCodeBackgroundColor2, value); } + public ObservableCollection Levels { get; } + static QrViewModel() { ViewLocator.Register(typeof(QrViewModel), () => new QrView()); @@ -89,6 +93,8 @@ public QrViewModel() { ResetQrCode(); Title = "Qr Generator"; + + Levels = new ObservableCollection(Enum.GetValues()); } public void UpdateQrCode(string text) @@ -113,9 +119,14 @@ public void RandomizeColors() QrCodeBackgroundColor1 = Color.FromRgb(newColors[6], newColors[7], newColors[8]); QrCodeBackgroundColor2 = Color.FromRgb(newColors[9], newColors[10], newColors[11]); + + var cuurentCode = QrCodeString; + QrCodeString = string.Empty; + + UpdateQrCode(cuurentCode); } - private void ResetQrCode() + public void ResetQrCode() { QrCodeEccLevel = QrCode.EccLevel.Medium; diff --git a/samples/Avalonia.Labs.Catalog/Views/QrView.axaml b/samples/Avalonia.Labs.Catalog/Views/QrView.axaml index f873bc1..e586096 100644 --- a/samples/Avalonia.Labs.Catalog/Views/QrView.axaml +++ b/samples/Avalonia.Labs.Catalog/Views/QrView.axaml @@ -60,6 +60,7 @@ VerticalAlignment="Center"/> @@ -67,14 +68,14 @@ Orientation="Horizontal" Spacing="10">