Пример #1
0
        //====================================================================================================
        private void BoardDblClick(object sender, MouseEventArgs e)
        {
            txtConsole.Text = "X = " + e.X + "    Y = " + e.Y + "\r\n" + txtConsole.Text;
            const int _rad_size = 12;

            for (int i = 0; i < _objects.Count; i++)
            {
                if (_objects[i].GetType() == typeof(STA))
                {
                    STA _tsta = (STA)_objects[i];
                    if (_tsta.x >= e.X - _rad_size && _tsta.x <= e.X + _rad_size && _tsta.y >= e.Y - _rad_size &&
                        _tsta.y <= e.Y + _rad_size)
                    {
                        //txtConsole.Text = "Station selected for view :" + i.ToString() + "\r\n" + txtConsole.Text;
                        StationInfo staForm = new StationInfo(_tsta, _objects);
                        staForm.Show();
                        return;
                    }
                }
                else if (_objects[i].GetType() == typeof(AP))
                {
                    AP _tap = (AP)_objects[i];
                    if (_tap.x >= e.X - _rad_size && _tap.x <= e.X + _rad_size && _tap.y >= e.Y - _rad_size &&
                        _tap.y <= e.Y + _rad_size)
                    {
                        //txtConsole.Text = "AP selected for move :" + i.ToString() + "\r\n" + txtConsole.Text;
                        APInfo apInf = new APInfo(_tap, _objects);
                        apInf.Show();
                        return;
                    }
                }
            }
        }
Пример #2
0
        private void cmdCreateOneAPTwoSta_Click(object sender, EventArgs e)
        {
            ClearObjects();
            LeftPannelSmall();

            AP _ap = new AP();

            _ap.setOperateChannel((short)rand.Next(1, 14));
            _ap.SetVertex(300, 200, 0);
            _objects.Add(_ap);

            STA _sta = new STA(_objects);

            _sta.setOperateChannel(0);     // (rand.Next(1, 14));       //  TODO delete this line
            _sta.SetVertex(320, 210, 0);
            _objects.Add(_sta);
            _sta.Scan();

            STA _sta2 = new STA(_objects);

            _sta2.setOperateChannel(0);     // (rand.Next(1, 14));       //  TODO delete this line
            _sta2.SetVertex(280, 170, 0);
            _objects.Add(_sta2);
            _sta2.Scan();

            Medium.setMediumObj(_objects);
            SetMedioRatio();
            Medium.Enable();
            DrowOnBoard();
        }
Пример #3
0
        //====================================================================================================
        private void CreateSTA(STAType staType)
        {
            STA _sta = new STA(_objects);

            _sta.setOperateChannel(0); // (rand.Next(1, 14));       //  TODO delete this line
            _sta.SetVertex((int)MouseX, (int)MouseY, 0);

            switch (staType)
            {
            case STAType.LP:
                _sta.STAImage = (Image)Medium.imgLPImages[new Random().Next(0, Medium.imgLPImages.Count)];
                break;

            case STAType.SP:
                _sta.STAImage = (Image)Medium.imgSPImages[new Random().Next(0, Medium.imgSPImages.Count)];
                break;

            case STAType.TV:
                _sta.STAImage = (Image)Medium.imgTVImages[new Random().Next(0, Medium.imgTVImages.Count)];
                break;

            default:
                break;
            }

            _objects.Add(_sta);
            _sta.Scan();
            Medium.setMediumObj(_objects);
            //Medium.addObjToMedium(_objects);
        }
Пример #4
0
 //=====================================================================
 //=====================================================================
 //=====================================================================
 public StationInfo(STA st, ArrayList obj)
 {
     InitializeComponent();
     _sta       = st;
     _rfObjects = obj;
     this.Text  = Resources.StationInfo_StationInfo_Station_Info__ + _sta.getMACAddress();
     SlowFlow();
     BuildListView();
 }
        //====================================================================================================
        private void CreateSTA()
        {
            STA _sta = new STA(_MEDIUM, _objects);

            _sta.setOperateChannel(0);// (rand.Next(1, 14));       //  TODO delete this line
            _sta.SetVertex(MouseX, MouseY, rand.NextDouble() * 500);
            _objects.Add(_sta);
            _sta.Scan();

            _MEDIUM.addObjToMedium(_objects);
            if (!_MEDIUM.IsEnabled())
            {
                _MEDIUM.Enable();
            }
        }
Пример #6
0
 /// <summary>
 /// Open Station Form Info by selected MAC address
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void listStations_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     for (int i = 0; i < _objects.Count; i++)
     {
         if (_objects[i].GetType() == typeof(STA))
         {
             STA _tsta = (STA)_objects[i];
             if (_tsta.getMACAddress().Equals(listStations.Text))
             {
                 StationInfo staForm = new StationInfo(_tsta, _objects);
                 staForm.Show();
                 return;
             }
         }
     }
 }
Пример #7
0
 private void listStations_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     for (int i = 0; i < _objects.Count; i++)
     {
         if (_objects[i].GetType() == typeof(STA))
         {
             STA _tsta = (STA)_objects[i];
             if (_tsta.getMACAddress().Equals(listStations.Text))
             {
                 //txtConsole.Text = "Station selected for view :" + i.ToString() + "\r\n" + txtConsole.Text;
                 StationInfo staForm = new StationInfo(_tsta, _objects);
                 staForm.Show();
                 return;
             }
         }
     }
 }
Пример #8
0
        private void cmdAdd1APforSTA_Click(object sender, EventArgs e)
        {
            ClearObjects();
            LeftPannelSmall();

            AP _ap = new AP();

            _ap.setOperateChannel((short)rand.Next(1, 14));
            _ap.SetVertex(300, 200, 0);
            _objects.Add(_ap);

            STA _sta = new STA(_objects);

            _sta.setOperateChannel(0);
            _sta.SetVertex(320, 210, 0);
            _objects.Add(_sta);
            _sta.Scan();

            STA _sta2 = new STA(_objects);

            _sta2.setOperateChannel(0);
            _sta2.SetVertex(280, 170, 0);
            _objects.Add(_sta2);
            _sta2.Scan();

            STA _sta3 = new STA(_objects);

            _sta3.setOperateChannel(0);
            _sta3.SetVertex(280, 210, 0);
            _objects.Add(_sta3);
            _sta3.Scan();


            STA _sta4 = new STA(_objects);

            _sta4.setOperateChannel(0);
            _sta4.SetVertex(320, 170, 0);
            _objects.Add(_sta4);
            _sta4.Scan();

            Medium.setMediumObj(_objects);
            SetMedioRatio();
            Medium.Enable();
            DrowOnBoard();
        }
        //====================================================================================================
        private void btnImage_MouseUp(object sender, MouseEventArgs e)
        {
            MouseX = e.X;
            MouseY = e.Y;

            // txtConsole.Text = "X = " + e.X + "    Y = " + e.Y + "\r\n" + txtConsole.Text;
            if (SelectedVertex < 0)
            {
                //ConsolePrint("No object selected for move");
                return;
            }

            if (SelectedX != e.X && SelectedY != e.Y)
            {
                //ConsolePrint("Start move object");
                if (_ob == SelectedObjectType.AP)
                {
                    AP _tAP = (AP)_objects[SelectedVertex];
                    // ConsolePrint("Drawing " + _tAP.getMAC().getMAC());
                    _tAP.x = e.X;
                    _tAP.y = e.Y;
                }
                if (_ob == SelectedObjectType.STA)
                {
                    STA _tsta = (STA)_objects[SelectedVertex];
                    // ConsolePrint("Drawing " + _tsta.getMACAddress());
                    _tsta.x = e.X;
                    _tsta.y = e.Y;
                }
            }
            else
            {
                ConsolePrint("Object not moved: Simple click");
            }

            if (e.Button == MouseButtons.Right)
            {
                contextMenuStrip1.Show(this, new Point(e.X, e.Y));
            }

            SelectedVertex = -1;
            refr();
        }
Пример #10
0
        //====================================================================================================
        private void btnImage_MouseDown(object sender, MouseEventArgs e)
        {
            txtConsole.Text = "X = " + e.X + "    Y = " + e.Y + "\r\n" + txtConsole.Text;
            const int _rad_size = 12;

            for (int i = 0; i < _objects.Count; i++)
            {
                if (_objects[i].GetType() == typeof(STA))
                {
                    STA _tsta = (STA)_objects[i];
                    if (_tsta.x >= e.X - _rad_size && _tsta.x <= e.X + _rad_size && _tsta.y >= e.Y - _rad_size &&
                        _tsta.y <= e.Y + _rad_size)
                    {
                        //txtConsole.Text = "Station selected for move :" + i.ToString() + "\r\n" + txtConsole.Text;
                        SelectedVertex = i;
                        SelectedX      = e.X;
                        SelectedY      = e.Y;
                        SelectedZ      = e.X + e.Y;
                        //_ob = SelectedObjectType.STA;
                        _tsta.VColor = Color.Red;
                        return;
                    }
                }
                else if (_objects[i].GetType() == typeof(AP))
                {
                    AP _tap = (AP)_objects[i];
                    if (_tap.x >= e.X - _rad_size && _tap.x <= e.X + _rad_size && _tap.y >= e.Y - _rad_size &&
                        _tap.y <= e.Y + _rad_size)
                    {
                        //txtConsole.Text = "AP selected for move :" + i.ToString() + "\r\n" + txtConsole.Text;
                        SelectedVertex = i;
                        SelectedX      = e.X;
                        SelectedY      = e.Y;
                        SelectedZ      = e.X + e.Y;
                        _tap.VColor    = Color.Red;
                        //_ob = SelectedObjectType.AP;
                        return;
                    }
                }
            }
        }
Пример #11
0
        public void SetTDLSDelay()
        {
            int delay_in_tdls = 0;

            try
            {
                delay_in_tdls = Convert.ToInt32(txtTDLSSendDelay.Text);
            }
            catch (Exception) { }
            if (delay_in_tdls > -1)
            {
                for (int i = 0; i < _objects.Count; i++)
                {
                    if (_objects[i].GetType() == typeof(STA))
                    {
                        STA _tsta = (STA)_objects[i];
                        _tsta.DelayInTDLS = delay_in_tdls;
                    }
                }
            }
        }
Пример #12
0
        private void SetBSSDelay()
        {
            int delay_in_bss = 0;

            try
            {
                delay_in_bss = Convert.ToInt32(txtBSSSendDelay.Text);
            }
            catch (Exception) { }
            if (delay_in_bss > -1)
            {
                for (int i = 0; i < _objects.Count; i++)
                {
                    if (_objects[i].GetType() == typeof(STA))
                    {
                        STA _tsta = (STA)_objects[i];
                        _tsta.DelayInBss = delay_in_bss;
                    }
                }
            }
        }
        //====================================================================================================
        private void CreateRandomSimulation()
        {
            ClearObjects();

            for (int i = 0; i < APs_SIZE; i++)
            {
                AP _ap = new AP(_MEDIUM);
                _ap.setOperateChannel(rand.Next(1, 14));
                _ap.SetVertex(RandomC(_BOARDX), RandomC(_BOARDY), rand.NextDouble() * 500);
                _objects.Add(_ap);
            }
            for (int i = 0; i < STA_SIZE; i++)
            {
                STA _sta = new STA(_MEDIUM, _objects);
                _sta.setOperateChannel(0);// (rand.Next(1, 14));       //  TODO delete this line
                _sta.SetVertex(RandomC(_BOARDX), RandomC(_BOARDY), rand.NextDouble() * 500);
                _objects.Add(_sta);
                _sta.Scan();
            }
            _MEDIUM.setMediumObj(_objects);
            _MEDIUM.Enable();
        }
Пример #14
0
        //====================================================================================================
        private void CreateRandomSimulation()
        {
            ClearObjects();

            for (int i = 0; i < APs_SIZE; i++)
            {
                AP _ap = new AP();
                _ap.setOperateChannel((short)rand.Next(1, 14));
                _ap.SetVertex((int)RandomC(_BOARDX), (int)RandomC(_BOARDY), 0);
                _objects.Add(_ap);
            }
            for (int i = 0; i < STA_SIZE; i++)
            {
                STA _sta = new STA(_objects);
                _sta.setOperateChannel(0); // (rand.Next(1, 14));       //  TODO delete this line
                _sta.SetVertex((int)RandomC(_BOARDX), (int)RandomC(_BOARDY), 0);
                _objects.Add(_sta);
                _sta.Scan();
            }
            Medium.setMediumObj(_objects);
            SetMedioRatio();
            Medium.Enable();
        }
 public StationInfo(STA st, ArrayList _obj)
 {
     InitializeComponent();
     _sta     = st;
     _objects = _obj;
 }
Пример #16
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);
            }
        }