Ejemplo n.º 1
0
        public void CleanReferences()
        {
            var iterator = referenceList.ToList();

            foreach (var reference in iterator)
            {
                if (!reference.Value.IsAlive)
                {
                    referenceList.Remove(reference.Key);
                }
            }
            modelBuffer.RemoveAll(x => x.Key < DateTime.Now.Subtract(TimeSpan.FromMinutes(bufferKeepMinutes)));
        }
        private void UnloadModelFromRegister(IModelDoc2 model)
        {
            MacroFeatureLifecycleManager lcm;

            if (m_LifecycleManagers.TryGetValue(model, out lcm))
            {
                lcm.ModelDisposed  -= OnModelDisposed;
                lcm.FeatureDeleted -= OnFeatureDeleted;

                m_LifecycleManagers.Remove(model);
            }
            else
            {
                Debug.Assert(false, "Model is not registered");
            }

            MacroFeatureDictionary modelDict;

            if (m_Register.TryGetValue(model, out modelDict))
            {
                foreach (var handler in modelDict.Values)
                {
                    handler.Unload(MacroFeatureUnloadReason_e.ModelClosed);
                }

                m_Register.Remove(model);
            }
            else
            {
                Debug.Assert(false, "Model is not registered");
            }
        }