Exemple #1
0
        Service GetService()
        {
            var serviceName = Data.GetValue <string>("@service");

            if (serviceName.IsEmpty())
            {
                return(Parent?.GetService());
            }

            return(Service.FindByName(serviceName)
                   ?? throw new Exception("There is no service named: " + serviceName));
        }
Exemple #2
0
        Feature GetDefinedFeature()
        {
            if (Name.IsAnyOf("ROOT", "FOR"))
            {
                return(null);
            }
            if (Feature != null)
            {
                return(Feature);
            }

            var parent = Parent.GetEffectiveFeature();

            Feature = new Feature
            {
                Ref               = Data.GetValue <string>("@ref"),
                Title             = Name,
                Description       = Data.GetValue <string>("@desc"),
                ImplementationUrl = Data.GetValue <string>("@url"),
                BadgeUrl          = Data.GetValue <string>("@badgeUrl"),
                BadgeOptionalFor  = Data.GetValue <string>("@badgeOptional"),
                Icon              = Data.GetValue <string>("@icon"),
                ShowOnRight       = Data.GetValue <bool?>("@showOnRight") ?? false,
                Parent            = parent,
                Order             = Parent.Children.IndexOf(this) * 10 + 10,
                Permissions       = GetPermissions().ToArray(),
                NotPermissions    = GetPermissions(not: true).ToArray(),
                Service           = GetService() ?? Service.FindByName("Hub"),
                Pass              = Data.GetValue <string>("@pass"),
                Hide              = Data.GetValue <bool?>("@hide") ?? false
            };

            Feature.UseIframe = Data.GetValue <bool?>("@iframe") ?? Feature.Service.UseIframe;

            if (Feature.ImplementationUrl.IsEmpty())
            {
                Feature.Service = Service.FindByName("Hub");
            }

            Feature.LoadUrl = Feature.FindLoadUrl().ToLower();

            return(Feature);
        }