private void addToMapButton_Click(object sender, EventArgs e) { // Return if there is nothing to add. ControlPoint[] cps = GetSavePoints(); if (cps.Length == 0) { MessageBox.Show("There is nothing to add."); return; } try { // Hide this dialog. If you don't, the entity type dialog that's about to get // displayed may be obscured, and there's no way to close it. this.Hide(); // Do we have an entity type for control points? // This was formerly obtained via the environment variable called CED$ControlEntity int entId = GlobalUserSetting.ReadInt("ControlEntityTypeId", 0); // Get the desired entity type. GetEntityForm dial = new GetEntityForm(m_Cmd.ActiveLayer, SpatialType.Point, entId); dial.ShowDialog(); IEntity ent = dial.SelectedEntity; if (ent == null) { throw new Exception("An entity type must be specified"); } // Remember the ID of the selected entity type GlobalUserSetting.WriteInt("ControlEntityTypeId", ent.Id); // Save the control. Save(cps, ent); // Issue a warning message if points are not currently displayed if (!m_Cmd.ArePointsDrawn()) { MessageBox.Show("Points will not be drawn at the current scale."); } m_Cmd.DialFinish(this); } catch (Exception ex) { MessageBox.Show(ex.Message); this.Show(); } }
bool SaveSymbologyPage(CadastralMapModel cmm) { int symScale; if (!Int32.TryParse(symScaleTextBox.Text, out symScale) || symScale < 0) { tabControl.SelectedTab = SymbologyTabPage; symScaleTextBox.Focus(); MessageBox.Show("Threshold scale for symbology is not valid"); return(false); } GlobalUserSetting.WriteInt("SymbologyScale", symScale); return(true); }
private void okButton_Click(object sender, EventArgs e) { // Get the selected point type. m_PointType = entityTypeComboBox.SelectedEntityType; // Ensure the currently selected repeat option is saved in the registry if (defaultCheckBox.Checked) { WriteDefaultPointEntityTypeId(m_PointType); } // Ensure the auto-repeat option is saved too m_Repeat = repeatCheckBox.Checked; GlobalUserSetting.WriteInt(REPEAT_KEY, (m_Repeat ? 1 : 0)); this.DialogResult = DialogResult.OK; Close(); }
void WriteDefaultPointEntityTypeId(IEntity e) { string key = GetDefaultPointEntityTypeIdKey(); GlobalUserSetting.WriteInt(key, e.Id); }