public void Drop(object data, System.Windows.Point position)
        {
            var boxGroup = data as LEDBoxGroup;
            if (boxGroup != null)
            {
                var boxGroupViewModel = new BoxGroupViewModel(boxGroup);

                if (!BoxGroups.Any(g => g.IndexLocation == boxGroupViewModel.IndexLocation))
                {
                    boxGroupViewModel.ElementPxPointX = position.X;
                    boxGroupViewModel.ElementPxPointY = position.Y;
                    BoxGroups.Add(boxGroupViewModel);
                }
            }
        }
        private static ObservableCollection<BoxGroupViewModel> LoadComponentXml(string filePath)
        {
            var boxGroupViewModelList = new ObservableCollection<BoxGroupViewModel>();
            XDocument doc = XDocument.Load(filePath);
            if (doc != null)
            {
                IEnumerable<XElement> elementlist = doc.Root.Elements("BoxGroup");

                foreach (var item in elementlist)
                {

                    ObservableCollection<BoxViewModel> boxViewModelList = new ObservableCollection<BoxViewModel>();

                    List<XElement> infoElementList = item.Elements("BoxGroupInfo").ToList();
                    List<XElement> pointElementList = item.Elements("Boxes").ToList();

                    for (int count = 0; count < infoElementList.Count; count++)
                    {

                        LEDBoxGroup boxGroup = new LEDBoxGroup();
                        List<LEDBox> boxList = new List<LEDBox>();
                        foreach (var point in pointElementList[count].Elements("Box"))
                        {
                            XAttribute COMIndexAttr = point.Attribute("COMIndex");
                            XAttribute SenderIndexAttr = point.Attribute("SenderIndex");
                            XAttribute PortIndexAttr = point.Attribute("PortIndex");
                            XAttribute ConnectIndexAttr = point.Attribute("ConnectIndex");
                            XAttribute WidthAttr = point.Attribute("Width");
                            XAttribute HeightAttr = point.Attribute("Height");
                            XAttribute XInPortAttr = point.Attribute("XInPort");
                            XAttribute YInPortAttr = point.Attribute("YInPort");
                            XAttribute XAttr = point.Attribute("X");
                            XAttribute YAttr = point.Attribute("Y");

                            LEDBox box = new LEDBox();
                            box.COMIndex = COMIndexAttr.Value;
                            box.SenderIndex = Convert.ToByte(SenderIndexAttr.Value);
                            box.PortIndex = Convert.ToByte(PortIndexAttr.Value);
                            box.ConnectIndex = Convert.ToByte(ConnectIndexAttr.Value);
                            box.Width = Convert.ToDouble(WidthAttr.Value);
                            box.Height = Convert.ToDouble(HeightAttr.Value);
                            box.XInPort = Convert.ToUInt16(XInPortAttr.Value);
                            box.YInPort = Convert.ToUInt16(YInPortAttr.Value);
                            box.X = Convert.ToUInt16(XAttr.Value);
                            box.Y = Convert.ToUInt16(YAttr.Value);

                            boxList.Add(box);

                            //BoxViewModel boxViewModel = new BoxViewModel(box);
                            //boxViewModelList.Add(boxViewModel);
                        }
                        boxGroup.COMIndex = boxList[0].COMIndex;
                        boxGroup.SenderIndex = boxList[0].SenderIndex;
                        boxGroup.PortIndex = boxList[0].PortIndex;
                        boxGroup.Boxes = boxList;

                        BoxGroupViewModel elementViewModel = new BoxGroupViewModel(boxGroup);

                        XAttribute sysIndexLocationAttr = infoElementList[count].Attribute("IndexLocation");
                        if (sysIndexLocationAttr != null)
                            elementViewModel.IndexLocation = sysIndexLocationAttr.Value;

                        XAttribute sysElementPxPointXAttr = infoElementList[count].Attribute("ElementPxPointX");
                        if (sysElementPxPointXAttr != null)
                            elementViewModel.ElementPxPointX = double.Parse(sysElementPxPointXAttr.Value);

                        XAttribute elementPxPointYAttr = infoElementList[count].Attribute("ElementPxPointY");
                        if (elementPxPointYAttr != null)
                            elementViewModel.ElementPxPointY = double.Parse(elementPxPointYAttr.Value);

                        boxGroupViewModelList.Add(elementViewModel);
                    }


                    #region load
                    //foreach (var infoElement in infoElementList)
                    //{

                    //    LEDBoxGroup groupitem = new LEDBoxGroup();


                    //    XAttribute sysIndexLocationAttr = infoElement.Attribute("IndexLocation");
                    //    if (sysIndexLocationAttr != null)
                    //        elementViewModel.IndexLocation = sysIndexLocationAttr.Value;

                    //    XAttribute sysElementPxPointXAttr = infoElement.Attribute("ElementPxPointX");
                    //    if (sysElementPxPointXAttr != null)
                    //        elementViewModel.ElementPxPointX = double.Parse(sysElementPxPointXAttr.Value);

                    //    XAttribute elementPxPointYAttr = infoElement.Attribute("ElementPxPointY");
                    //    if (elementPxPointYAttr != null)
                    //        elementViewModel.ElementPxPointY = double.Parse(elementPxPointYAttr.Value);

                    //}

                    //IEnumerable<XElement> pointElementList = item.Elements("Boxes");
                    //foreach (var pointElement in pointElementList)
                    //{

                    //    foreach (var point in pointElement.Elements("Box"))
                    //    {
                    //        XAttribute COMIndexAttr = point.Attribute("COMIndex");
                    //        XAttribute SenderIndexAttr = point.Attribute("SenderIndex");
                    //        XAttribute PortIndexAttr = point.Attribute("PortIndex");
                    //        XAttribute ConnectIndexAttr = point.Attribute("ConnectIndex");
                    //        XAttribute WidthAttr = point.Attribute("Width");
                    //        XAttribute HeightAttr = point.Attribute("Height");
                    //        XAttribute XInPortAttr = point.Attribute("XInPort");
                    //        XAttribute YInPortAttr = point.Attribute("YInPort");
                    //        XAttribute XAttr = point.Attribute("X");
                    //        XAttribute YAttr = point.Attribute("Y");

                    //        LEDBox box = new LEDBox();
                    //        box.COMIndex = COMIndexAttr.Value;
                    //        box.SenderIndex = Convert.ToByte(SenderIndexAttr.Value);
                    //        box.PortIndex = Convert.ToByte(PortIndexAttr.Value);
                    //        box.ConnectIndex = Convert.ToByte(ConnectIndexAttr.Value);
                    //        box.Width = Convert.ToDouble(WidthAttr.Value);
                    //        box.Height = Convert.ToDouble(HeightAttr.Value);
                    //        box.XInPort = Convert.ToUInt16(XInPortAttr.Value);
                    //        box.YInPort = Convert.ToUInt16(YInPortAttr.Value);
                    //        box.X = Convert.ToUInt16(XAttr.Value);
                    //        box.Y = Convert.ToUInt16(YAttr.Value);

                    //        BoxViewModel boxViewModel = new BoxViewModel(box);
                    //        boxViewModelList.Add(boxViewModel);
                    //    }
                    //}

                    #endregion

                    //elementViewModel.LEDBoxes = boxViewModelList;
                    //boxGroupViewModelList.Add(elementViewModel);
                }
            }
            return boxGroupViewModelList;
        }