demo_trade/Views/ClientProductControl.axaml.cs

29 lines
891 B
C#
Raw 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 ClientProductControl : ReactiveUserControl<ClientProductViewModel>
{
public ClientProductControl()
{
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);
}
}