示例#1
0
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            UrlActionToken urlActionToken = (UrlActionToken)actionToken;

            string currentConsoleId = flowControllerServicesContainer.GetService <IManagementConsoleMessageService>().CurrentConsoleId;

            string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken);

            string url = urlActionToken.Url;

            string extendedUrl = $"{url}{(url.Contains("?") ? "&" : "?")}EntityToken={HttpUtility.UrlEncode(serializedEntityToken)}";

            if (extendedUrl.IndexOf("consoleId", StringComparison.OrdinalIgnoreCase) == -1)
            {
                extendedUrl = $"{extendedUrl}&consoleId={currentConsoleId}";
            }

            ConsoleMessageQueueFacade.Enqueue(
                new OpenViewMessageQueueItem
            {
                Url                = extendedUrl,
                ViewId             = Guid.NewGuid().ToString(),
                ViewType           = ViewType.Main,
                Label              = urlActionToken.Label,
                IconResourceHandle = urlActionToken.Icon
            }, currentConsoleId);

            return(null);
        }
        public FlowToken Execute(EntityToken entityToken, ActionToken actionToken, FlowControllerServicesContainer flowControllerServicesContainer)
        {
            UrlActionToken urlActionToken = (UrlActionToken)actionToken;

            string currentConsoleId = flowControllerServicesContainer.GetService <IManagementConsoleMessageService>().CurrentConsoleId;

            string serializedEntityToken = EntityTokenSerializer.Serialize(entityToken);

            string url = string.Format("{0}?EntityToken={1}", urlActionToken.Url, HttpUtility.UrlEncode(serializedEntityToken));

            ConsoleMessageQueueFacade.Enqueue(new OpenViewMessageQueueItem {
                Url = url, ViewId = Guid.NewGuid().ToString(), ViewType = ViewType.Main, Label = urlActionToken.Label
            }, currentConsoleId);

            return(null);
        }