清理各个 Component 里的判断以及调用规范
This commit is contained in:
@@ -114,7 +114,7 @@ namespace SepCore.UIRouter
|
||||
|
||||
private void RegisterSerializedBindings()
|
||||
{
|
||||
if (_controllerBindings == null || _controllerBindings.Count == 0)
|
||||
if (_controllerBindings.Count == 0)
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -122,28 +122,36 @@ namespace SepCore.UIRouter
|
||||
HashSet<UIFormType> seen = new();
|
||||
foreach (ControllerBinding binding in _controllerBindings)
|
||||
{
|
||||
if (binding == null || binding.UIFormType == UIFormType.Undefined ||
|
||||
string.IsNullOrWhiteSpace(binding.ControllerTypeName))
|
||||
bool hasFormType = binding.UIFormType != UIFormType.Undefined;
|
||||
bool hasControllerTypeName = !string.IsNullOrWhiteSpace(binding.ControllerTypeName);
|
||||
if (!hasFormType && !hasControllerTypeName)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!hasFormType || !hasControllerTypeName)
|
||||
{
|
||||
Log.Error("UIRouter binding is incomplete: UIFormType '{0}', controller type name '{1}'.",
|
||||
binding.UIFormType.ToString(), binding.ControllerTypeName);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!seen.Add(binding.UIFormType))
|
||||
{
|
||||
Log.Warning("UIRouter duplicate binding for '{0}', later one overrides earlier one.",
|
||||
Log.Error("UIRouter duplicate binding for '{0}', later one overrides earlier one.",
|
||||
binding.UIFormType.ToString());
|
||||
}
|
||||
|
||||
Type controllerType = Type.GetType(binding.ControllerTypeName);
|
||||
if (controllerType == null)
|
||||
{
|
||||
Log.Warning("UIRouter binding type not found: {0}", binding.ControllerTypeName);
|
||||
Log.Error("UIRouter binding type not found: {0}", binding.ControllerTypeName);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!typeof(IUIController).IsAssignableFrom(controllerType))
|
||||
{
|
||||
Log.Warning("UIRouter binding type '{0}' does not implement IUIFormController.",
|
||||
Log.Error("UIRouter binding type '{0}' does not implement IUIController.",
|
||||
binding.ControllerTypeName);
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user