Пример #1
0
        /// <summary>
        /// Removes the DisplayPreset from the collection with the given name.
        /// </summary>
        /// <param name="presetName">Name of the preset to remove.</param>
        /// <returns>True if preset found and removed, false otherwise.</returns>
        public bool TryRemoveDisplayPreset(string presetName)
        {
            if (mDisplayPresetDictionary.ContainsKey(presetName))
            {
                mDisplayPresetDictionary.Remove(presetName);
                DisplayPresetCollectionChanged?.Invoke(DisplayPresetCollectionChangeType.PresetRemoved, presetName);

                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
        /// <summary>
        /// Adds a new DisplayPreset to the collection of display configuration presets.
        /// </summary>
        /// <param name="preset">The new DisplayPreset to add.</param>
        /// <returns>True if the DisplayPreset.Name is unique in the collection of presets. False otherwise.</returns>
        public bool TryAddDisplayPreset(DisplayPreset preset)
        {
            if (!mDisplayPresetDictionary.ContainsKey(preset.Name))
            {
                mDisplayPresetDictionary.Add(preset.Name, preset);
                DisplayPresetCollectionChanged?.Invoke(DisplayPresetCollectionChangeType.PresetAdded, preset.Name);

                return(true);
            }
            else
            {
                return(false);
            }
        }