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