private void bFavAdd_Click(object sender, EventArgs e) { String ip = tB_IP.Text.Trim(); ushort port = getPort(); if (StarterFunctions.ContainsFavorite(fo, ip, port)) { return; } FavoritesOptions.cFavorite fav = StarterFunctions.addFavorite(fo, ip, port); addFavoriteToFavList(fav); StatusMessage sm = new StatusMessage(fav.ip, (ushort)fav.port); sm.start(); statusMessageList.Add(sm); }
private void bFavRemove_Click(object sender, EventArgs e) { String ip = tB_IP.Text.Trim(); ushort port = getPort(); if (!StarterFunctions.ContainsFavorite(fo, ip, port)) { return; } StarterFunctions.removeFavorite(fo, ip, port); foreach (DataGridViewRow row in DGV_Fav.Rows) { bool t1 = ip.Equals(row.Cells["fav_serverip"].Value); bool t2 = port == Convert.ToUInt16(row.Cells["fav_serverport"].Value); if (ip.Equals(row.Cells["fav_serverip"].Value) && port == (ushort)Convert.ToUInt16(row.Cells["fav_serverport"].Value)) { DGV_Fav.Rows.Remove(row); break; } } }