internal void saveAddonProject(String projectLocation = null)
{
#region Catalog and Basket
addonProject.catalog.catalog_products = productsListBox.Items.Cast<String>().ToList();
addonProject.catalog.catalog_categories = categoriesListBox.Items.Cast<String>().ToList();
addonProject.catalog.basket_definitions = basketsListBox.Items.Cast<String>().ToList();
#endregion
#region Accent
addonProject.accent.accentXaml = avalonEditProxyAccent.textEditor.Text;
#endregion
#region Theme
addonProject.theme.themeXaml = avalonEditProxyTheme.textEditor.Text;
#endregion
#region Language
addonProject.language.languageFileText = avalonEditProxyLanguage.textEditor.Text;
#endregion
if (String.IsNullOrWhiteSpace(projectLocation))
{
if (saveProjectDialog.ShowDialog() == DialogResult.OK)
{
if (saveProjectDialog.FileName.EndsWith(".addonmanager.project"))
{
File.WriteAllText(saveProjectDialog.FileName, DerivedFunctions.serializeObject(addonProject), new UTF8Encoding(false, false));
addonProject.projectLocation = saveProjectDialog.FileName;
MessageBox.Show("The project has been saved successfully!", "Just to let you know...", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("Please use the default extension '.addonmanager.project' and retry.",
"Hold your horses there, big guy!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
}
else
{
File.WriteAllText(projectLocation, DerivedFunctions.serializeObject(addonProject), new UTF8Encoding(false, false));
MessageBox.Show("The project has been saved successfully!", "Just to let you know...", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
#endregion