/// <summary> /// Удаление профиля соединения /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void DeleteProfile(object sender, EventArgs e) { if (listNet.SelectedIndices.Count == 1) { int number = listNet.SelectedIndices[0]; AccessPoint selectedAP = accessPoints.ToList()[number]; selectedAP.DeleteProfile(); showRichTextBox2.Text += string.Format("\r\n-> Удален профиль для точки: {0}\r\n", selectedAP.Name); } }
private bool DeleteProfile(string _name) { IEnumerable <AccessPoint> source = List(); for (int i = 0; i < source.ToArray().Length; i++) { if (source.ToList()[i].Name.ToLower() == _name.ToLower()) { AccessPoint accessPoint = source.ToList()[i]; accessPoint.DeleteProfile(); return(true); } } return(false); }
static void DeleteProfile() { var accessPoints = List(); Console.Write("\r\nEnter the index of the network you wish to delete the profile: "); int selectedIndex = int.Parse(Console.ReadLine()); if (selectedIndex > accessPoints.ToArray().Length || accessPoints.ToArray().Length == 0) { Console.Write("\r\nIndex out of bounds"); return; } AccessPoint selectedAP = accessPoints.ToList()[selectedIndex]; selectedAP.DeleteProfile(); Console.WriteLine("\r\nDeleted profile for: {0}\r\n", selectedAP.Name); }
private async Task connect(AccessPoint ap, string password) { ap.DeleteProfile(); bool str = false; AuthRequest ar = new AuthRequest(ap); ar.Password = password; try { str = await Task.Run(() => ap.Connect(ar)); //str = ap.Connect(ar); } catch { } Console.WriteLine(ap.ToString() + ar.Password + str); if (str) { Environment.Exit(0); } }