using Avalonia.Controls; using Avalonia.Controls.Templates; using demo_trade.ViewModels; using ReactiveUI; using System; namespace demo_trade { public class ViewLocator : ReactiveUI.IViewLocator { public IViewFor? ResolveView(T? viewModel, string? contract = null) => viewModel switch { LoginViewModel context => new LoginControl { DataContext = context }, GuestProductViewModel context => new GuestProductControl { DataContext = context }, ClientProductViewModel context => new ClientProductControl{ DataContext = context }, OrderShowDialogViewModel context => new OrderShowDialog{ DataContext = context}, OrderManagerViewModel context => new OrderManagerControl { DataContext = context }, _ => throw new ArgumentOutOfRangeException(nameof(viewModel)) }; } }