//private void cboWmts_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) //{ // if (string.IsNullOrEmpty(cboWmts.Text)) // return; // if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Return) // { // e.IsInputKey = true; // } //} private void btnEdit_Click(object sender, EventArgs e) { if (cboWmts.SelectedIndex < 0) { MessageBox.Show("You need to define/select a Wm(t)s connection first", "Can't conntect", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var clickConnect = false; using (var dlg = new WmsConnection()) { dlg.WmsConnectionInfo = (WmsConnectionInfo)cboWmts.SelectedItem; if (dlg.ShowDialog() == DialogResult.OK) { cboWmts.Items[cboWmts.SelectedIndex] = dlg.WmsConnectionInfo; clickConnect = true; } } if (clickConnect) { btnConnect.PerformClick(); } }
private void btnNew_Click(object sender, EventArgs e) { var newWmts = false; using (var dlg = new WmsConnection()) { if (dlg.ShowDialog() == DialogResult.OK) { cboWmts.Items.Add(dlg.WmsConnectionInfo); cboWmts.SelectedIndex = cboWmts.Items.Count - 1; newWmts = true; } } if (newWmts) { btnConnect.PerformClick(); } }
//private void cboWmts_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) //{ // if (string.IsNullOrEmpty(cboWmts.Text)) // return; // if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Return) // { // e.IsInputKey = true; // } //} private void btnEdit_Click(object sender, EventArgs e) { if (cboWmts.SelectedIndex < 0) { MessageBox.Show("You need to define/select a Wm(t)s connection first", "Can't conntect", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var clickConnect = false; using (var dlg = new WmsConnection()) { dlg.WmsConnectionInfo = (WmsConnectionInfo) cboWmts.SelectedItem; if (dlg.ShowDialog() == DialogResult.OK) { cboWmts.Items[cboWmts.SelectedIndex] = dlg.WmsConnectionInfo; clickConnect = true; } } if (clickConnect) btnConnect.PerformClick(); }
private void btnNew_Click(object sender, EventArgs e) { var newWmts = false; using (var dlg = new WmsConnection()) { if (dlg.ShowDialog() == DialogResult.OK) { cboWmts.Items.Add(dlg.WmsConnectionInfo); cboWmts.SelectedIndex = cboWmts.Items.Count - 1; newWmts = true; } } if (newWmts) btnConnect.PerformClick(); }