示例#1
0
        private void ModListItemChecked(object sender, ItemCheckedEventArgs e)
        {
            // If there is a duplicate id conflict
            // check all at the same time
            var modChecked = ModList.GetModelObject(e.Item.Index);

            if (modChecked.State.HasFlag(ModState.DuplicateID))
            {
                foreach (var mod in Mods.All.Where(@mod => mod.ID == modChecked.ID))
                {
                    mod.isActive = modChecked.isActive;
                    UpdateMod(mod);
                }
            }
            // put on a slight delay
            // so it will only update once
            if (_updateTimer != null && _updateTimer.Enabled)
            {
                return;
            }

            _updateTimer = new Timer(10)
            {
                SynchronizingObject = this,
                AutoReset           = false
            };

            _updateTimer.Elapsed += delegate { UpdateConflicts(); };

            _updateTimer.Start();
        }
        private void ModListItemChecked(object sender, ItemCheckedEventArgs e)
        {
            var modChecked = ModList.GetModelObject(e.Item.Index);

            List <ModEntry> updatedMods = new List <ModEntry>();

            // If there is a duplicate id conflict check all
            // at the same time and mark them as updated
            if (modChecked.State.HasFlag(ModState.DuplicateID))
            {
                foreach (var mod in Mods.All.Where(@mod => mod.ID == modChecked.ID))
                {
                    mod.isActive = modChecked.isActive;
                    updatedMods.Add(mod);
                    UpdateMod(mod);
                }
            }
            // Otherwise just mark the one as updated
            else
            {
                updatedMods.Add(modChecked);
            }

            UpdateConflictsForMods(updatedMods);
        }