Esempio n. 1
0
        private void MantainNoConflictState()
        {
            // TODO: do not allow duplicates in custom part - postponed ATM, the user is warned when adding new installation
            // can be done with Installations.ItemPropertyChanged

            if (!auto_discovery_activated)
            {
                return;
            }

            // disable auto-discovered installations that have the same path as one of custom-set installations
            foreach (var i in Installations)
            {
                if (i.IsAutodiscoveredInstance)
                {
                    var same_pathed = Installations.Where(x => x.Path.TrimEnd('\\') == i.Path.TrimEnd('\\') && x.IsAutodiscoveredInstance == false);
                    if (same_pathed.Count() > 0)
                    {
                        if (i.CheckForUpdatesFlag != false)
                        {
                            i.CheckForUpdatesFlag = false;
                        }
                    }
                    else
                    {
                        if (i.CheckForUpdatesFlag != true)
                        {
                            i.CheckForUpdatesFlag = true;
                        }
                    }
                }
                else
                {
                    var same_pathed_autos = Installations.Where(x => x.Path.TrimEnd('\\') == i.Path.TrimEnd('\\') && x.IsAutodiscoveredInstance == true);
                    if (same_pathed_autos.Count() > 0)
                    {
                        if (i.OverridesAutodiscovered == false)
                        {
                            i.OverridesAutodiscovered = true;
                        }
                    }
                    else
                    {
                        if (i.OverridesAutodiscovered == true)
                        {
                            i.OverridesAutodiscovered = false;
                        }
                    }
                }
            }

            OnPropertyChanged("Installations");
        }