Пример #1
0
        private void AddNewSetting(int id, SimpleTimerSettings setting)
        {
            this.savedSettings.Add((SimpleTimerSettings)setting.Clone());

            var index = this.savedSettings.Count - 1;

            this.idToSettingIdx[id]             = index;
            this.nameToSettingIdx[setting.Name] = index;
        }
Пример #2
0
        private void UpdateSetting(int id, SimpleTimerSettings setting)
        {
            var index = this.idToSettingIdx[id];

            // First check if this setting was under a different name
            var oldName = this.savedSettings[index].Name;

            if (oldName != setting.Name)
            {
                // Remove ties to old name
                this.nameToSettingIdx.Remove(oldName);

                // Add the new name
                this.nameToSettingIdx.Add(setting.Name, index);
            }

            // Update setting
            this.savedSettings[index]           = setting.Clone() as SimpleTimerSettings;
            this.nameToSettingIdx[setting.Name] = index;
        }