2024-12-05 06:55:28 +00:00
|
|
|
using Avalonia.Controls.Templates;
|
|
|
|
using Presence.Desktop.ViewModels;
|
2024-12-13 07:21:14 +00:00
|
|
|
using System;
|
|
|
|
using Presence.Desktop.Views;
|
|
|
|
using ReactiveUI;
|
2024-12-05 06:55:28 +00:00
|
|
|
|
2024-12-13 07:21:14 +00:00
|
|
|
namespace Presence.Desktop
|
2024-12-05 06:55:28 +00:00
|
|
|
{
|
2024-12-13 07:21:14 +00:00
|
|
|
public class ViewLocator : IViewLocator
|
2024-12-05 06:55:28 +00:00
|
|
|
{
|
2024-12-13 07:21:14 +00:00
|
|
|
public IViewFor? ResolveView<T>(T? viewModel, string? contract = null) => viewModel switch
|
2024-12-05 06:55:28 +00:00
|
|
|
{
|
2024-12-13 07:21:14 +00:00
|
|
|
|
|
|
|
GroupViewModel groupViewModel => new GroupView{DataContext = groupViewModel},
|
|
|
|
PresenceViewModel presenceViewModel => new PresenceView{DataContext = presenceViewModel},
|
|
|
|
_ => throw new ArgumentOutOfRangeException(nameof(viewModel))
|
|
|
|
};
|
2024-12-05 06:55:28 +00:00
|
|
|
}
|
|
|
|
}
|