demo_trade/Views/GuestProductControl.axaml.cs

28 lines
899 B
C#
Raw Permalink Normal View History

2024-10-04 12:41:04 +00:00
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Avalonia.ReactiveUI;
using demo_trade.ViewModels;
using ReactiveUI;
using System.Reactive.Disposables;
using System.Threading.Tasks;
namespace demo_trade;
public partial class GuestProductControl : ReactiveUserControl<GuestProductViewModel>
{
public GuestProductControl()
{
this.WhenActivated(disposables => disposables(ViewModel!.ShowDialog.RegisterHandler(DoShowOrderDialogAsync)));
AvaloniaXamlLoader.Load(this);
}
private async Task DoShowOrderDialogAsync(InteractionContext<OrderShowDialogViewModel, bool> interaction){
var dialog = new OrderShowDialog();
dialog.DataContext = interaction.Input;
var result = await dialog.ShowDialog<OrderShowDialogViewModel>(TopLevel.GetTopLevel(this) as Window);
interaction.SetOutput(true);
}
}