Moved the Views that existed in the Controls namespace into the Ryujinx.Ava.UI.Views.Misc namespace Moved UpdateWaitWindow to Ryujinx.Ava.UI.Windows
25 lines
713 B
C#
25 lines
713 B
C#
using Avalonia.Controls;
|
|
using Gommon;
|
|
using Ryujinx.Ava.UI.ViewModels;
|
|
using System;
|
|
|
|
namespace Ryujinx.Ava.UI.Controls
|
|
{
|
|
public class RyujinxControl<TViewModel> : UserControl where TViewModel : BaseModel
|
|
{
|
|
public TViewModel ViewModel
|
|
{
|
|
get
|
|
{
|
|
if (DataContext is not TViewModel viewModel)
|
|
throw new InvalidOperationException(
|
|
$"Underlying DataContext is not of type {typeof(TViewModel).AsPrettyString()}; " +
|
|
$"Actual type is {DataContext?.GetType().AsPrettyString()}");
|
|
|
|
return viewModel;
|
|
}
|
|
set => DataContext = value;
|
|
}
|
|
}
|
|
}
|