Beispiel #1
0
        private void InitModsCollectionSource()
        {
            mods = new CollectionViewSource();
            mods.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));
            mods.Filter += (sender, e) =>
            {
                e.Accepted = false;

                var modItem = e.Item as ModListItemViewModel;

                if (showEnabledMods && modItem.IsEnabled)
                {
                    e.Accepted = true;
                }

                if (showDisabledMods && modItem.IsEnabled == false)
                {
                    e.Accepted = true;
                }

                var modViewModel = modItem as ModViewModel;
                if (modViewModel != null && PreinstalledMods.IsPreinstalledMod(modViewModel.Mod))
                {
                    e.Accepted = false;
                }
            };
        }
Beispiel #2
0
        public override void Disable()
        {
            if (PreinstalledMods.IsPreinstalledMod(Mod))
            {
                throw new ModLockedException("This mod cannot be disabled, as it is part of the original installation of Cortex Command.");
            }

            try
            {
                modManager.DisableMod(Mod);
                OnPropertyChanged(x => IsEnabled);
            }
            catch (IOException)
            {
                throw new ModLockedException("This mod cannot be disabled, as a file in it is being used by another program, or the folder already exists in the Disabled Mods folder.");
            }
        }