Exemplo n.º 1
0
        private void generateBtn_Click(object sender, EventArgs e)
        {
            if (!this.CheckParameters())
            {
                return;
            }
            var generationObjects = GenerationHelper.GetGenerationObjects(this.treeView);
            int genObjectCount    = generationObjects.Sum(x => x.Value.Count);

            if (genObjectCount == 0)
            {
                MessageBoxHelper.DisplayInfo(Resources.ShouldCheckedTreeNode);
                return;
            }

            int fileCount = genObjectCount * this.templateListBox.SelectedItems.Count;

            this.generateBtn.Enabled    = false;
            this.completedLbl.Visible   = false;
            this.totalFileCountLbl.Text = fileCount.ToString();
            this.genProgressBar.Maximum = fileCount;

            GenerationParameter parameter = new GenerationParameter(
                ModelManager.Clone(),
                GenerationHelper.GetGenerationObjects(this.treeView),
                this.GetGenerationSettings());

            try
            {
                this.codeGeneration.GenerateAsync(parameter, Guid.NewGuid().ToString());
            }
            catch (Exception ex)
            {
                logger.Error(Resources.GenerateFailure, ex);
            }
        }