Ejemplo n.º 1
0
        void TreeViewDragDrop(object sender, DragEventArgs e)
        {
            Point       clientcoordinate = PointToClient(new Point(e.X, e.Y));
            ExtTreeNode node             = treeView.GetNodeAt(clientcoordinate) as ExtTreeNode;

            if (node == null)
            {
                // did not drag onto any node
                if (e.Data.GetDataPresent(DataFormats.FileDrop))
                {
                    string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
                    foreach (string file in files)
                    {
                        try {
                            var fileName = FileName.Create(file);
                            if (SD.ProjectService.IsSolutionOrProjectFile(fileName))
                            {
                                SD.ProjectService.OpenSolutionOrProject(fileName);
                            }
                            else
                            {
                                FileService.OpenFile(fileName);
                            }
                        } catch (Exception ex) {
                            MessageService.ShowException(ex, "unable to open file " + file);
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        void TreeViewDragDrop(object sender, DragEventArgs e)
        {
            Point       clientcoordinate = PointToClient(new Point(e.X, e.Y));
            ExtTreeNode node             = treeView.GetNodeAt(clientcoordinate) as ExtTreeNode;

            if (node == null)
            {
                // did not drag onto any node
                if (e.Data.GetDataPresent(DataFormats.FileDrop))
                {
                    string[] files = (string[])e.Data.GetData(DataFormats.FileDrop);
                    foreach (string file in files)
                    {
                        try {
                            IProjectLoader loader = ProjectService.GetProjectLoader(file);
                            if (loader != null)
                            {
                                FileUtility.ObservedLoad(new NamedFileOperationDelegate(loader.Load), file);
                            }
                            else
                            {
                                FileService.OpenFile(file);
                            }
                        } catch (Exception ex) {
                            MessageService.ShowException(ex, "unable to open file " + file);
                        }
                    }
                }
            }
        }