3

アプリケーションのデバイスの現在のワイヤレス信号強度をC#で取得して表示する方法はありますか?タイマーを介して接続があるかどうかを検出するアプリケーションがありますが、現在の信号強度を知り、ステータスバーにグラフィカルに表示する必要があります。以下は、数秒ごとに基本的な接続を検出するための現在のコードです。強度を表示するために何を追加できますか?ありがとうございました。タイマーコードはSOユーザーによって与えられました:parapura rajkumar

 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                 
4

1 に答える 1

0

いくつかの調査と他のいくつかの質問への参照の後、私は次の場所にあるオープンソースAPIを介して問題を解決することができました:managedwifi.codeplex.com

APIをダウンロードし、add->csprojを使用してプロジェクトに追加するだけです。

WlanClientクラスで指定されている「publicintRSSI」を使用します。

乾杯

于 2012-08-16T18:42:41.910 に答える