Ejemplo n.º 1
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            //Check to see if the config file exists, if not abort and send the user a message
            string path     = Alpha_ConfigTool.Properties.Settings.Default.crash_move_folder_path;
            string filePath = path + @"\operation_config.xml";

            if (!File.Exists(@filePath))
            {
                MessageBox.Show("The operation configuration file is required for this tool.  It cannot be located.",
                                "Configuration file required", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            //Perform validation checks
            ErrorCheckAndDisplay.checkElement(ttpGlideNumber, txtGlideNumber, "Glide Number");

            //Call the MapAction class library and the getLayoutElements function that returns a dictionare of the key value
            //pairs of each text element in the layout
            //IMxDocument pMxDoc = ArcMap.Application.Document as IMxDocument;
            Dictionary <string, string> dict = MapAction.PageLayoutProperties.getLayoutTextElements(_pMxDoc, "Main map");

            //Check if the various elements existist that automated update, if not disable the automation buttons.
            //If they are present then update the text boxes with the value from the dictionary
            if (!dict.ContainsKey("mxd_name") || !dict.ContainsKey("scale") || !dict.ContainsKey("scale") || !dict.ContainsKey("spatial_reference"))
            {
                btnUpdateAll.Enabled = false;
            }

            if (dict.ContainsKey("title") == true)
            {
                txtTitle.Text = dict["title"];
            }
            else
            {
                txtTitle.Text = "Element not present"; txtTitle.ReadOnly = true;
            };
            if (dict.ContainsKey("summary") == true)
            {
                txtSummary.Text = dict["summary"];
            }
            else
            {
                txtSummary.Text = "Element not present"; txtSummary.ReadOnly = true;
            };
            if (dict.ContainsKey("mxd_name") == true)
            {
                txtMapDocument.Text = dict["mxd_name"];
            }
            else
            {
                txtMapDocument.Text = "Element not present"; txtMapDocument.ReadOnly = true; btnMapDocument.Enabled = false;
            };
            if (dict.ContainsKey("map_no") == true)
            {
                txtMapNumber.Text = dict["map_no"];
            }
            else
            {
                txtMapNumber.Text = "Element not present"; txtMapNumber.ReadOnly = true;
            };
            if (dict.ContainsKey("scale") == true)
            {
                txtScale.Text = dict["scale"];
            }
            else
            {
                txtScale.Text = "Element not present"; txtScale.ReadOnly = true; btnUpdateScale.Enabled = false;
            };
            if (dict.ContainsKey("spatial_reference") == true)
            {
                txtSpatialReference.Text = dict["spatial_reference"];
            }
            else
            {
                txtSpatialReference.Text = "Element not present"; txtSpatialReference.ReadOnly = true; btnSpatialReference.Enabled = false;
            };
            if (dict.ContainsKey("glide_no") == true)
            {
                txtGlideNumber.Text = dict["glide_no"];
            }
            else
            {
                txtGlideNumber.Text = "Element not present"; txtGlideNumber.ReadOnly = true; btnGlideNo.Enabled = false;
            };
        }
Ejemplo n.º 2
0
 private void txtGlideNumber_TextChanged(object sender, EventArgs e)
 {
     //Perform validation checks
     ErrorCheckAndDisplay.checkElement(ttpGlideNumber, txtGlideNumber, "Glide Number");
 }