Exemple #1
0
        void SetupNewItem(SolutionItem item, SolutionItem replacedItem)
        {
            ConvertToSolutionFormat(item, false);

            SolutionEntityItem eitem = item as SolutionEntityItem;

            if (eitem != null)
            {
                eitem.NeedsReload = false;
                if (eitem.SupportsConfigurations() || replacedItem != null)
                {
                    if (replacedItem == null)
                    {
                        // Register the new entry in every solution configuration
                        foreach (SolutionConfiguration conf in Configurations)
                        {
                            conf.AddItem(eitem);
                        }
                        // If there is no startup project or it is an invalid one, use the new project as startup if possible
                        if ((StartupItem == null || !StartupItem.SupportsExecute()) && eitem.SupportsExecute())
                        {
                            StartupItem = eitem;
                        }
                    }
                    else
                    {
                        // Reuse the configuration information of the replaced item
                        foreach (SolutionConfiguration conf in Configurations)
                        {
                            conf.ReplaceItem((SolutionEntityItem)replacedItem, eitem);
                        }
                        if (StartupItem == replacedItem)
                        {
                            StartupItem = eitem;
                        }
                        else
                        {
                            int i = MultiStartupItems.IndexOf((SolutionEntityItem)replacedItem);
                            if (i != -1)
                            {
                                MultiStartupItems [i] = eitem;
                            }
                        }
                    }
                }
            }
        }