Example #1
0
 private void tbxPaperSize_TextChanged(object sender, EventArgs e)
 {
     _paperSizeValidationResult = FormValidation.validatePaperSize(tbxPaperSize, eprPaperWarning, eprPaperError);
 }
Example #2
0
        private void frmMain_Load(object sender, EventArgs e)
        {
            //Form validation methods
            _titleValidationResult          = FormValidation.validateMapTitle(tbxMapTitle, eprMaptitleWarning, eprMapTitleError);
            _summaryValidationResult        = FormValidation.validateMapSummary(tbxMapSummary, eprMapSummaryWarning, eprMapSummaryError);
            _mapDocumentValidationResult    = FormValidation.validateMapDocument(tbxMapDocument, eprMapDocumentWarning, eprMapDocumentError);
            _datumValidationResult          = FormValidation.validateDatum(tbxDatum, eprDatumWarning, eprDatumError);
            _projectionValidationResult     = FormValidation.validateProjection(tbxProjection, eprProjectionWarning, eprProjectionError);
            _scaleValidationResult          = FormValidation.validateScale(tbxScale, eprScaleWarning, eprScaleError);
            _dateValidationResult           = FormValidation.validateDate(tbxDate, eprDateWarning, eprDateError);
            _timeValidationResult           = FormValidation.validateTime(tbxTime, eprTimeWarning, eprTimeError);
            _paperSizeValidationResult      = FormValidation.validatePaperSize(tbxPaperSize, eprPaperWarning, eprPaperError);
            _imageryDateValidationResult    = FormValidation.validateImageryDate(tbxImageDate, eprImageryDate);
            _dataSourcesValidationResult    = FormValidation.validateDataSources(tbxDataSources, eprDataSourcesWarning, eprDataSourcesError);
            _operationIdValidationResult    = FormValidation.validateOperationId(tbxOperationId, eprOperationIdWarning, eprOperationIdError);
            _glideNumberValidationResult    = FormValidation.validateGlideNumber(tbxGlideNo, eprGlideNumberWarning, eprGlideNumberError);
            _locationValidationResult       = FormValidation.validateLocation(tbxImageLocation, eprLocationWarning);
            _themeValidationResult          = FormValidation.validateTheme(cboTheme, eprThemeWarning);
            _countriesValidationResult      = FormValidation.validateCountries(tbxCountries, eprCountriesWarning);
            _statusValidationResult         = FormValidation.validateStatus(cboStatus, eprStatusWarning);
            _accessValidationResult         = FormValidation.validateAccess(cboAccess, eprAccessWarning);
            _accessNoteValidationResult     = FormValidation.validateAccessNote(tbxImageAccessNotes, eprAccessNoteWarning);
            _qualityControlValidationResult = FormValidation.validateQualityControl(cboQualityControl, eprQualityControlWarning);
            _languageValidationResult       = FormValidation.validateLanguage(tbxLanguage, eprLanguageWarning, eprLanguageError);

            var dict = new Dictionary <string, string>();

            dict = MapAction.PageLayoutProperties.getLayoutTextElements(_pMxDoc, _targetMapFrame);

            //Update form text boxes with values from the map
            if (dict.ContainsKey("title"))
            {
                tbxMapTitle.Text = dict["title"];
            }
            if (dict.ContainsKey("summary"))
            {
                tbxMapSummary.Text = dict["summary"];
            }
            if (dict.ContainsKey("mxd_name"))
            {
                tbxMapDocument.Text = dict["mxd_name"];
            }
            if (dict.ContainsKey("data_sources"))
            {
                tbxDataSources.Text = dict["data_sources"];
            }

            // Update form values from the config xml
            var    dictXML  = new Dictionary <string, string>();
            string path     = MapAction.Utilities.getCrashMoveFolderPath();
            string filePath = path + @"\operation_config.xml";

            dictXML = MapAction.Utilities.getOperationConfigValues(filePath);
            if (dictXML.ContainsKey("GlideNo"))
            {
                tbxGlideNo.Text = dictXML["GlideNo"];
            }
            if (dictXML.ContainsKey("Language"))
            {
                tbxLanguage.Text = dictXML["Language"];
            }
            if (dictXML.ContainsKey("Country"))
            {
                tbxCountries.Text = dictXML["Country"];
            }
            string operational_id = dictXML["OperationId"];

            Debug.WriteLine("Op ID: " + operational_id);
            if (dictXML.ContainsKey("OperationId"))
            {
                tbxOperationId.Text = dictXML["OperationId"];
            }
            if (dictXML.ContainsKey("DefaultPathToExportDir"))
            {
                tbxExportZipPath.Text = dictXML["DefaultPathToExportDir"];
            }
            if (dictXML.ContainsKey("DefaultJpegResDPI"))
            {
                nudJpegResolution.Value = Convert.ToDecimal(dictXML["DefaultJpegResDPI"]);
            }
            if (dictXML.ContainsKey("DefaultPdfResDPI"))
            {
                nudPdfResolution.Value = Convert.ToDecimal(dictXML["DefaultPdfResDPI"]);
            }
            if (dictXML.ContainsKey("DefaultEmfResDPI"))
            {
                nudEmfResolution.Value = Convert.ToDecimal(dictXML["DefaultPdfResDPI"]);
            }

            // Set the spatial reference information on load
            var dictSpatialRef = new Dictionary <string, string>();

            dictSpatialRef     = MapAction.Utilities.getDataFrameSpatialReference(_pMxDoc, _targetMapFrame);
            tbxDatum.Text      = dictSpatialRef["datum"];
            tbxProjection.Text = dictSpatialRef["projection"];

            // Set the 'metadata' tab elements
            var date = System.DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss");
            var time = System.DateTime.Now.ToString("HH:mm");

            tbxDate.Text      = date;
            tbxTime.Text      = time;
            tbxPaperSize.Text = MapAction.PageLayoutProperties.getPageSize(_pMxDoc, _targetMapFrame);
            tbxScale.Text     = MapAction.PageLayoutProperties.getScale(_pMxDoc, _targetMapFrame);
        }