Пример #1
0
        /// <summary>
        /// Handles the remove button action
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void removeButton_Click(object sender, EventArgs e)
        {
            // if nothing's been selected, get out
            if (dosBlockTable.SelectedRows.Count <= 0)
            {
                return;
            }

            // grab the rowidx/type from the table
            int       rowIdx = dosBlockTable.SelectedCells[0].RowIndex;
            string    remIP  = dosBlockTable["blockedip", rowIdx].Value.ToString();
            BlockedIP remove = new BlockedIP();

            // find the IP in the blockcache
            foreach (BlockedIP ip in blockcache)
            {
                // if the two match
                if (((ip.Blockedip).ToString()).Equals(remIP))
                {
                    remove = ip;
                    break;
                }
            }

            // remove from the cache, update the module blockcache, and rebuild grid
            blockcache.Remove(remove);
            this.dosmod.data.BlockCache.Remove(remove.Blockedip);
            RebuildTable();
        }
Пример #2
0
        /// <summary>
        /// Handles the remove button action
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void removeButton_Click(object sender, EventArgs e)
        {
            // if nothing's been selected, get out
            if (dosBlockTable.SelectedRows.Count <= 0)
                return;

            // grab the rowidx/type from the table
            int rowIdx = dosBlockTable.SelectedCells[0].RowIndex;
            string remIP = dosBlockTable["blockedip", rowIdx].Value.ToString();
            BlockedIP remove = new BlockedIP();

            // find the IP in the blockcache
            foreach ( BlockedIP ip in blockcache )
            {
                // if the two match
                if (((ip.Blockedip).ToString()).Equals(remIP))
                {
                    remove = ip;
                    break;
                }
            }

            // remove from the cache, update the module blockcache, and rebuild grid
            blockcache.Remove(remove);
            this.dosmod.data.BlockCache = this.blockcache;
            RebuildTable();
        }