Пример #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 = MapAction.Properties.Settings.Default.crash_move_folder_path;
            //string filePath = path + @"\operation_config.xml";

            //Perform validation checks tab 1
            FormValidation.validateMapTitle(tbxTitle, eprMapTitle);
            FormValidation.validateMapSummary(tbxSummary, eprMapSummary);
            FormValidation.validateDataSources(tbxDataSources, eprDataSources);
            FormValidation.validateMapNumber(tbxMapNumber, eprMapNumberWarning, eprMapNumberError);
            FormValidation.validateMapDocument(tbxMapDocument, eprMapDocumentWarning, eprMapDocumentError);
            FormValidation.validateSpatialReference(tbxSpatialReference, eprSpatialReferenceWarning, eprSpatialReferenceError);
            FormValidation.validateScaleText(tbxScale, eprScaleTextWarning, eprScaleTextError);
            FormValidation.validateGlideNumber(tbxGlideNumber, eprGlideNumberWarning, eprSpatialReferenceError);
            //Perform validation checks tab 2
            FormValidation.validateDisclaimer(tbxDisclaimer, eprDisclaimerWarning, eprDisclaimerError);
            FormValidation.validateDonorCredit(tbxDonorCredit, eprDonorWarning, eprDonorError);
            FormValidation.validateMapProducer(tbxMapProducer, eprProducedByWarning, eprProducedByError);
            FormValidation.validateTimezone(tbxTimezone, eprTimezoneWarning, eprTimezoneError);

            //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)
            {
                tbxTitle.Text = dict["title"];
            }
            else
            {
                tbxTitle.Text = "Element not present"; tbxTitle.ReadOnly = true;
            };
            if (dict.ContainsKey("summary") == true)
            {
                tbxSummary.Text = dict["summary"];
            }
            else
            {
                tbxSummary.Text = "Element not present"; tbxSummary.ReadOnly = true;
            };
            if (dict.ContainsKey("data_sources") == true)
            {
                tbxDataSources.Text = dict["data_sources"];
            }
            else
            {
                tbxDataSources.Text = "Element not present"; tbxDataSources.ReadOnly = true;
            };
            if (dict.ContainsKey("map_no") == true)
            {
                tbxMapNumber.Text = dict["map_no"];
            }
            else
            {
                tbxMapNumber.Text = "Element not present"; tbxMapNumber.ReadOnly = true;
            };
            if (dict.ContainsKey("mxd_name") == true)
            {
                tbxMapDocument.Text = dict["mxd_name"];
            }
            else
            {
                tbxMapDocument.Text = "Element not present"; tbxMapDocument.ReadOnly = true; btnMapDocument.Enabled = false;
            };
            if (dict.ContainsKey("scale") == true)
            {
                tbxScale.Text = dict["scale"];
            }
            else
            {
                tbxScale.Text = "Element not present"; tbxScale.ReadOnly = true; btnUpdateScale.Enabled = false;
            };
            if (dict.ContainsKey("spatial_reference") == true)
            {
                tbxSpatialReference.Text = dict["spatial_reference"];
            }
            else
            {
                tbxSpatialReference.Text = "Element not present"; tbxSpatialReference.ReadOnly = true; btnSpatialReference.Enabled = false;
            };
            if (dict.ContainsKey("glide_no") == true)
            {
                tbxGlideNumber.Text = dict["glide_no"];
            }
            else
            {
                tbxGlideNumber.Text = "Element not present"; tbxGlideNumber.ReadOnly = true; btnGlideNo.Enabled = false;
            };
            //Tab 2 - Standard elements
            if (dict.ContainsKey("map_producer") == true)
            {
                tbxMapProducer.Text = dict["map_producer"];
            }
            else
            {
                tbxMapProducer.Text = "Element not present"; tbxMapProducer.ReadOnly = true; btnUpdateProducedBy.Enabled = false;
            };
            if (dict.ContainsKey("donor_credit") == true)
            {
                tbxDonorCredit.Text = dict["donor_credit"];
            }
            else
            {
                tbxDonorCredit.Text = "Element not present"; tbxDonorCredit.ReadOnly = true; btnUpdateDonorCredits.Enabled = false;
            };
            if (dict.ContainsKey("timezone") == true)
            {
                tbxTimezone.Text = dict["timezone"];
            }
            else
            {
                tbxTimezone.Text = "Element not present"; tbxTimezone.ReadOnly = true; btnUpdateTimezone.Enabled = false;
            };
            if (dict.ContainsKey("disclaimer") == true)
            {
                tbxDisclaimer.Text = dict["disclaimer"];
            }
            else
            {
                tbxDisclaimer.Text = "Element not present"; tbxDisclaimer.ReadOnly = true; btnUpdateDisclaimer.Enabled = false;
            };
        }
Пример #2
0
 private void tbxScale_TextChanged(object sender, EventArgs e)
 {
     FormValidation.validateScaleText(tbxScale, eprScaleTextWarning, eprScaleTextError);
 }