properly save project-specific settings from the ProjectType into the actual ProjectObjectModel
This commit is contained in:
parent
328728fa32
commit
e217c4769d
@ -115,5 +115,19 @@ namespace UniversalEditor.ObjectModels.Project
|
||||
/// </summary>
|
||||
/// <value>The relative path to the <see cref="ProjectObjectModel" />.</value>
|
||||
public string RelativeFileName { get; set; } = String.Empty;
|
||||
|
||||
private System.Collections.Generic.Dictionary<Guid, object> _projectSettings = new System.Collections.Generic.Dictionary<Guid, object>();
|
||||
public object GetProjectSetting(Guid id, object defaultValue = null)
|
||||
{
|
||||
if (_projectSettings.ContainsKey(id))
|
||||
{
|
||||
return _projectSettings[id];
|
||||
}
|
||||
return defaultValue;
|
||||
}
|
||||
public void SetProjectSetting(Guid id, object value)
|
||||
{
|
||||
_projectSettings[id] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1428,6 +1428,13 @@ namespace UniversalEditor.UserInterface
|
||||
{
|
||||
if (projType.SettingsProvider != null)
|
||||
{
|
||||
for (int i = 0; i < projType.SettingsProvider.SettingsGroups.Count; i++)
|
||||
{
|
||||
for (int j = 0; j < projType.SettingsProvider.SettingsGroups[i].Settings.Count; j++)
|
||||
{
|
||||
projType.SettingsProvider.SettingsGroups[i].Settings[j].SetValue(project.GetProjectSetting(projType.SettingsProvider.SettingsGroups[i].Settings[j].ID, projType.SettingsProvider.SettingsGroups[i].Settings[j].DefaultValue));
|
||||
}
|
||||
}
|
||||
list.Add(projType.SettingsProvider);
|
||||
}
|
||||
}
|
||||
@ -1444,6 +1451,19 @@ namespace UniversalEditor.UserInterface
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
// TODO: apply properties to project
|
||||
foreach (ProjectType projType in project.ProjectTypes)
|
||||
{
|
||||
if (projType.SettingsProvider != null)
|
||||
{
|
||||
for (int i = 0; i < projType.SettingsProvider.SettingsGroups.Count; i++)
|
||||
{
|
||||
for (int j = 0; j < projType.SettingsProvider.SettingsGroups[i].Settings.Count; j++)
|
||||
{
|
||||
project.SetProjectSetting(projType.SettingsProvider.SettingsGroups[i].Settings[j].ID, projType.SettingsProvider.SettingsGroups[i].Settings[j].GetValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user