Пример #1
0
    private void InitializeTemplate(Type componentType)
    {
        if (_templateComponent == null)
        {
            ObserversList.Clear();
        }

        if (_templateComponent != null)
        {
            if (componentType != _templateComponent.GetType())
            {
                ObserversList.Clear();
            }
            else
            {
                return;
            }
        }

        if (!typeof(EntryComponent).IsAssignableFrom(componentType))
        {
            throw new ArgumentException("type must be a subclass of EntryComponent");
        }


        _templateComponent = EntryComponent.CreateInstance(componentType);
        _templateComponent.Initialize(_holder);
        _templateComponent.OnEditModeModified += OnTemplateEditChanged_UpdateObservers;
    }
Пример #2
0
 public void SetTemplate(EntryComponent template)
 {
     if (template == null)
     {
         throw new ArgumentNullException();
     }
     ObserversList.Clear();
     _templateComponent = template;
     _holder            = template.Holder;
     _templateComponent.OnEditModeModified += OnTemplateEditChanged_UpdateObservers;
 }
Пример #3
0
 public void ClearObservers()
 {
     ObserversList.ForEach(AssetsPath.DestroyAsset);
     ObserversList.Clear();
 }