void cleanUp()
 {
     //m_pWSF = null;
     m_pWS            = null;
     m_pSDT           = null;
     m_pSDS           = null;
     m_pSB            = null;
     m_pB             = null;
     m_SelectedObject = null;
     templateInfo     = null;
     m_pSDI           = null;
     formNames        = null;
     formReduce       = null;
     m_sfn            = "";
     blnCancel        = false;
     strLayers        = "";
     strNodeLayers    = "";
 }
        private Boolean CreateTemplate(NameEvents templateInfo)
        {
            //need to get everything first
            IGxDatabase pDatabase = null;
            ISchematicDiagramClassContainer pDiagramClassContainer = null;

            if (m_SelectedObject.Category == "Schematic Dataset")
            {
                pDatabase = (IGxDatabase)m_SelectedObject.Parent;
            }
            else              //on the database already
            {
                pDatabase = (IGxDatabase)m_SelectedObject;
            }
            m_pWS = pDatabase.Workspace;

            ESRI.ArcGIS.Schematic.ISchematicWorkspaceFactory pSWF = new SchematicWorkspaceFactory();
            ESRI.ArcGIS.Schematic.ISchematicWorkspace        pSW  = pSWF.Open(m_pWS);

            m_pSDS = pSW.get_SchematicDatasetByName(templateInfo.DatasetName);

            //check to see if the template name already exists
            pDiagramClassContainer = (ISchematicDiagramClassContainer)m_pSDS;
            m_pSDT = pDiagramClassContainer.GetSchematicDiagramClass(templateInfo.TemplateName.ToString());
            if (m_pSDT != null)
            {
                return(false);
            }

            //create the schematic template
            m_pSDT = m_pSDS.CreateSchematicDiagramClass(templateInfo.TemplateName);

            if ((templateInfo.AutoCreate == true) || (templateInfo.UseVertices == true))
            {
                m_pB  = (ESRI.ArcGIS.Schematic.ISchematicBuilder)m_pSDT;
                m_pSB = (ESRI.ArcGIS.Schematic.ISchematicStandardBuilder)m_pSDT.SchematicBuilder;
                m_pSB.InitializeLinksVertices  = templateInfo.UseVertices;
                m_pSB.AutoCreateElementClasses = templateInfo.AutoCreate;
            }
            m_pSDS.Save(ESRI.ArcGIS.esriSystem.esriArcGISVersion.esriArcGISVersion10, false);
            return(true);
        }
		void cleanUp()
		{
			//m_pWSF = null;
			m_pWS = null;
			m_pSDT = null;
			m_pSDS = null;
			m_pSB = null;
			m_pB = null;
			m_SelectedObject = null;
			templateInfo = null;
			m_pSDI = null;
			formNames = null;
			formReduce = null;
			m_sfn = "";
			blnCancel = false;
			strLayers = "";
			strNodeLayers = "";
		}
		private Boolean CreateTemplate(NameEvents templateInfo)
		{
			//need to get everything first
			IGxDatabase pDatabase = null;
			ISchematicDiagramClassContainer pDiagramClassContainer = null;

			if (m_SelectedObject.Category == "Schematic Dataset")
			{
				pDatabase = (IGxDatabase)m_SelectedObject.Parent;
			}
			else  //on the database already
			{
				pDatabase = (IGxDatabase)m_SelectedObject;
			}
			m_pWS = pDatabase.Workspace;

			ESRI.ArcGIS.Schematic.ISchematicWorkspaceFactory pSWF = new SchematicWorkspaceFactory();
			ESRI.ArcGIS.Schematic.ISchematicWorkspace pSW = pSWF.Open(m_pWS);

			m_pSDS = pSW.get_SchematicDatasetByName(templateInfo.DatasetName);

			//check to see if the template name already exists
			pDiagramClassContainer = (ISchematicDiagramClassContainer)m_pSDS;
			m_pSDT = pDiagramClassContainer.GetSchematicDiagramClass(templateInfo.TemplateName.ToString());
			if (m_pSDT != null) return false;

			//create the schematic template
			m_pSDT = m_pSDS.CreateSchematicDiagramClass(templateInfo.TemplateName);

			if ((templateInfo.AutoCreate == true) || (templateInfo.UseVertices == true))
			{
				m_pB = (ESRI.ArcGIS.Schematic.ISchematicBuilder)m_pSDT;
				m_pSB = (ESRI.ArcGIS.Schematic.ISchematicStandardBuilder)m_pSDT.SchematicBuilder;
				m_pSB.InitializeLinksVertices = templateInfo.UseVertices;
				m_pSB.AutoCreateElementClasses = templateInfo.AutoCreate;
			}
			m_pSDS.Save(ESRI.ArcGIS.esriSystem.esriArcGISVersion.esriArcGISVersion10, false);
			return true;
		}