private void Button_Create(object sender, RoutedEventArgs e) { if ((bool)BusinessRequirementsViewCheckbox.IsChecked) { //Name for BRV set if (businessRequirementsView.Text == null || businessRequirementsView.Text.Equals("")) { MessageBox.Show("Please select a name for the Business Requirements View.", "Error"); return; } } //Name for BCV set? if (businessChoreographyView.Text == null || businessChoreographyView.Text.Equals("")) { MessageBox.Show("Please select a name for the Business Choreography View.", "Error"); return; } //Name for BIV set? if (businessInformationView.Text == null || businessInformationView.Text.Equals("")) { MessageBox.Show("Please select a name for the Business Information View.", "Error"); return; } //No errors - Last Check var rsltMessageBox = MessageBox.Show("This will DELETE ALL CONTENTS from current selected model.\n" + "Are you sure?", "UMMAddIn Question", MessageBoxButton.YesNo, MessageBoxImage.Warning); // Process message box results switch (rsltMessageBox) { case MessageBoxResult.Yes: // User pressed Yes button try { var msc = new ModelStructureCreator(repository); msc.create(modelName.Text, businessRequirementsView.Text, businessChoreographyView.Text, businessInformationView.Text, (bool)BusinessRequirementsViewCheckbox.IsChecked); Close(); return; } catch (Exception ex) { Close(); MessageBox.Show( "An error occured during creating the UMM model structure: " + ex.Message + "\n" + ex.InnerException.StackTrace, "UMMAddIn Error", MessageBoxButton.OK, MessageBoxImage.Error); } break; case MessageBoxResult.No: // User pressed No button Close(); break; } }
//Create the inital package structure private void createButton_Click(object sender, EventArgs e) { //BRV checked? if (checkBRV.Checked) { //Name for BRV set if (nameBRV.Text == null || nameBRV.Text.Equals("")) { MessageBox.Show("Please select a name for the Business Requirements View.", "Error"); return; } } //Name for BCV set? if (nameBCV.Text == null || nameBCV.Text.Equals("")) { MessageBox.Show("Please select a name for the Business Choreography View.", "Error"); return; } //Name for BIV set? if (nameBIV.Text == null || nameBIV.Text.Equals("")) { MessageBox.Show("Please select a name for the Business Information View.", "Error"); return; } //No errors - Last Check DialogResult dr = MessageBox.Show("This will DELETE ALL CONTENTS from current selected model.\n" + "Are you sure?", "UMMAddIn Question", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning); // if yes proceed if (dr.Equals(DialogResult.Yes)) { try { var msc = new ModelStructureCreator(repository); msc.create(modelName.Text, nameBRV.Text, nameBCV.Text, nameBIV.Text, checkBRV.Checked); Close(); return; } catch (Exception ex) { Close(); MessageBox.Show( "An error occured during creating the UMM model structure: " + ex.Message + "\n" + ex.InnerException.StackTrace, "UMMAddIn Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else if (dr.Equals(DialogResult.Cancel)) { Close(); return; } else { return; } }