public void return_to_list(Object sender, RoutedEventArgs e)
        {
            MenuItem mnu = sender as MenuItem;
            Image    img = null;

            if (mnu != null)
            {
                img = ((ContextMenu)mnu.Parent).PlacementTarget as Image;
            }
            String tip = (String)img.ToolTip;

            string[] elems = tip.Split(null);
            Resource r     = null;

            foreach (Resource res in Resources)
            {
                if (String.Equals(res.Id, elems[2]))
                {
                    res.X = -1;
                    res.Y = -1;
                    r     = res;
                    break;
                }
            }


            if (r != null)
            {
                database.UpdateResource(r.Id, r);
                ResourcesToShow.Add(r);
            }

            ResourcePins_Draw();
        }
        private void ListView_MouseMove(object sender, MouseEventArgs e)
        {
            Console.WriteLine("SEDMO");
            Point  mousePosition = e.GetPosition(null);
            Vector diff          = startPoint - mousePosition;

            if (e.LeftButton == MouseButtonState.Pressed &&
                (Math.Abs(diff.X) > SystemParameters.MinimumHorizontalDragDistance ||
                 Math.Abs(diff.Y) > SystemParameters.MinimumVerticalDragDistance))
            {
                if (SelectedResource != null)
                {
                    ListView listView = sender as ListView;
                    Resource resource = SelectedResource;
                    Console.WriteLine("FOUND RESOURCE SELECTED " + SelectedResource.Id);
                    DataObject dragData = new DataObject("resource", resource);
                    DragDrop.DoDragDrop(listView, dragData, DragDropEffects.Move);
                    if (ResourcesToShow != null)
                    {
                        foreach (Resource r in ResourcesToShow)
                        {
                            if (r.Id == resource.Id)
                            {
                                ResourcesToShow.Remove(r);
                                break;
                            }
                        }
                    }
                }
            }
        }