I am using the Properties.Settings field in the project. Set the variable type to bool, string etc. When I set it the below code works without any problem. But when I set a class directly in the project as a type, it doesn't save. Settings field can't access the classes in the project?
Data type : ProjectName.Models.SettingsModel, Name : AppSettigs.
Data type : bool, Name : IsRemember.
In the code below, the save process is successful. But when I open the project again, AppSettings returns null.
Code:
Properties.Settings.Default.IsRemember = true;
Properties.Settings.Default.AppSettings = new SettingsModel()
{
AccentColorItems = Settings.AccentColorItems,
ThemeItems = Settings.ThemeItems,
SelectedAccentColor = Settings.SelectedAccentColor,
SelectedTheme = Settings.SelectedTheme,
SelectedLanguage = Settings.SelectedLanguage,
AppNotifications = Settings.AppNotifications,
SystemNotifications = Settings.SystemNotifications,
AllowAutomaticUpdating = Settings.AllowAutomaticUpdating
};
Properties.Settings.Default.Save();
I followed the suggestions here, but nothing changed.