Beispiel #1
0
        internal void RemoveReference(bool automaticReference)
        {
            if (automaticReference)
            {
                References--;
            }
            _framework.RemoveRefrence();
            //If is not enabled (last reference was removed) then remove settings block from the collection
            if (!IsChecked)
            {
                _profilingTypesSettings.Remove(_profilingType.Definition.Uid);
            }
            //Look through profiling types and enable dependencies of current profiling type
            IEnumerable <DependencyDefinition> dependencies = _profilingType.Definition.Dependencies;

            foreach (ProfilingTypeViewModel profilingTypeViewModel in _profilingTypes)
            {
                //profilingTypeViewModel is current profiling type - do nothing
                if (profilingTypeViewModel == this)
                {
                    continue;
                }
                ProfilingTypeViewModel viewModel = profilingTypeViewModel;
                //If profilingTypeViewModel is dependency for current profiling type?
                //If yes - disable it
                if (dependencies.Any(x => viewModel.ProfilingType.Definition.Uid == x.Uid))
                {
                    viewModel.RemoveReference(true);
                }
            }
        }