public void RelocatePadUI(int i)
        {
            SpaceFinder sf = new SpaceFinder(canvas.ActualWidth, canvas.ActualHeight, m_padsUI, i, PadPixelWidth, PadPixelHeight);

            Point pos = sf.getFreeSpace();

            m_padsUI[i].XPos = pos.X;
            m_padsUI[i].YPos = pos.Y;
        }
        public void AddDevice(wgssSTU.IUsbDevice addDev)
        {
            SpaceFinder sf = new SpaceFinder(canvas.ActualWidth, canvas.ActualHeight, m_padsUI, PadPixelWidth, PadPixelHeight);

            Point pos = sf.getFreeSpace();

            int         jn = GetNextNum();
            UIPadHandle ph = new UIPadHandle(addDev.fileName, jn, canvas);

            m_padsControl.Add(new PadHandle(this, addDev, m_state, ph.Num));

            ph.ProductID = addDev.idProduct;

            ph.Width      = m_bitmapRes[ph.IDIndex].m_img.PixelWidth + 2 * m_selectThickness;
            ph.Height     = m_bitmapRes[ph.IDIndex].m_img.PixelHeight + 2 * m_selectThickness;
            ph.XOffset    = m_bitmapRes[ph.IDIndex].m_screen.m_pos.X;
            ph.YOffset    = m_bitmapRes[ph.IDIndex].m_screen.m_pos.Y;
            ph.MouseDown += shape_MouseLeftButtonDown;
            ph.MouseMove += shape_MouseMove;
            ph.MouseUp   += shape_MouseLeftButtonUp;
            ph.XPos       = pos.X;
            ph.YPos       = pos.Y;

            ph.ImgSource     = m_bitmapRes[ph.IDIndex].m_img;
            ph.WarningSource = m_warning;


            ph.Width  = PadPixelWidth;
            ph.Height = PadPixelHeight;

            ph.Selected      = false;
            ph.IdentifyState = false;

            ph.BorderThickness = m_selectThickness;

            m_padsUI.Add(ph);

            selectNew(ph);

            if (AppState.Identification_Mode == m_state)
            {
                showPadNumberOnMonitor(m_padsUI.Count - 1);
            }

            setMinSizesCanvas();
        }