private void btnChange_Click(object sender, EventArgs e) { if (CanChange) { NamedColor origColor = SelectedNamedColor; string name = tbColorName.Text.Trim(); Color color = ucColor.BackColor; origColor.Name = name; origColor.Color = color; foreach (ListViewItem lvi in listView.Items) { if (lvi.Tag == origColor) { lvi.Text = origColor.Name; lvi.SubItems[1].BackColor = origColor.Color; break; } } listView.Sort(); UpdateControls(); if (app.GetControlsAttr(ControlsAttr.AutoSave)) { using (Context context = lib.GetContext()) origColor.Save(context); } if (OnNamedColorChanged != null) { OnNamedColorChanged(this, new NamedColorEventArgs(origColor)); } } }
private void tvTypes_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e) { if (!updating) { if (OnCompositeSelected != null) { OnCompositeSelected(this, null); } if (app.GetControlsAttr(ControlsAttr.ShowPropertiesOnSelect)) { app.ShowProperties(SelectedComposite); } } }
private void lbLayers_SelectedValueChanged(object sender, System.EventArgs e) { OnLayerSelected(this, null); if (app.GetControlsAttr(ControlsAttr.ShowPropertiesOnSelect)) { app.ShowProperties(SelectedLayer); } }
void AddView() { try { Map map = app.CurrentMap; if (map != null) { NameForm form = new NameForm(Views); if (form.ShowDialog(this) == DialogResult.OK) { GeoLib.View view = new GeoLib.View(form.InputText, map); if (Views.Add(view)) { this.UpdateList(view); if (app.GetControlsAttr(ControlsAttr.AutoSave)) { using (Context context = Lib.GetContext()) view.Save(context); } if (OnViewAdded != null) { OnViewAdded(this, new ViewEventArgs(view)); } } else { string s = Locale.Get("_notuniquename") + ": " + view.Name; MessageBox.Show(s); } } } } catch (Exception ex) { Log.Exception(ex); } }