private async Task LoadNavBarLayouts()
        {
            foreach (var layoutType in (NavBarLayoutType[])Enum.GetValues(typeof(NavBarLayoutType)))
            {
                var dictionary = await LayoutsManager
                                 .GetLayout(NavBar, layoutType.ToString())
                                 .ConfigureAwait(true);

                if (dictionary == null)
                {
                    continue;
                }

                foreach (var pageName in (string[])dictionary["TriggeredOnPages"])
                {
                    var pageType = Type.GetType(
                        $"Memenim.Pages.{pageName}");

                    if (pageType == null)
                    {
                        continue;
                    }

                    if (!_navBarPagesLayouts.ContainsKey(pageType))
                    {
                        _navBarPagesLayouts.Add(pageType, layoutType);
                    }
                }
            }
        }
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            base.OnActionExecuting(filterContext);

            var companyId = (string)filterContext.RouteData.Values["companyId"];

            Layouts = new LayoutsManager(companyId);
        }
Пример #3
0
        public async Task SwitchLayout(
            NavBarLayoutType type)
        {
            var dictionary = await LayoutsManager
                             .GetLayout(this, type.ToString())
                             .ConfigureAwait(true);

            if (dictionary == null)
            {
                return;
            }

            ChangeButtons(TopNavButtons,
                          (NavRedirectButtonNode[])dictionary[nameof(TopNavButtons)]);
            ChangeButtons(CentralNavButtons,
                          (NavRedirectButtonNode[])dictionary[nameof(CentralNavButtons)]);
            ChangeButtons(BottomNavButtons,
                          (NavRedirectButtonNode[])dictionary[nameof(BottomNavButtons)]);
        }