Inheritance: System.EventArgs
コード例 #1
0
        private void btnDone_Click(object sender, EventArgs e)
        {
            //raise event back to controller
            Dictionary <string, string> dicAlgoParams = new Dictionary <string, string>();
            string strAlgo = "";
            string strRoot = "";

            if (chkApplyAlgo.Checked == true)
            {
                dicAlgoParams.Add("Direction", cboDirection.Text);
                strAlgo = "SmartTree";
                strRoot = cboRoot.Text;
            }
            AdvancedEvents evts = new AdvancedEvents(strAlgo, dicAlgoParams, strRoot, m_colFieldsToCreate);

            this.doneFormEvent(sender, evts);
            m_myCol.Clear();
            m_colFieldsToCreate.Clear();
        }
コード例 #2
0
		private void btnDone_Click(object sender, EventArgs e)
		{
			//raise event back to controller
			Dictionary<string, string> dicAlgoParams = new Dictionary<string, string>();
			string strAlgo = "";
			string strRoot = "";

			if (chkApplyAlgo.Checked == true)
			{
				dicAlgoParams.Add("Direction", cboDirection.Text);
				strAlgo = "SmartTree";
				strRoot = cboRoot.Text;
			}
			AdvancedEvents evts = new AdvancedEvents(strAlgo, dicAlgoParams, strRoot, m_colFieldsToCreate);
			this.doneFormEvent(sender, evts);
			m_myCol.Clear();
			m_colFieldsToCreate.Clear();
		}
		void formAdvanced_doneFormEvent(object sender, AdvancedEvents e)
		{
			m_pSDS.DesignMode = true;
			formAdvanced.Cursor = System.Windows.Forms.Cursors.WaitCursor;
			//process the algorithm if there is one
			if (e.AlgorithmName != "")
			{
				ISchematicAlgoSmartTree a = new SchematicAlgoSmartTreeClass();
				if (e.AlgorithmParams.Count > 0)
				{
					Dictionary<string, string>.KeyCollection keys = e.AlgorithmParams.Keys;
					string strValue = "";
					foreach (string s in keys)
					{
						if (s == "Direction")
						{
							e.AlgorithmParams.TryGetValue(s, out strValue);

							if (strValue == "Top to Bottom")
							{
								a.Direction = esriSchematicAlgoDirection.esriSchematicAlgoTopDown;
							}
							else if (strValue == "Bottom to Top")
							{
								a.Direction = esriSchematicAlgoDirection.esriSchematicAlgoBottomUp;
							}
							else if (strValue == "Left to Right")
							{
								a.Direction = esriSchematicAlgoDirection.esriSchematicAlgoLeftRight;
							}
							else
							{
								a.Direction = esriSchematicAlgoDirection.esriSchematicAlgoRightLeft;
							}
						}
					}
					if (e.RootClass != "")
					{
						ISchematicElementClassContainer pECC = (ISchematicElementClassContainer)m_pSDS;
						ISchematicElementClass pEC = pECC.GetSchematicElementClass(e.RootClass);
						ESRI.ArcGIS.esriSystem.UID u = new ESRI.ArcGIS.esriSystem.UID();
						u.Value = "{3AD9D8B8-0A1D-4F32-ABB5-54B848A46F85}";

						ISchematicAttributeConstant pAttrConst = (ISchematicAttributeConstant)pEC.CreateSchematicAttribute("RootFlag", u);
						ISchematicAttributeManagement pAttrMgmt = (ISchematicAttributeManagement)pAttrConst;
						pAttrMgmt.StorageMode = esriSchematicAttributeStorageMode.esriSchematicAttributeFieldStorage;
						pAttrConst.ConstantValue = "-1";
					}
				}

				m_pSDT.SchematicAlgorithm = (ISchematicAlgorithm)a;

			}

			//check to see if we need to add associated fields
			if (e.FieldsToCreate != null)
			{
				if (e.FieldsToCreate.Count > 0)
				{
					ISchematicElementClassContainer pECC = (ISchematicElementClassContainer)m_pSDS;

					//create the associated field attributes
					string[] keys = e.FieldsToCreate.AllKeys;
					foreach (string s in keys)
					{
						//get the feature class
						ISchematicElementClass pEC = pECC.GetSchematicElementClass(s);
						if (pEC != null)
						{
							string strName = "";
							string[] values = e.FieldsToCreate.GetValues(s);
							foreach (string v in values)
							{
								//create the field
								ESRI.ArcGIS.esriSystem.UID u = new ESRI.ArcGIS.esriSystem.UID();
								u.Value = "{7DE3A19D-32D0-41CD-B896-37CA3AFBD88A}";

								IClass pClass = (IClass)pEC;
								//only handle names that don't already exist in the schematic tables
								if (pClass.FindField(v) == -1)
								{
									strName = v.ToString();

									ISchematicAttributeAssociatedField pFieldAttr = (ISchematicAttributeAssociatedField)pEC.CreateSchematicAttribute(strName, u);
									pFieldAttr.AssociatedFieldName = v;
									ISchematicAttributeManagement pAttrMgmt = (ISchematicAttributeManagement)pFieldAttr;
									pAttrMgmt.StorageMode = esriSchematicAttributeStorageMode.esriSchematicAttributeFieldStorage;
								}
							}
						}
					}
				}
			}

			m_pSDS.Save(ESRI.ArcGIS.esriSystem.esriArcGISVersion.esriArcGISVersionCurrent, true);
			m_pSDS.DesignMode = false;
			formAdvanced.Cursor = System.Windows.Forms.Cursors.Default;
			formAdvanced.Close();
		}
        void formAdvanced_doneFormEvent(object sender, AdvancedEvents e)
        {
            m_pSDS.DesignMode   = true;
            formAdvanced.Cursor = System.Windows.Forms.Cursors.WaitCursor;
            //process the algorithm if there is one
            if (e.AlgorithmName != "")
            {
                ISchematicAlgoSmartTree a = new SchematicAlgoSmartTreeClass();
                if (e.AlgorithmParams.Count > 0)
                {
                    Dictionary <string, string> .KeyCollection keys = e.AlgorithmParams.Keys;
                    string strValue = "";
                    foreach (string s in keys)
                    {
                        if (s == "Direction")
                        {
                            e.AlgorithmParams.TryGetValue(s, out strValue);

                            if (strValue == "Top to Bottom")
                            {
                                a.Direction = esriSchematicAlgoDirection.esriSchematicAlgoTopDown;
                            }
                            else if (strValue == "Bottom to Top")
                            {
                                a.Direction = esriSchematicAlgoDirection.esriSchematicAlgoBottomUp;
                            }
                            else if (strValue == "Left to Right")
                            {
                                a.Direction = esriSchematicAlgoDirection.esriSchematicAlgoLeftRight;
                            }
                            else
                            {
                                a.Direction = esriSchematicAlgoDirection.esriSchematicAlgoRightLeft;
                            }
                        }
                    }
                    if (e.RootClass != "")
                    {
                        ISchematicElementClassContainer pECC = (ISchematicElementClassContainer)m_pSDS;
                        ISchematicElementClass          pEC  = pECC.GetSchematicElementClass(e.RootClass);
                        ESRI.ArcGIS.esriSystem.UID      u    = new ESRI.ArcGIS.esriSystem.UID();
                        u.Value = "{3AD9D8B8-0A1D-4F32-ABB5-54B848A46F85}";

                        ISchematicAttributeConstant   pAttrConst = (ISchematicAttributeConstant)pEC.CreateSchematicAttribute("RootFlag", u);
                        ISchematicAttributeManagement pAttrMgmt  = (ISchematicAttributeManagement)pAttrConst;
                        pAttrMgmt.StorageMode    = esriSchematicAttributeStorageMode.esriSchematicAttributeFieldStorage;
                        pAttrConst.ConstantValue = "-1";
                    }
                }

                m_pSDT.SchematicAlgorithm = (ISchematicAlgorithm)a;
            }

            //check to see if we need to add associated fields
            if (e.FieldsToCreate != null)
            {
                if (e.FieldsToCreate.Count > 0)
                {
                    ISchematicElementClassContainer pECC = (ISchematicElementClassContainer)m_pSDS;

                    //create the associated field attributes
                    string[] keys = e.FieldsToCreate.AllKeys;
                    foreach (string s in keys)
                    {
                        //get the feature class
                        ISchematicElementClass pEC = pECC.GetSchematicElementClass(s);
                        if (pEC != null)
                        {
                            string   strName = "";
                            string[] values  = e.FieldsToCreate.GetValues(s);
                            foreach (string v in values)
                            {
                                //create the field
                                ESRI.ArcGIS.esriSystem.UID u = new ESRI.ArcGIS.esriSystem.UID();
                                u.Value = "{7DE3A19D-32D0-41CD-B896-37CA3AFBD88A}";

                                IClass pClass = (IClass)pEC;
                                //only handle names that don't already exist in the schematic tables
                                if (pClass.FindField(v) == -1)
                                {
                                    strName = v.ToString();

                                    ISchematicAttributeAssociatedField pFieldAttr = (ISchematicAttributeAssociatedField)pEC.CreateSchematicAttribute(strName, u);
                                    pFieldAttr.AssociatedFieldName = v;
                                    ISchematicAttributeManagement pAttrMgmt = (ISchematicAttributeManagement)pFieldAttr;
                                    pAttrMgmt.StorageMode = esriSchematicAttributeStorageMode.esriSchematicAttributeFieldStorage;
                                }
                            }
                        }
                    }
                }
            }

            m_pSDS.Save(ESRI.ArcGIS.esriSystem.esriArcGISVersion.esriArcGISVersionCurrent, true);
            m_pSDS.DesignMode   = false;
            formAdvanced.Cursor = System.Windows.Forms.Cursors.Default;
            formAdvanced.Close();
        }