コード例 #1
0
 public override void RequestRefresh()
 {
     _siteExp.RefreshModel(_conn.DisplayName);
 }
コード例 #2
0
        internal static void OnDragDrop(ISiteExplorer sender, DragEventArgs e, TreeNodeAdv droppedNode)
        {
            //If drop node specified, extract relevant folder, otherwise default to root (Library://)
            string folderId = StringConstants.RootIdentifier;
            IServerConnection conn = null;
            var mgr = ServiceRegistry.GetService<ServerConnectionManager>();

            if (droppedNode != null)
            {
                var ri = droppedNode.Tag as RepositoryItem;
                if (ri != null)
                {
                    if (ri.IsFolder)
                        folderId = ri.ResourceId;
                    else
                        folderId = ri.Parent != null ? ri.Parent.ResourceId : StringConstants.RootIdentifier;
                }
                conn = mgr.GetConnection(ri.ConnectionName);
            }
            else
            {
                return;
            }

            Array a = e.Data.GetData(DataFormats.FileDrop) as Array;
            bool refresh = false;
            if (a != null && a.Length > 0)
            {
                DragDropHandlerService handlerSvc = ServiceRegistry.GetService<DragDropHandlerService>();
                for (int i = 0; i < a.Length; i++)
                {
                    string file = a.GetValue(i).ToString();

                    IList<IDragDropHandler> handlers = handlerSvc.GetHandlersForFile(file);

                    if (handlers.Count == 0)
                        continue;

                    if (handlers.Count == 1)
                    {
                        using (new WaitCursor(Workbench.Instance))
                        {
                            if (handlers[0].HandleDrop(conn, file, folderId))
                                refresh = true;
                        }
                    }

                    if (handlers.Count > 1)
                    {
                        //Resolve which handler to use
                    }
                }
            }
            if (refresh)
                sender.RefreshModel(conn.DisplayName, folderId);
        }
コード例 #3
0
        internal static void OnDragDrop(ISiteExplorer sender, DragEventArgs e, TreeNodeAdv droppedNode)
        {
            //If drop node specified, extract relevant folder, otherwise default to root (Library://)
            string            folderId = StringConstants.RootIdentifier;
            IServerConnection conn     = null;
            var mgr = ServiceRegistry.GetService <ServerConnectionManager>();

            if (droppedNode != null)
            {
                var ri = droppedNode.Tag as RepositoryItem;
                if (ri != null)
                {
                    if (ri.IsFolder)
                    {
                        folderId = ri.ResourceId;
                    }
                    else
                    {
                        folderId = ri.Parent != null ? ri.Parent.ResourceId : StringConstants.RootIdentifier;
                    }
                }
                conn = mgr.GetConnection(ri.ConnectionName);
            }
            else
            {
                return;
            }

            Array a       = e.Data.GetData(DataFormats.FileDrop) as Array;
            bool  refresh = false;

            if (a != null && a.Length > 0)
            {
                DragDropHandlerService handlerSvc = ServiceRegistry.GetService <DragDropHandlerService>();
                for (int i = 0; i < a.Length; i++)
                {
                    string file = a.GetValue(i).ToString();

                    IList <IDragDropHandler> handlers = handlerSvc.GetHandlersForFile(file);

                    if (handlers.Count == 0)
                    {
                        continue;
                    }

                    if (handlers.Count == 1)
                    {
                        using (new WaitCursor(Workbench.Instance))
                        {
                            if (handlers[0].HandleDrop(conn, file, folderId))
                            {
                                refresh = true;
                            }
                        }
                    }

                    if (handlers.Count > 1)
                    {
                        //Resolve which handler to use
                        var handler = GenericItemSelectionDialog.SelectItem <IDragDropHandler>(Strings.SelectFileHandler, Strings.SelectFileHandlerDesc, handlers.ToArray());
                        if (handler != null)
                        {
                            using (new WaitCursor(Workbench.Instance))
                            {
                                if (handler.HandleDrop(conn, file, folderId))
                                {
                                    refresh = true;
                                }
                            }
                        }
                    }
                }
            }
            if (refresh)
            {
                sender.RefreshModel(conn.DisplayName, folderId);
            }
        }