Exemplo n.º 1
0
        /// <summary>
        /// When a link is clicked, opens the webpage if it's a Web link, or displays
        /// the resource in context if it's a resource link.
        /// </summary>
        private static void HandleLinkLabelClick(ResourceLinkLabel lbl)
        {
            if (lbl.Resource.IsDeleted)
            {
                return;
            }

            if (lbl.Resource.Type == "Weblink")
            {
                Core.UIManager.OpenInNewBrowserWindow(lbl.Resource.GetStringProp("URL"));
            }
            else
            {
                IResource  shortcut  = (IResource)lbl.Tag;
                IUIManager uiManager = Core.UIManager;
                uiManager.BeginUpdateSidebar();
                if (shortcut.HasProp(ShortcutProps.Workspace))
                {
                    Core.WorkspaceManager.ActiveWorkspace = shortcut.GetLinkProp(ShortcutProps.Workspace);
                }
                else
                {
                    Core.WorkspaceManager.ActiveWorkspace = null;
                }
                if (shortcut.HasProp(ShortcutProps.TabID))
                {
                    Core.TabManager.CurrentTabId = shortcut.GetStringProp(ShortcutProps.TabID);
                }
                uiManager.EndUpdateSidebar();
                ActionContext context = new ActionContext(ActionContextKind.Other, null,
                                                          lbl.Resource.ToResourceList());
                if (!Core.ActionManager.ExecuteLinkClickAction(context))
                {
                    uiManager.DisplayResourceInContext(lbl.Resource);
                }
            }
        }