Exrin Isolates and MasterDetailContainer

27 Views Asked by At

When working with the Exrin Isolates approach you define the stacks in each Isolater. How do you combine it to work with a MasterDetailContainer? For example if I want a menu in the old approach I would create a ViewContainer and pass it a stack for the menu and another one for the pages, but with Isolates I'll have a lot of stacks. how should I build the ViewContainer or maybe should I still have only one main stack and use the Isolates only to isolate views and viewmodels?

public class MainViewContainer : Exrin.Framework.ViewContainer, IMasterDetailContainer
    {
        private readonly MasterDetailPage r_MasterPage;

        public MainViewContainer(MenuStack i_MenuStack, MainStack i_MainStack)
            : base(eContainer.Main.ToString())
        {
            r_MasterPage = new MasterDetailPage();
            MasterDetailProxy masterProxy = new MasterDetailProxy(r_MasterPage);
            NativeView = masterProxy.View;
            Proxy = masterProxy;
            DetailStack = i_MainStack;
            MasterStack = i_MenuStack;
            RegionMapping.Add(eRegions.Menu, ContainerType.Master);
            RegionMapping.Add(eRegions.Main, ContainerType.Detail);
        }

        public IHolder MasterStack { get; set; }

        public IHolder DetailStack { get; set; }

        public IMasterDetailProxy Proxy { get; set; }

        public bool IsPresented
        {
            get
            {
                return r_MasterPage.IsPresented;
            }

            set
            {
                r_MasterPage.IsPresented = value;
            }
        }

        public void SetStack(ContainerType i_ContainerType, object i_Page)
        {
            switch (i_ContainerType)
            {
                case ContainerType.Detail:
                    r_MasterPage.Detail = i_Page as Page;
                    break;
                case ContainerType.Master:
                    r_MasterPage.Master = i_Page as Page;
                    break;
            }
        }
    } 
1

There are 1 best solutions below

0
On BEST ANSWER

If you need to blend the stacks, that you will place in isolates, then it would be a good idea to define all your stacks and keys in a single location.

However, remember that isolates are designed for splitting up large chunks of code into separate modules. I would only recommend a max of 3 isolates for any given project. Using Feature Grouping, is a good way to structure you Views/ViewModels in your project, if you have a large project but not quite big enough for isolates.