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