-
Notifications
You must be signed in to change notification settings - Fork 803
Expand file tree
/
Copy pathLocalSettingsInfo.cs
More file actions
58 lines (49 loc) · 1.85 KB
/
LocalSettingsInfo.cs
File metadata and controls
58 lines (49 loc) · 1.85 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Text.Json.Serialization;
namespace NETworkManager.Settings;
/// <summary>
/// Class contains local settings that are stored outside the main settings file.
/// These settings control where the main settings file is located.
/// </summary>
public class LocalSettingsInfo
{
/// <summary>
/// Occurs when a property value changes.
/// </summary>
/// <remarks>This event is typically used to notify subscribers that a property value has been updated. It
/// is commonly implemented in classes that support data binding or need to signal changes to property
/// values.</remarks>
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Helper method to raise the <see cref="PropertyChanged" /> event.
/// </summary>
/// <param name="propertyName">Name of the property that changed.</param>
private void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
SettingsChanged = true;
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}
#region Variables
[JsonIgnore] public bool SettingsChanged { get; set; }
/// <summary>
/// Private field for the <see cref="SettingsFolderLocation" /> property."
/// </summary>
private string _settingsFolderLocation;
/// <summary>
/// Location of the folder where the local settings file is stored.
/// This can be changed by the user to move the settings file to a different location.
/// </summary>
public string SettingsFolderLocation
{
get => _settingsFolderLocation;
set
{
if (_settingsFolderLocation == value)
return;
_settingsFolderLocation = value;
OnPropertyChanged();
}
}
#endregion
}