示例#1
0
        private void HyperlinkExecutedEventHandler(object sender, HyperlinkExecutedEventArgs e)
        {
            if (e.Hyperlink.Data.ContainsKey("DialogId")) //Support for links with only moduleid
            {
                var node = (from n in GetMenu().SelectNodes("descendant::item").Cast <XmlNode>()
                            where n.Attributes["operation"].Value == e.Hyperlink.Data["DialogId"]
                            select n).LastOrDefault();

                if (node != null)
                {
                    ShellMenuItem temp = new ShellMenuItem();
                    temp.Operation = node.Attributes["operation"].Value;

                    AuthorizationService.CheckAuthorization(Id, new IAuthOperation[] { temp });

                    if (temp.IsAuthorized)
                    {
                        if (!string.IsNullOrEmpty(node.Attributes["assemblyFile"].Value))
                        {
                            ModuleInfo info = new ModuleInfo(node.Attributes["assemblyFile"].Value);
                            ModuleLoaderService.Load(WorkItem, info);
                        }

                        EventTopic    itemTopic = WorkItem.RootWorkItem.EventTopics.Get(node.Attributes["parameters"].Value);
                        MenuEventArgs args      = new MenuEventArgs("", HyperlinkHelper.BuildQueryString(e.Hyperlink.Data), true, null);
                        itemTopic.Fire(this, args, WorkItem, PublicationScope.Global);
                    }
                    else
                    {
                        ShellInteractionService.ShowMessageBox(StringResources.Authorization_NotAuhtorized, StringResources.Authorization_Message, null, MessageBoxButton.Ok, MessageBoxImage.Warning);
                    }
                }
            }
        }
        public void OnHyperlinkExecuted(HyperlinkExecutedEventArgs e)
        {
            EventHandler <HyperlinkExecutedEventArgs> temp = HyperlinkExecuted;

            if (temp != null)
            {
                temp(_module, e);
            }
        }
        private void HyperlinkExecutedEventHandler(object sender, HyperlinkExecutedEventArgs e)
        {
            //Set user data. [Dashboard compliance]
            if (omsSessionContext.ClientProgram == null)
            {
                EventTopic userSettingsTopic = WorkItem.EventTopics.Get(Imi.SupplyChain.UX.Modules.OrderManagement.Views.Constants.EventTopicNames.ShowChooseUserDialog);
                userSettingsTopic.Fire(this, new EventArgs(), WorkItem, PublicationScope.Global);
            }

            // A program is called from an application outside the container
            string programName        = e.Hyperlink.Data.ContainsKey("DialogId") ? e.Hyperlink.Data["DialogId"] : null;
            string programArgument    = e.Hyperlink.Data.ContainsKey("Parameters") ? e.Hyperlink.Data["Parameters"] : null;
            string programType        = e.Hyperlink.Data.ContainsKey("ProgramType") ? e.Hyperlink.Data["ProgramType"] : null;
            string programDescription = e.Hyperlink.Data.ContainsKey("DialogDescription") ? e.Hyperlink.Data["DialogDescription"] : null;

            if (programType == null || programType.Equals("trim"))
            {
                StartTrimProgram(programName, programArgument);
            }
            else if (programType.Equals("anywhere"))
            {
                StartWebView(programName, programDescription, programArgument);
            }
        }