Initial Commit

This commit is contained in:
retr0volkov
2025-06-26 16:21:56 +03:00 Unverified
commit e5f8982c44
34 changed files with 2052 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
using System;
using Avalonia.Controls;
using Avalonia.Controls.Templates;
using GazpromApp.ViewModels;
namespace GazpromApp;
public class ViewLocator : IDataTemplate
{
public Control? Build(object? param)
{
if (param is null)
return null;
var name = param.GetType().FullName!.Replace("ViewModel", "View", StringComparison.Ordinal);
var type = Type.GetType(name);
if (type != null)
{
return (Control)Activator.CreateInstance(type)!;
}
return new TextBlock { Text = "Not Found: " + name };
}
public bool Match(object? data)
{
return data is ViewModelBase;
}
}