예제 #1
0
 /// <summary>
 /// Called when the list view wants to add a CIDR.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void listView_AddClicked(object sender, EventArgs e)
 {
     using (var dialog = new CidrEditView()) {
         dialog.ShowDialog();
         if (dialog.CidrIsValid)
         {
             AddOrInsertCidr(dialog.Cidr);
         }
     }
 }
예제 #2
0
        /// <summary>
        /// Called when the list view wants to edit a CIDR.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void listView_EditClicked(object sender, EventArgs e)
        {
            var selectedCidrText = listView.SelectedRecord as string;
            var index            = selectedCidrText == null ? -1 : Addresses.IndexOf(selectedCidrText);

            if (index != -1)
            {
                using (var dialog = new CidrEditView()) {
                    dialog.Cidr = selectedCidrText;
                    dialog.ShowDialog();
                    if (dialog.CidrIsValid)
                    {
                        Addresses.RemoveAt(index);
                        AddOrInsertCidr(dialog.Cidr, index);
                    }
                }
            }
        }