Beispiel #1
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            using (AILocationDialog dlg = new AILocationDialog())
            {
                DialogResult result = dlg.ShowDialog();
                if (result == DialogResult.OK)
                {
                    ListViewItem item = new ListViewItem(new string[] { dlg.Location.IPAddress, dlg.Location.Port.ToString() });
                    item.Tag = dlg.Location;
                    aiLocationListView.Items.Add(item);
                }
            }

            DialogResult = DialogResult.None;
        }
Beispiel #2
0
 private void OnActivate(object sender, EventArgs e)
 {
     if (aiLocationListView.SelectedItems.Count > 0)
     {
         int          index    = aiLocationListView.SelectedIndices[0];
         ListViewItem item     = aiLocationListView.Items[index];
         AILocation   location = (AILocation)item.Tag;
         using (AILocationDialog dlg = new AILocationDialog(location))
         {
             DialogResult result = dlg.ShowDialog();
             if (result == DialogResult.OK)
             {
                 aiLocationListView.Items[index].SubItems[0].Text = dlg.Location.IPAddress;
                 aiLocationListView.Items[index].SubItems[1].Text = dlg.Location.Port.ToString();
             }
         }
     }
 }