Example #1
0
		private void btnGenerate_Click(object sender, EventArgs e)
		{
			if (project != null)
			{
				ValidateSettings();

				try
				{
					SolutionType solutionType = (SolutionType) cboSolutionType.SelectedIndex;
					Generator generator = new Generator(project, solutionType);
					string destination = txtDestination.Text;

					GenerationResult result = generator.Generate(destination);
					if (result == GenerationResult.Success)
					{
						MessageBox.Show(Strings.CodeGenerationCompleted,
							Strings.CodeGeneration, MessageBoxButtons.OK,
							MessageBoxIcon.Information);
					}
					else if (result == GenerationResult.Error)
					{
						MessageBox.Show(Strings.CodeGenerationFailed,
							Strings.Error, MessageBoxButtons.OK,
							MessageBoxIcon.Error);
					}
					else // Cancelled
					{
						this.DialogResult = DialogResult.None;
					}
				}
				catch (Exception ex)
				{
					MessageBox.Show(ex.Message, Strings.UnknownError,
						MessageBoxButtons.OK, MessageBoxIcon.Error);
				}
			}
		}