Existe-t-il un moyen d'acquérir et d'afficher la puissance actuelle du signal sans fil du périphérique d'une application en C#? J'ai une application qui détecte s'il y a une connectivité via une minuterie, mais j'ai besoin de connaître la force du signal actuel, puis l'afficher graphiquement dans une barre d'état. Voici mon code actuel pour détecter la connectivité de base toutes les quelques secondes. Que puis-je ajouter pour afficher la force aussi? Je vous remercie. Le code de la minuterie a été donné par S.O. utilisateur: parapura RajkumarObtention et affichage de l'intensité du signal réseau sur un formulaire Windows
private void Form1_Load(object sender, EventArgs e)
{
//create an object to hold app settings FIRST
appsetting apps = new appsetting();
apps.getsetting();
netMessage.Clear();
//creates a timer for refresh rate on connectivity check
var timer = new Timer();
timer.Tick += new EventHandler(timer_Tick);
timer.Interval = 2000; //2 seconds
timer.Start();
}
//starts the timer
void timer_Tick(object sender, EventArgs e)
{
//if connection is not detected
if (System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable() ==f
false)
{
//clear the buffer
netMessage.Clear();
//turn RED indicator on and display message
netConnect.BackColor = Color.Red;
this.netMessage.Text = ("No Connection");
noConn = true;//set "No connection" to true
conn= false;
}
else
//turn GREEN indicator on and display message
netConnect.BackColor = Color.Lime;
this.netMessage.Text = ("Connected");
conn = true;// set connection to "true
noConn = false;
//if box is red but connection is established, turn it back to green
if (noConn == true &&
System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable() ==
true)
{
netConnect.BackColor = Color.Lime;
this.netMessage.Text = ("Connected");
conn = true;
noConn = false;
}
}
//need to display signal strength in a text box with color codes or status bar HERE
Peut-être [cette réponse] (http://stackoverflow.com/a/3274126/1220971) à [cette question] (http://stackoverflow.com/questions/3273967/detect-wifi- connectivité-in-c-sharp) pourrait aider. – Bridge