예제 #1
0
        /// <summary>
        /// Selects the specified element in the console
        /// </summary>
        /// <param name="consoleId">The console id.</param>
        /// <param name="entityToken">The entity token.</param>
        public static void SelectConsoleElement(string consoleId, EntityToken entityToken)
        {
            var serializedEntityToken = EntityTokenSerializer.Serialize(entityToken, true);

            var rootEntityToken = AttachingPoint.PerspectivesRoot.EntityToken;

            var refreshInfo = TreeServicesFacade.FindEntityToken(rootEntityToken, entityToken,
                                                                 new List <RefreshChildrenParams>(new[]
            {
                new RefreshChildrenParams
                {
                    ProviderName = rootEntityToken.Source,
                    EntityToken  = EntityTokenSerializer.Serialize(rootEntityToken, true)
                }
            }));

            if (refreshInfo == null || refreshInfo.Count == 0)
            {
                return;
            }

            string perspectiveElementKey = refreshInfo.Count > 1 ? refreshInfo[1].ElementKey : refreshInfo[0].ElementKey;

            var selectItem = new SelectElementQueueItem
            {
                EntityToken           = serializedEntityToken,
                PerspectiveElementKey = perspectiveElementKey
            };

            ConsoleMessageQueueFacade.Enqueue(selectItem, consoleId);
        }
예제 #2
0
        /// <exclude />
        public static void ExecuteElementScriptAction(string serializedScriptAction, string consoleId)
        {
            string scriptAction = Encoding.UTF8.GetString(Convert.FromBase64String(serializedScriptAction));

            Dictionary <string, string> dic = StringConversionServices.ParseKeyValueCollection(scriptAction);

            if ((dic["EntityToken"] == null) || (dic["ActionToken"] == null) || (dic["PiggyBag"] == null))
            {
                throw new ArgumentException("Wrong format", "serializedScriptAction");
            }

            string serializedEntityToken = StringConversionServices.DeserializeValueString(dic["EntityToken"]);
            string serializedActionToken = StringConversionServices.DeserializeValueString(dic["ActionToken"]);
            string serializedPiggyBag    = StringConversionServices.DeserializeValueString(dic["PiggyBag"]);

            TreeServicesFacade.ExecuteElementAction(
                "DUMMY",
                serializedEntityToken,
                serializedPiggyBag,
                serializedActionToken,
                consoleId);
        }