예제 #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     MapForm form = new MapForm();
     form.ShowDialog();
     var c = form.GetCoords();
     if (!string.IsNullOrEmpty(c))
     {
         txtCoord.Text = c;
     }
 }
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }

            var i = e.ColumnIndex;

            if (i == 5)
            {
                var s = dataGridView1.Rows[e.RowIndex].Cells[i].Value as string;
                if (s != null)
                {
                    System.Diagnostics.Process.Start(s);
                }
            }
            if (i == 0)
            {
                var s   = dataGridView1.Rows[e.RowIndex].Cells[i].Value as string;
                var str = _streets.FirstOrDefault(p => p.BigTitle == s);
                MessageBox.Show(str.Title + Environment.NewLine + Environment.NewLine + string.Join("\n", str.PreviousNames));
            }
            if (i == 1)
            {
                var s = dataGridView1.Rows[e.RowIndex].Cells[i].Value as string;
                if (comboBox1.SelectedItem as string != s)
                {
                    comboBox1.SelectedItem = s;
                }
                else
                {
                    comboBox1.SelectedItem = "Все";
                }
            }
            if (i == 3)
            {
                var s    = dataGridView1.Rows[e.RowIndex].Cells[i].Value as Coordinate;
                var srch = s != null?s.ToString() : "";

                var mf = new MapForm(srch);
                mf.Text = srch;
                mf.ShowDialog();
            }
        }
예제 #3
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }

            var i = e.ColumnIndex;
            if (i == 5)
            {
                var s = dataGridView1.Rows[e.RowIndex].Cells[i].Value as string;
                if (s != null)
                    System.Diagnostics.Process.Start(s);
            }
            if (i == 0)
            {
                var s = dataGridView1.Rows[e.RowIndex].Cells[i].Value as string;
                var str = _streets.FirstOrDefault(p => p.BigTitle == s);
                MessageBox.Show(str.Title + Environment.NewLine + Environment.NewLine + string.Join("\n", str.PreviousNames));
            }
            if (i == 1)
            {
                var s = dataGridView1.Rows[e.RowIndex].Cells[i].Value as string;
                if (comboBox1.SelectedItem as string != s)
                    comboBox1.SelectedItem = s;
                else comboBox1.SelectedItem = "Все";
            }
            if (i == 3)
            {
                var s = dataGridView1.Rows[e.RowIndex].Cells[i].Value as Coordinate;
                var srch = s != null ? s.ToString() : "";
                var mf = new MapForm(srch);
                mf.Text = srch;
                mf.ShowDialog();
            }
        }