private void btnDelete_Click(object sender, EventArgs e) { bool bFound = false; ListViewItem itemFound = null; foreach (ListViewItem item in favmgrlistView1.Items) { TextCoord crd = item.Tag as TextCoord; if (crd != null) { if (crd._Uid == _coord._Uid) { itemFound = item; bFound = true; break; } } } if (bFound) { favmgrlistView1.Items.Remove(itemFound); } _coord = new TextCoord(); DisplayTextCoord(_coord); }
private void DisplayTextCoord(TextCoord crd) { if (crd != null) { this.favmgrtextBox1.Text = crd._Name; this.favmgrtextBox2.Text = crd._Lat + " " + crd._Lon; } }
private void listView1_MouseDoubleClick(object sender, MouseEventArgs e) { ListViewItem lstvItem = favmgrlistView1.GetItemAt(e.X, e.Y); if ((lstvItem != null) && (lstvItem.Tag != null)) { _coord = lstvItem.Tag as TextCoord; DisplayTextCoord(_coord); } }
private void btnSave_Click(object sender, EventArgs e) { // Check if valid String err = performValidityCheckAndUpdateHMI(); if (err != "") { MessageBox.Show(err); } else { // either we overwrite existing or we create a new bool bFound = false; ListViewItem itemFound = null; foreach (ListViewItem item in favmgrlistView1.Items) { TextCoord crd = item.Tag as TextCoord; if (crd != null) { if (crd._Uid == _coord._Uid) { itemFound = item; bFound = true; break; } } } if (!bFound) { // Add new itemFound = favmgrlistView1.Items.Add(_coord._Name); itemFound.Tag = _coord; } else { // replace old itemFound.Tag = _coord; itemFound.Text = _coord._Name; } } }
private void button1_Click(object sender, EventArgs e) { ListTextCoord bmarks = new ListTextCoord(); // copy database bmarks._Databases = _bmarks._Databases; // Now create new coords foreach (ListViewItem item in favmgrlistView1.Items) { TextCoord crd = item.Tag as TextCoord; bmarks._TextCoords.Add(crd); } // save _daddy.SaveBookmarks(bmarks); // Maj du pere _daddy.PostTreatmentLoadCache(); this.DialogResult = DialogResult.OK; this.Close(); }
private void btnLoad_Click(object sender, EventArgs e) { _coord = new TextCoord(); DisplayTextCoord(_coord); }