private void cboTileLayoutLayer_SelectedIndexChanged(object sender, EventArgs e) { if (this.cboTileNameField.Items.Count > 0) { this.cboTileNameField.Items.Clear(); } this.cboTileNameField.Items.AddRange(_utilities.TextFields(this.cboTileLayoutLayer.Text).ToArray()); if (this.cboTileNameField.Items.Count > 0) { this.cboTileNameField.SelectedIndex = 0; } if (this.cboTileNameField.Items.IndexOf("Tilename") > -1) { this.cboTileNameField.SelectedIndex = this.cboTileNameField.Items.IndexOf("Tilename"); } ILayer tilelayoutlayer = _utilities.Layer(this.cboTileLayoutLayer.Text); IFeatureLayer tilelayoutfeaturelayer = tilelayoutlayer as IFeatureLayer; IFeatureSelection tilelayoutfeatureselection = tilelayoutfeaturelayer as IFeatureSelection; if (tilelayoutfeatureselection.SelectionSet.Count > 0) { this.chkUseSelected.Text = "Use selection (" + tilelayoutfeatureselection.SelectionSet.Count.ToString() + ")"; this.chkUseSelected.Checked = true; this.chkUseSelected.Enabled = true; } else { this.chkUseSelected.Text = "Use selection"; this.chkUseSelected.Checked = false; this.chkUseSelected.Enabled = false; } }
private void btnOKStay_Click(object sender, EventArgs e) { if (!CheckRequirements()) { return; } ILayer buildingslayer = _utilitiesArcMap.Layer(this.cboBuildingLayer.Text); try { if (buildingslayer != null) { int inspectionfieldindex = _utilitiesArcMap.FindField(buildingslayer, "rsi"); IFeatureLayer buildingsfeaturelayer = buildingslayer as IFeatureLayer; IFeatureClass buildingsfeatureclass = buildingsfeaturelayer.FeatureClass; IFeatureSelection buildingsfeatureselection = buildingsfeaturelayer as IFeatureSelection; if (buildingsfeatureselection.SelectionSet.Count > 0) { Update(1, buildingsfeaturelayer); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Building Inspector", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } finally { //_restartreport = false; } }
private void AutoSave_Save() { if (!CheckRequirements()) { return; } if (!IsSaveable()) { return; } ITrackCancel trackcancel = new CancelTrackerClass(); IProgressDialogFactory progressdialogfactory = new ProgressDialogFactoryClass(); IStepProgressor stepprogressor = progressdialogfactory.Create(trackcancel, _application.hWnd); stepprogressor.MinRange = 0; stepprogressor.MaxRange = 1; stepprogressor.StepValue = 1; stepprogressor.Message = "Saving..."; IProgressDialog2 progressdialog = (IProgressDialog2)stepprogressor; // Creates and displays progressdialog.CancelEnabled = true; progressdialog.Description = "Saving..."; progressdialog.Title = "Saving..."; progressdialog.Animation = esriProgressAnimationTypes.esriDownloadFile; try { ILayer layer = _utilitiesArcmap.Layer(this.cboTargetLayer.Text); IFeatureLayer featurelayer = layer as IFeatureLayer; if (!(featurelayer == null)) { IFeatureClass featureclass = featurelayer.FeatureClass; IWorkspace2 workspace = ((IDataset)featureclass).Workspace as IWorkspace2; IWorkspaceEdit2 workspaceedit = (IWorkspaceEdit2)workspace; workspaceedit.StopEditing(true); workspaceedit.StartEditing(true); } } catch (Exception ex) { MessageBox.Show(ex.Message, "ABE Calculators", MessageBoxButtons.OK, MessageBoxIcon.Stop); } finally { trackcancel = null; stepprogressor = null; progressdialog.HideDialog(); progressdialog = null; this.btnClose.Enabled = true; } }
private void cbo_TileIndex_SelectedIndexChanged(object sender, EventArgs e) { cbo_FieldName.Items.Clear(); ILayer tileIndex = _utilitiesArcMap.Layer(cbo_TileIndex.Text); cbo_FieldName.Items.AddRange(_utilitiesArcMap.AllFields(tileIndex).ToArray()); }
private void cboFeatureLayer_SelectedIndexChanged(object ssender, EventArgs e) { cboField.Items.Clear(); ILayer featureLayer = _utilities.Layer(cboFeatureLayer.Text); //cboField.Items.AddRange(_utilities.NumberFieldsWithDomain(featureLayer).ToArray()); cboField.Items.AddRange(_utilities.NumberFieldsNotRequired(featureLayer).ToArray()); }
private void cboTileIndex_SelectedIndexChanged(object sender, EventArgs e) { cboNameField.Items.Clear(); ILayer tile_index = _utilitiesArcMap.Layer(cboTileIndex.Text); cboNameField.Items.AddRange(_utilitiesArcMap.AllFields(tile_index).ToArray()); // This will auto select the first field in the tile_index attribute table //if (cboNameField.Items.Count > -1) // cboNameField.SelectedIndex = 0; }
private bool CheckRequirements() { if (!groupCorner.Controls.OfType <RadioButton>().Any(x => x.Checked)) { MessageBox.Show("Select A Corner", MB_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } if (!groupDirection.Controls.OfType <RadioButton>().Any(x => x.Checked)) { MessageBox.Show("Select A Direction", MB_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } try { if (_utilitiesArcMap == null) { _mxdocument = (IMxDocument)_application.Document; _map = _mxdocument.FocusMap; _activeView = _mxdocument.ActiveView; if (_utilitiesArcMap == null) { _utilitiesArcMap = new Utilities_ArcMap(_map); } } if (this.cbo_FeatureLayers.Items.Count == 0) { MessageBox.Show("Add a layer to inspect to the table of contents", MB_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } IFeatureLayer featureLayer = _utilitiesArcMap.FeatureLayer((cbo_FeatureLayers.Text)); if (featureLayer == null) { MessageBox.Show("Feature Layer Failed To Load", MB_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } IFeatureClass featureClass = featureLayer.FeatureClass; if (featureClass == null) { MessageBox.Show("Feature Class Failed To Load", MB_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } ILayer layer = _utilitiesArcMap.Layer(this.cbo_FeatureLayers.Text); int inspectionfieldindex = _utilitiesArcMap.FindField(layer, "rsi_index"); if (inspectionfieldindex < 0) { MessageBox.Show("Add 'rsi_index' field, short integer!", MB_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } _editor = _utilitiesArcMap.GetEditorFromArcMap(_application as IMxApplication); if (_editor == null) { MessageBox.Show("Editor version of ArcMap required.", MB_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } if (_editor.EditState != esriEditState.esriStateEditing) { MessageBox.Show("Start an edit session first.", MB_TITLE, MessageBoxButtons.OK, MessageBoxIcon.Stop); return(false); } } catch (Exception ex) { MessageBox.Show(ex.Message); return(false); } return(true); }