public void ShowCreateTemplateWizard()
{
if (_agsEditor.SourceControlProvider.ProjectUnderControl)
{
if (this.ShowQuestion("This game is under source control. It is not advisable to create a template that is bound to source control. Are you sure you want to continue?", MessageBoxIcon.Warning) == DialogResult.No)
{
return;
}
}
List<WizardPage> pages = new List<WizardPage>();
MakeTemplateWizardPage templateCreationPage = new MakeTemplateWizardPage(_agsEditor.TemplatesDirectory, ".agt");
pages.Add(templateCreationPage);
WizardDialog dialog = new WizardDialog("Create Template", "This wizard will guide you through the process of creating a template. A template allows other people to easily create a game that uses your game as a starting point.", pages);
DialogResult result = dialog.ShowDialog();
if (result == DialogResult.OK)
{
string templateName = templateCreationPage.GetFullPath();
try
{
_agsEditor.SaveGameFiles();
InteractiveTasks.CreateTemplateFromCurrentGame(templateName);
Factory.GUIController.ShowMessage("Template created successfully. To try it out, close AGS, start it up again, and select the 'Start New Game' option.", MessageBoxIcon.Information);
}
catch (AGSEditorException ex)
{
Factory.GUIController.ShowMessage("There was an error creating your template:" + Environment.NewLine + ex.Message, MessageBoxIcon.Warning);
}
catch (Exception ex)
{
Factory.GUIController.ShowMessage("There was an error creating your template. The error was: " + ex.Message + Environment.NewLine + Environment.NewLine + "Error details: " + ex.ToString(), MessageBoxIcon.Warning);
}
}
dialog.Dispose();
}