Доработан winui

This commit is contained in:
2026-02-01 09:26:13 +03:00
parent 584df249f6
commit e8b4cb9881
26 changed files with 1842 additions and 2373 deletions

View File

@@ -37,6 +37,10 @@ public class ContentRegistry
if (factory == null)
throw new ArgumentNullException(nameof(factory));
// Дополнительная проверка на пустую строку
if (string.IsNullOrEmpty(contentTypeId.Trim()))
throw new ArgumentException("Идентификатор типа контента не может быть пустой строкой.", nameof(contentTypeId));
if (_contentTypes.ContainsKey(contentTypeId))
throw new ArgumentException($"Тип контента '{contentTypeId}' уже зарегистрирован.");
@@ -70,13 +74,7 @@ public class ContentRegistry
throw new KeyNotFoundException($"Тип контента '{contentTypeId}' не зарегистрирован.");
var content = descriptor.Factory();
// Устанавливаем ID через рефлексию, если есть свойство Id
var property = content.GetType().GetProperty("Id");
if (property != null && property.CanWrite)
{
property.SetValue(content, id);
}
content.SetId(id);
return content;
}