Пример #1
0
        /// <summary>
        /// Register a resources events
        /// </summary>
        private void RegisterEvents(Resource instance)
        {
            instance.Changed += OnResourceChanged;

            if (instance is IPublicResource asPublic)
            {
                asPublic.CapabilitiesChanged += RaiseCapabilitiesChanged;
            }

            foreach (var autoSaveCollection in ResourceReferenceTools.GetAutoSaveCollections(instance))
            {
                autoSaveCollection.CollectionChanged += OnAutoSaveCollectionChanged;
            }
        }
Пример #2
0
        /// <summary>
        /// Register a resources events
        /// </summary>
        private void UnregisterEvents(Resource instance)
        {
            instance.Changed -= OnResourceChanged;

            var asPublic = instance as IPublicResource;

            if (asPublic != null)
            {
                asPublic.CapabilitiesChanged -= RaiseCapabilitiesChanged;
            }

            foreach (var autoSaveCollection in ResourceReferenceTools.GetAutoSaveCollections(instance))
            {
                autoSaveCollection.CollectionChanged -= OnAutoSaveCollectionChanged;
            }
        }