L
Lloyd Dupont
I have simple setting class as follow (I want to remember a list of opened file)
----
[Serializable]
public class RecipeFileInfo
{
public string Name;
public string Location;
}
public class UserSettings : ApplicationSettingsBase
{
[UserScopedSetting()]
public List<RecipeFileInfo> RecipeFiles
{
get { return (List<RecipeFileInfo>)this["RecipeFiles"]; }
set { this["RecipeFiles"] = value; }
}
}
----
when the program finish I call Save() on my settings like that:
----
public static class Program
{
[STAThread]
static void Main()
{
Application.Run(new MainForm());
UserSettings.Save();
}
static UserSettings usersettings;
public static UserSettings UserSettings
{
get {
if (usersettings == null)
usersettings = new UserSettings();
return usersettings;
}
}
----
during the course of the program I tested that the setting where updated.
Anyway, my setting are not saved! (and restored when the application start, of course!)
There are no new file/folder in DocumentSetting/my/ApplicationData
Is this class broken in beta2? or am I missing something?
Also VS.NET2005 (beta2) created a Settings class (in a subnamespace called property), won't this mess up with my settings?
as there should be only 1 file for both settings!
should I call Save() on both? or only 1 of them?
----
[Serializable]
public class RecipeFileInfo
{
public string Name;
public string Location;
}
public class UserSettings : ApplicationSettingsBase
{
[UserScopedSetting()]
public List<RecipeFileInfo> RecipeFiles
{
get { return (List<RecipeFileInfo>)this["RecipeFiles"]; }
set { this["RecipeFiles"] = value; }
}
}
----
when the program finish I call Save() on my settings like that:
----
public static class Program
{
[STAThread]
static void Main()
{
Application.Run(new MainForm());
UserSettings.Save();
}
static UserSettings usersettings;
public static UserSettings UserSettings
{
get {
if (usersettings == null)
usersettings = new UserSettings();
return usersettings;
}
}
----
during the course of the program I tested that the setting where updated.
Anyway, my setting are not saved! (and restored when the application start, of course!)
There are no new file/folder in DocumentSetting/my/ApplicationData
Is this class broken in beta2? or am I missing something?
Also VS.NET2005 (beta2) created a Settings class (in a subnamespace called property), won't this mess up with my settings?
as there should be only 1 file for both settings!
should I call Save() on both? or only 1 of them?