static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); bool multiproject = MessageBox.Show( "Multi-Project?", "Project Type", MessageBoxButtons.YesNo) == DialogResult.Yes; bool webApiSharedPortable = false; if (multiproject) webApiSharedPortable = MessageBox.Show( "Web API Shared Portable?", "Shared Portable Exception", MessageBoxButtons.YesNo) == DialogResult.Yes; var result = DialogResult.OK; while (result != DialogResult.Cancel) { var dialog = new EntitiesSelectionDialog(multiproject, webApiSharedPortable); result = dialog.ShowDialog(); if (result == DialogResult.Cancel) continue; string entitiesSelection = dialog.EntitiesSelection.ToString(); MessageBox.Show(entitiesSelection, "Entities Selection"); } }
// Select entities template public static void SelectEntitiesTemplate(bool multiproject, string templateName) { // Disallow shared portable entities for WebApi due to Json.net compat issues: // Error: Method not found (Newtonsoft.Json.Serialization.DefaultContractResolver SET_IgnoreSerializableAttribute) bool webApiSharedPortable = templateName.Equals(Constants.ProjectTemplates.TrackableWebApi, StringComparison.InvariantCultureIgnoreCase) || templateName.Equals(Constants.ProjectTemplates.TrackableWebApiPatterns, StringComparison.InvariantCultureIgnoreCase); // Prompt user for entities template var dialog = new EntitiesSelectionDialog(multiproject, webApiSharedPortable); if (dialog.ShowDialog() == DialogResult.Cancel) throw new WizardBackoutException(); // Place "$entitiestempaltename$ in entities root dictionary string entitiesTemplateName = GetEntitiesTemplateName(dialog.EntitiesSelection); RootDictionary[Constants.DictionaryEntries.EntitiesTemplateName] = entitiesTemplateName; // Place $cliententitiestemplate$ and $serviceentitiestemplate$ in root dictionary string[] entitiesTemplateNames = entitiesTemplateName.Split('|'); RootWizard.RootDictionary[Constants.DictionaryEntries.ClientEntitiesTemplate] = entitiesTemplateNames[0]; if (entitiesTemplateNames.Length == 2) RootWizard.RootDictionary[Constants.DictionaryEntries.ServiceEntitiesTemplate] = entitiesTemplateNames[1]; else RootWizard.RootDictionary[Constants.DictionaryEntries.ServiceEntitiesTemplate] = entitiesTemplateNames[0]; }