private void trvResources_MouseDoubleClick(object sender, MouseEventArgs e) { TreeNodeAdv node = trvResources.GetNodeAt(new Point(e.X, e.Y)); if (node != null) { var item = node.Tag as RepositoryItem; if (item != null && !item.IsFolder) { var conn = _connManager.GetConnection(RepositoryTreeModel.GetParentConnectionName(item)); var resMgr = ServiceRegistry.GetService <OpenResourceManager>(); resMgr.Open(item.ResourceId, conn, false, this); } } }
/// <summary> /// Internal use only. Do not invoke directly. Use <see cref="ViewContentManager"/> for that /// </summary> public SiteExplorer() { InitializeComponent(); Application.Idle += new EventHandler(OnIdle); ndResource.ToolTipProvider = new RepositoryItemToolTipProvider(); ndResource.DrawText += new EventHandler<Aga.Controls.Tree.NodeControls.DrawEventArgs>(OnNodeDrawText); var ts = ToolbarService.CreateToolStripItems("/Maestro/Shell/SiteExplorer/Toolbar", this, true); //NOXLATE tsSiteExplorer.Items.AddRange(ts); _connManager = ServiceRegistry.GetService<ServerConnectionManager>(); var omgr = ServiceRegistry.GetService<OpenResourceManager>(); var clip = ServiceRegistry.GetService<ClipboardService>(); _model = new RepositoryTreeModel(_connManager, trvResources, omgr, clip); trvResources.Model = _model; Workbench wb = Workbench.Instance; wb.ActiveDocumentChanged += OnActiveDocumentChanged; }
/// <summary> /// Internal use only. Do not invoke directly. Use <see cref="ViewContentManager"/> for that /// </summary> public SiteExplorer() { InitializeComponent(); Application.Idle += new EventHandler(OnIdle); ndResource.ToolTipProvider = new RepositoryItemToolTipProvider(); ndResource.DrawText += WeakEventHandler.Wrap <EventHandler <Aga.Controls.Tree.NodeControls.DrawEventArgs> >(OnNodeDrawText, (eh) => ndResource.DrawText -= eh); var ts = ToolbarService.CreateToolStripItems("/Maestro/Shell/SiteExplorer/Toolbar", this, true); //NOXLATE tsSiteExplorer.Items.AddRange(ts); _connManager = ServiceRegistry.GetService <ServerConnectionManager>(); var omgr = ServiceRegistry.GetService <OpenResourceManager>(); var clip = ServiceRegistry.GetService <ClipboardService>(); _model = new RepositoryTreeModel(_connManager, trvResources, omgr, clip); trvResources.Model = _model; Workbench wb = Workbench.Instance; wb.ActiveDocumentChanged += WeakEventHandler.Wrap(OnActiveDocumentChanged, (eh) => wb.ActiveDocumentChanged -= eh); }
private void trvResources_DragDrop(object sender, DragEventArgs e) { var data = e.Data.GetData(typeof(RepositoryHandle[])) as RepositoryHandle[]; if (data == null) { //See if the mouse is currently over a node var node = trvResources.GetNodeAt(trvResources.PointToClient(new Point(e.X, e.Y))); SiteExplorerDragDropHandler.OnDragDrop(this, e, node); } else { //See if the mouse is currently over a node var node = trvResources.GetNodeAt(trvResources.PointToClient(new Point(e.X, e.Y))); if (node == null) { return; } //Can only drop in a folder var item = node.Tag as RepositoryItem; if (item != null && item.IsFolder) { string connectionName = RepositoryTreeModel.GetParentConnectionName(item); string folderId = item.ResourceId; if (data.Length < 0) { return; } if (data.First().Connection.DisplayName == connectionName) { //I think it's nice to ask for confirmation if (data.Length > 0) { if (!MessageService.AskQuestion(Strings.ConfirmMove)) { return; } } string[] folders = MoveResourcesWithinConnection(connectionName, data.Select(x => x.ResourceId.ToString()).ToArray(), folderId); foreach (var fid in folders) { LoggingService.Info($"Refreshing: {fid} on {connectionName}"); //NOXLATE RefreshModel(connectionName, fid); } } else { /* * Consider the following layout: * * ConnectionA (Root): * Samples * Sheboygan * Data * *.FeatureSource * Layers * *.LayerDefinition * Maps * *.MapDefinition * * ConnectionB (Root): * Foo * Bar * Snafu * * These are the possible scenarios and outcomes: * * Case 1 - Copy folder Samples/Sheboygan/Data into ConnectionB root: * * Expect: * * ConnectionB (Root): * Data * *.FeatureSource * Foo * Bar * Snafu * * Case 2 - Copy Samples/Sheboygan/Data/*.FeatureSource into ConnectionB root: * * Expect: * * ConnectionB (Root): * *.FeatureSource * Foo * Bar * Snafu * * Case 3 - Copy Samples/Sheboygan/Data/*.FeatureSource into Connection B/Foo: * * Expect: * * ConnectionB (Root): * Foo * *.FeatureSource * Bar * Snafu * * Case 4 - Copy Samples/Sheboygan/Data into Connection B/Foo: * * Expect: * * ConnectionB (Root): * Foo * Data * *.FeatureSource * Bar * Snafu * * Case 5 - Copy Samples/Sheboygan/Data into Connection B/Bar/Snafu: * * Expect: * * ConnectionB (Root): * Foo * Bar * Snafu * Data * *.FeatureSource * * Case 6 - Copy Samples/Sheboygan/Data/*.FeatureSource into Connection B/Bar/Snafu: * * ConnectionB (Root): * Foo * Bar * Snafu * *.FeatureSource * */ if (data.All(x => x.ResourceId.IsFolder)) { if (data.Length > 1) { //folderId = GetCommonParent(data); CopyResourcesToFolder(data, connectionName, folderId); } else { folderId += data.First().ResourceId.Name + "/"; CopyResourcesToFolder(data, connectionName, folderId); } } else { CopyResourcesToFolder(data, connectionName, folderId); } } } } }