am I implementing the Version 3 CustomNavigationItem correctly?

the problem I'm having is the default label is missing and when I edit the widget, I can see a GUID instead of "Map Apps"  the so here is my code and then below that a screen shot:

 public class MapsGroupNavigationItem : TeeuV3.CustomNavigationItem
        {
            int _groupId = -1;
            Func<string> _getLabel;
            IList<PublicApi.Entities.MapApp> _mapapps;
            internal MapsGroupNavigationItem(TeeuV3.ICustomNavigationPlugin plugin, TeeuV3.ICustomNavigationItemConfiguration configuration, Guid id, int groupId, Func<string> getLabel)
            {
                Plugin = plugin;
                Configuration = configuration;
                UniqueID = id;
                 
                _groupId = groupId;
                _getLabel = getLabel;
           
            }

            #region ICustomNavigationItem Members

            public TeeuV3.CustomNavigationItem[] Children { get; set; }
            public TeeuV3.ICustomNavigationItemConfiguration Configuration { get; private set; }
            public string CssClass { get { return "mapapp"; } }
            public string Label { get { return _getLabel(); } }
            public TeeuV3.ICustomNavigationPlugin Plugin { get; private set; }
            public Guid UniqueID { get; private set; }

            public new bool IsSelected(string currentFullUrl)
            {
                return currentFullUrl.Contains("/mapapps/") || currentFullUrl.EndsWith("/mapapps") || currentFullUrl.EndsWith("/mapapps/");
            }

            public new bool IsVisible(int userId)
            {
                return !string.IsNullOrEmpty(Url) &&  PublicApi.MapApps.CanRead(_mapapps.FirstOrDefault().ApplicationId);
            }

            public string Url
            {
                get
                {
                    // if (_groupId == -1) { return null; }
                    if (_mapapps != null && _mapapps.Count > 0)
                    {
                        if (_mapapps.Count == 1)
                        {
                            if (_mapapps.FirstOrDefault().Group != null && _mapapps.FirstOrDefault().Group.Url != null)// && _mapapp.SafeName != null)
                            {
                                return _mapapps.FirstOrDefault().Group.Url + "mapapps/" + _mapapps.FirstOrDefault().SafeName + "/maps/"; // InternalApi.SourceingUrlService.SourceListUrl(_groupId);
                            }
                        }
                        else
                        {
                            if (_mapapps.FirstOrDefault().Group != null && _mapapps.FirstOrDefault().Group.Url != null)// && _mapapp.SafeName != null)
                            {
                                return _mapapps.FirstOrDefault().Group.Url + "mapapps/";
                            }
                        }
                    }
                   // return _mapapps.FirstOrDefault().Group.Url + "mapapps/";
                   return "";
                }
            }

            #endregion
        }


Parents
  • I think I know what I did wrong above.. testing it now, but it looks like I am not setting the Default Label, or Default Description.. both are a Func<string>..
    I think in the above, using the interface, I was using some logic to set the Label and URL.. but just to confirm, used this code to set it and I see the Label now instead of the GUID
    so that's good.. but it's not showing up in the menu

      CustomNavigationItem IGroupDefaultCustomNavigationPlugin.GetDefaultNavigationItem(int groupId, ICustomNavigationItemConfiguration configuration)
            {
                CustomNavigationItem newItem = new MapsGroupNavigationItem(this, configuration, _defaultId, groupId, () => _translation.GetLanguageResourceValue("configuration_defaultLabel"));
                newItem.DefaultLabel = GetDefaultLabel;
                newItem.DefaultDescription = GetDefaultLabelDescription;
                return newItem;
            }




    for example, this drop down navigation menu or the Groups navigation tabs

    as the following doesn't show any links after the "Tags" item

Reply
  • I think I know what I did wrong above.. testing it now, but it looks like I am not setting the Default Label, or Default Description.. both are a Func<string>..
    I think in the above, using the interface, I was using some logic to set the Label and URL.. but just to confirm, used this code to set it and I see the Label now instead of the GUID
    so that's good.. but it's not showing up in the menu

      CustomNavigationItem IGroupDefaultCustomNavigationPlugin.GetDefaultNavigationItem(int groupId, ICustomNavigationItemConfiguration configuration)
            {
                CustomNavigationItem newItem = new MapsGroupNavigationItem(this, configuration, _defaultId, groupId, () => _translation.GetLanguageResourceValue("configuration_defaultLabel"));
                newItem.DefaultLabel = GetDefaultLabel;
                newItem.DefaultDescription = GetDefaultLabelDescription;
                return newItem;
            }




    for example, this drop down navigation menu or the Groups navigation tabs

    as the following doesn't show any links after the "Tags" item

Children
No Data