Пример #1
0
        /// <summary>
        /// Gets TabIDs based in restrictions in input arguments.
        /// </summary>
        /// <param name="Arguments">Tab restrictions.</param>
        /// <param name="Node">Script node getting the tabs.</param>
        /// <returns>Tab IDs</returns>
        public static string[] GetTabs(IElement[] Arguments, ScriptNode Node)
        {
            switch (Arguments.Length)
            {
            case 0:
                return(ClientEvents.GetTabIDs());

            case 1:
                object Obj = Arguments[0].AssociatedObjectValue;
                if (Obj is Array A)
                {
                    if (!(A is string[] Pages))
                    {
                        Pages = (string[])Expression.ConvertTo(A, typeof(string[]), Node);
                    }

                    return(ClientEvents.GetTabIDsForLocations(Pages));
                }
                else if (Obj is IUser User)
                {
                    return(ClientEvents.GetTabIDsForUser(User));
                }
                else
                {
                    return(ClientEvents.GetTabIDsForLocation(Obj?.ToString()));
                }

            case 2:
                return(ClientEvents.GetTabIDsForLocation(Arguments[0].AssociatedObjectValue?.ToString(),
                                                         GetQueryFilter(Arguments[1], Node)));

            default:
                return(new string[0]);
            }
        }
Пример #2
0
 private string[] GetTabIDs()
 {
     if (Gateway.Configuring)
     {
         return(ClientEvents.GetTabIDs());
     }
     else
     {
         return(ClientEvents.GetTabIDsForLocation("/Settings/Roster.md"));
     }
 }