コード例 #1
0
 private void wizard1_BeforeSwitchPages(object sender, Wizard.Wizard.BeforeSwitchPagesEventArgs e)
 {
     if (e.OldIndex < e.NewIndex)
     {
         if (wizard1.WizardPages[e.OldIndex] == pageTemplates)
         {
             if (_moduleList.Count > 0)
             {
                 if (!this.IsTemplatesChecked())
                 {
                     e.Cancel = true;
                     MessageBox.Show("You must choose items to generate.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
         }
         else if (wizard1.WizardPages[e.OldIndex] == pageModules)
         {
             if (_moduleList.Count > 0)
             {
                 if (!this.IsModulesChecked())
                 {
                     e.Cancel = true;
                     MessageBox.Show("You must choose one or more modules.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                 }
             }
         }
     }
 }
コード例 #2
0
        private void wizard1_BeforeSwitchPages(object sender, Wizard.Wizard.BeforeSwitchPagesEventArgs e)
        {
            if (wizard1.WizardPages[e.OldIndex] == pageDatabase && wizard1.WizardPages[e.NewIndex] == pageChoose)
            {
                try
                {
                    LoadDatabaseObjects();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("There was an error while trying to connect to the database.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    e.Cancel = true;
                    return;
                }

                if (cboItem.Items.Count == 0)
                {
                    e.Cancel = true;
                    MessageBox.Show("No objects could be found in the database.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
            }

            if (e.NewIndex == 0)
            {
                //On database page there should be no Finish button
                wizard1.FinishEnabled = false;
            }
            else if (e.NewIndex == 1)
            {
                //Do Nothing
                wizard1.FinishEnabled = false;
            }
            else if (e.NewIndex == 2)
            {
                wizard1.FinishEnabled = (cboItem.SelectedIndex != -1);
            }
        }
コード例 #3
0
        private void wizard1_BeforeSwitchPages(object sender, Wizard.Wizard.BeforeSwitchPagesEventArgs e)
        {
            if ((e.OldIndex == 0) && (e.NewIndex == e.OldIndex + 1))
            {
                txtEntityName.Text = txtEntityName.Text.Trim();

                //Verify new entity name
                if (!ValidationHelper.ValidCodeIdentifier(txtEntityName.Text))
                {
                    MessageBox.Show("The specified name is not valid.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    e.Cancel = true;
                    return;
                }

                //Verify it does not exist
                if (_model.Entities.Count(x => x.Name.ToLower() == txtEntityName.Text.ToLower()) > 0 ||
                    _model.Entities.Count(x => x.PascalName.ToLower() == txtEntityName.Text.ToLower()) > 0)
                {
                    MessageBox.Show("The specified name must be unqiue as a model entity.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    e.Cancel = true;
                    return;
                }
            }
            else if ((e.OldIndex == 1) && (e.NewIndex == e.OldIndex + 1))
            {
            }
            else if ((e.OldIndex == 2) && (e.NewIndex == e.OldIndex + 1))
            {
                //Ensure some fields checked
                if (lstField2.Items.Count == 0)
                {
                    MessageBox.Show("There must be at least one field selected for the new Entity.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    e.Cancel = true;
                    return;
                }
            }
        }
コード例 #4
0
 private void wizard1_BeforeSwitchPages(object sender, Wizard.Wizard.BeforeSwitchPagesEventArgs e)
 {
 }