protected override void OnClick() { blnCancel = false; formNames = new frmDatasetTemplateName(); formNames.cancelFormEvent += new EventHandler(formNames_cancelFormEvent); formNames.nextFormEvent += new EventHandler<NameEvents>(formNames_nextFormEvent); m_SelectedObject = ArcCatalog.ThisApplication.SelectedObject; if ((m_SelectedObject.Category == "Schematic Dataset") || (m_SelectedObject.Category.ToLower().Contains("database"))) { if (m_SelectedObject.Category.ToLower().Contains("database")) { //get dataset and template names, then create the objects formNames.blnNewDataset = true; } else { //dataset, just get template names, then create objects formNames.blnNewDataset = false; } //show the first form of the wizard if (formNames.ShowDialog() == DialogResult.Cancel) { formNames = null; return; } } else { //we are not on a database or a schematic dataset blnCancel = true; } if (blnCancel == true) { System.Windows.Forms.MessageBox.Show("The name of the dataset or template already exists. Please try again with valid names."); } if (blnCancel != true) //only true if the user cancels the first form formNames_cancelFormEvent { System.Windows.Forms.Cursor.Current = Cursors.WaitCursor; IEnumLayer pEnumLayer = GetLayers(); if (pEnumLayer == null) { //should only happen if the user clicks cancel on the gxdialog blnCancel = true; } else { strLayers = CreateSchLayers(pEnumLayer); if (strLayers.Length > 0) //make sure we get something back { //find out if we need to create node reduction rules formReduce = new frmSelectItemsToReduce(); formReduce.doneFormEvent += new EventHandler<ReduceEvents>(formReduce_doneFormEvent); formReduce.cancelFormEvent += new EventHandler(formReduce_cancelFormEvent); formReduce.itemList = strNodeLayers; System.Windows.Forms.Cursor.Current = Cursors.Default; formReduce.ShowDialog(); } else { //this can happen if the map document didn't have any //layers corresponding to a geometric network blnCancel = true; } } System.Windows.Forms.Cursor.Current = Cursors.Default; } if (blnCancel != true) //could have cancelled on either frmDatasetTemplateName or frmSelectItemsToReduce { //Advanced Form formAdvanced = new frmAdvanced(); formAdvanced.doneFormEvent += new EventHandler<AdvancedEvents>(formAdvanced_doneFormEvent); formAdvanced.strLayers = this.strLayers; formAdvanced.strNodeLayers = this.strNodeLayers; formAdvanced.m_myCol = this.m_myCol; formAdvanced.ShowDialog(); } ArcCatalog.ThisApplication.Refresh(m_sfn); try { ArcCatalog.ThisApplication.Location = m_SelectedObject.FullName.ToString(); } catch { } cleanUp(); }
protected override void OnClick() { blnCancel = false; formNames = new frmDatasetTemplateName(); formNames.cancelFormEvent += new EventHandler(formNames_cancelFormEvent); formNames.nextFormEvent += new EventHandler <NameEvents>(formNames_nextFormEvent); m_SelectedObject = ArcCatalog.ThisApplication.SelectedObject; if ((m_SelectedObject.Category == "Schematic Dataset") || (m_SelectedObject.Category.ToLower().Contains("database"))) { if (m_SelectedObject.Category.ToLower().Contains("database")) { //get dataset and template names, then create the objects formNames.blnNewDataset = true; } else { //dataset, just get template names, then create objects formNames.blnNewDataset = false; } //show the first form of the wizard if (formNames.ShowDialog() == DialogResult.Cancel) { formNames = null; return; } } else { //we are not on a database or a schematic dataset blnCancel = true; } if (blnCancel == true) { System.Windows.Forms.MessageBox.Show("The name of the dataset or template already exists. Please try again with valid names."); } if (blnCancel != true) //only true if the user cancels the first form formNames_cancelFormEvent { System.Windows.Forms.Cursor.Current = Cursors.WaitCursor; IEnumLayer pEnumLayer = GetLayers(); if (pEnumLayer == null) { //should only happen if the user clicks cancel on the gxdialog blnCancel = true; } else { strLayers = CreateSchLayers(pEnumLayer); if (strLayers.Length > 0) //make sure we get something back { //find out if we need to create node reduction rules formReduce = new frmSelectItemsToReduce(); formReduce.doneFormEvent += new EventHandler <ReduceEvents>(formReduce_doneFormEvent); formReduce.cancelFormEvent += new EventHandler(formReduce_cancelFormEvent); formReduce.itemList = strNodeLayers; System.Windows.Forms.Cursor.Current = Cursors.Default; formReduce.ShowDialog(); } else { //this can happen if the map document didn't have any //layers corresponding to a geometric network blnCancel = true; } } System.Windows.Forms.Cursor.Current = Cursors.Default; } if (blnCancel != true) //could have cancelled on either frmDatasetTemplateName or frmSelectItemsToReduce { //Advanced Form formAdvanced = new frmAdvanced(); formAdvanced.doneFormEvent += new EventHandler <AdvancedEvents>(formAdvanced_doneFormEvent); formAdvanced.strLayers = this.strLayers; formAdvanced.strNodeLayers = this.strNodeLayers; formAdvanced.m_myCol = this.m_myCol; formAdvanced.ShowDialog(); } ArcCatalog.ThisApplication.Refresh(m_sfn); try { ArcCatalog.ThisApplication.Location = m_SelectedObject.FullName.ToString(); } catch { } cleanUp(); }