void LoadProfiles() { try{ if (profiles == null) { profiles = new Netsh(); } else { profiles.LoadProfiles(); } if (profiles.Profiles.Length > 0) { listBoxProfiles.Items.AddRange(profiles.Profiles); listBoxProfiles.SetSelected(0, true); noProfiles = false; } } //on errors set noProfiles to true and add apropriate //error message as item to the names list catch (System.ComponentModel.Win32Exception) { noProfiles = true; listBoxProfiles.Items.Add(" -- netsh tool not at your system --"); } catch (NoProfilesException) { noProfiles = true; listBoxProfiles.Items.Add(" -- No WLAN profiles found --"); } }
void LoadProfiles() { try{ if(profiles == null) profiles = new Netsh() ; else profiles.LoadProfiles() ; listBoxProfiles.Items.AddRange(profiles.Profiles) ; listBoxProfiles.SetSelected(0, true) ; noProfiles = false ; } //on errors set noProfiles to true and add apropriate //error message as item to the names list catch(System.ComponentModel.Win32Exception){ noProfiles = true ; listBoxProfiles.Items.Add(" -- netsh tool not at your system --") ; } catch(NoProfilesException){ noProfiles = true ; listBoxProfiles.Items.Add(" -- No WLAN profiles found --") ; } }