aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Settings/SettingsBase.cs
blob: 157a80febf71d3acfb23a79248d619682d5c9816 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tango.Settings
{
    /// <summary>
    /// Represents a settings object base class.
    /// </summary>
    public abstract class SettingsBase
    {
        internal Action SaveAction { get; set; }

        /// <summary>
        /// Saves settings.
        /// </summary>
        /// <exception cref="System.InvalidOperationException">This settings instance is not registered with any settings manager.</exception>
        public virtual void Save()
        {
            if (SaveAction == null)
            {
                throw new InvalidOperationException("This settings instance is not registered with any settings manager.");
            }

            SaveAction();
        }
    }
}