コード例 #1
0
    /// <summary>
    /// Get (load if not already loaded) the controller for certain menu section id
    /// </summary>
    /// <param name="id">id of the controller to get</param>
    /// <returns></returns>
    public SectionBase GetOrLoadSection(SectionId id)
    {
        if (loadedSections.TryGetValue(id, out SectionBase section))
        {
            return(section);
        }

        section = sectionFactory.GetSectionController(id);
        section?.SetViewContainer(sectionsParent);

        loadedSections.Add(id, section);
        OnSectionLoaded?.Invoke(section);
        return(section);
    }
コード例 #2
0
    /// <summary>
    /// Get (load if not already loaded) the controller for certain menu section id
    /// </summary>
    /// <param name="id">id of the controller to get</param>
    /// <returns></returns>
    public SectionBase GetOrLoadSection(SectionId id)
    {
        if (loadedSections.TryGetValue(id, out SectionBase section))
        {
            return(section);
        }

        section = sectionFactory.GetSectionController(id);
        if (section != null)
        {
            section.SetViewContainer(sectionsParent);
            SubscribeEvents(section);
        }

        loadedSections.Add(id, section);
        OnSectionLoaded?.Invoke(section);
        return(section);
    }