Exemplo n.º 1
0
        /// <summary>
        /// Form load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void APInfo_Load(object sender, EventArgs e)
        {
            for (int i = 1; i < 14; i++)
            {
                cmbWorkChannel.Items.Add(i);
            }

            cmbWorkChannel.SelectedText = _ap.getOperateChannel().ToString();
            UpdateStandartSupport();
        }
        //*********************************************************************
        private void ThreadableConnectToAP(String SSID, Connect _conn, AP _connecttoAP)
        {
            bool connectSuccess = false;

            _AssociatedWithAPList.Clear();
            Int32 tRYStOcONNECT = 0;

            _conn.SSID          = _connecttoAP.SSID;
            _conn.Destination   = _connecttoAP.getMACAddress();
            _conn.PacketChannel = _connecttoAP.getOperateChannel();
            _conn.PacketBand    = _connecttoAP.getOperateBand();
            _conn.Reciver       = _connecttoAP.getMACAddress();
            this.setOperateChannel(_connecttoAP.getOperateChannel());
            this.setOperateBand(_connecttoAP.getOperateBand());
            while (!connectSuccess)
            {
                if (!_AssociatedWithAPList.Contains(SSID))
                {
                    if (tRYStOcONNECT < 10)
                    {
                        SendData(_conn);
                        tRYStOcONNECT++;
                        Thread.Sleep(1000);
                    }
                }
                else
                {
                    connectSuccess = true;
                }
            }
            if (connectSuccess && _scanning)
            {
                SpinWait.SpinUntil
                    (() =>
                {
                    return((bool)!_scanning);
                }
                    );
                this.setOperateChannel(_connecttoAP.getOperateChannel());
                this.setOperateBand(_connecttoAP.getOperateBand());
            }
            //  Fix Work Channel under scan
        }
Exemplo n.º 3
0
        private void tbrGUISlow_Tick(object sender, EventArgs e)
        {
            lblMAC.Text     = _ap.getMACAddress();
            lblChannel.Text = _ap.getOperateChannel().ToString();
            lblBand.Text    = _ap.getOperateBand();
            lblSSID.Text    = _ap.SSID;


            ArrayListCounted devicesList = _ap.getAssociatedDevices();

            listStations.Items.Clear();
            foreach (object __o in devicesList)
            {
                string s = (string)__o;
                listStations.Items.Add(s);
                // loop body
            }
        }
Exemplo n.º 4
0
        //====================================================================================================
        public void refr()
        {
            try
            {
                gr.Clear(BoardColor);
                Pen RadiusForApPen  = null;
                Pen RadiusForStaPen = null;

                int DoubleRadius = _RADIUS * 2;
                int HalfRadius   = _RADIUS;
                for (int i = 0; i < _objects.Count; i++)
                {
                    if (_objects[i].GetType() == typeof(STA))
                    {
                        STA _tsta = (STA)_objects[i];

                        if (_tsta.RFWorking())
                        {
                            RadiusForStaPen = new Pen(System.Drawing.Color.SandyBrown);
                        }
                        else
                        {
                            RadiusForStaPen = new Pen(System.Drawing.Color.SpringGreen);
                        }

                        Point ulCorner = new Point((int)_tsta.x - 10, (int)_tsta.y - 10);
                        gr.DrawImage(_tsta.STAImage, ulCorner);

                        gr.DrawPie(RadiusForStaPen, (float)_tsta.x - HalfRadius, (float)_tsta.y - HalfRadius,
                                   DoubleRadius,
                                   DoubleRadius, 1, 360);
                        string drawString            = "STA:" + _tsta.getOperateChannel() + " " + _tsta.getMACAddress();
                        System.Drawing.Font drawFont = new System.Drawing.Font(
                            "Arial", 7);
                        System.Drawing.SolidBrush drawBrush = new
                                                              System.Drawing.SolidBrush(System.Drawing.Color.YellowGreen);

                        gr.DrawString(drawString, drawFont, drawBrush, (int)_tsta.x + 10, (int)_tsta.y + 10);
                        drawFont.Dispose();
                        drawBrush.Dispose();
                    }
                    else if (_objects[i].GetType() == typeof(AP))
                    {
                        AP        _tap        = (AP)_objects[i];
                        Rectangle myRectangle = new Rectangle((int)_tap.x - 5, (int)_tap.y - 5, 10, 10);

                        if (_tap.RFWorking())
                        {
                            RadiusForApPen = new Pen(System.Drawing.Color.Coral);
                        }
                        else
                        {
                            RadiusForApPen = new Pen(System.Drawing.Color.Ivory);
                        }

                        gr.DrawPie(RadiusForApPen, (float)_tap.x - HalfRadius, (float)_tap.y - HalfRadius,
                                   DoubleRadius,
                                   DoubleRadius, 1, 360);

                        Point ulCorner = new Point((int)_tap.x - 10, (int)_tap.y - 10);
                        gr.DrawImage(_tap.APImage, ulCorner);

                        string drawString = "AP:" + _tap.getOperateChannel() + " " + _tap.SSID + " " +
                                            _tap.getMACAddress();
                        System.Drawing.Font drawFont = new System.Drawing.Font(
                            "Arial", 8);
                        System.Drawing.SolidBrush drawBrush = new
                                                              System.Drawing.SolidBrush(System.Drawing.Color.White);

                        gr.DrawString(drawString, drawFont, drawBrush, (int)_tap.x + 10, (int)_tap.y - 10);
                        drawFont.Dispose();
                        drawBrush.Dispose();
                    }
                }

                //gr.DrawPie(new Pen(Color.Yellow), 500/2, 500/2, 1, 1, 1, 360);
                piB.Image = bm;
            }
            catch (Exception ex)
            {
                MessageBox.Show("refr:" + ex.Message);
            }
        }