demo_trade/Views/ClientProductControl.axaml.cs
2024-10-04 15:41:04 +03:00

29 lines
891 B
C#

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);
}
}