示例#1
0
        public void Initialize <TContext>(TContext context)
            where TContext : MainContext, new()
        {
            // Инициализация списков
            Applets = new Dictionary <string, List <UIApplet> >()
            {
                { "Tile", new List <UIApplet>() },
                { "Form", new List <UIApplet>() },
                { "Popup", new List <UIApplet>() }
            };
            ViewItems = new List <UIViewItem>();

            // Получение фабрик
            DataBUSViewFR <TContext>     dataBUSViewFactory     = new DataBUSViewFR <TContext>();
            BUSUIViewFR <TContext>       busUIViewFactory       = new BUSUIViewFR <TContext>();
            DataBUSAppletFR <TContext>   dataBUSAppletFactory   = new DataBUSAppletFR <TContext>();
            BUSUIAppletFR <TContext>     busUIAppletFactory     = new BUSUIAppletFR <TContext>();
            DataBUSViewItemFR <TContext> dataBUSViewItemFactory = new DataBUSViewItemFR <TContext>();
            BUSUIViewItemFR <TContext>   busUIViewItemFactory   = new BUSUIViewItemFR <TContext>();

            // Маппинг в UI уровень представления
            View = busUIViewFactory.BusinessToUI(dataBUSViewFactory.DataToBusiness(viewInfo.View, context));
            viewInfo.ViewApplets.ForEach(applet =>
            {
                Applets.GetValueOrDefault(applet.Type)
                .Add(busUIAppletFactory.BusinessToUI(dataBUSAppletFactory.DataToBusiness(applet, context)));
            });

            // Маппинг в UI уровень элементов представления
            viewInfo.ViewItems.ForEach(viewItem =>
            {
                ViewItems.Add(busUIViewItemFactory.BusinessToUI(dataBUSViewItemFactory.DataToBusiness(viewItem, context)));
            });
        }
        public void Initialize <TContext>(TContext context)
            where TContext : MainContext, new()
        {
            Screens        = new List <UIScreen>();
            ScreensRouting = new Dictionary <string, string>();
            DataBUSApplicationFR <TContext> dataApplicationFR = new DataBUSApplicationFR <TContext>();
            BUSUIApplicationFR <TContext>   UIApplicationFR   = new BUSUIApplicationFR <TContext>();
            DataBUSScreenFR <TContext>      dataScreenFR      = new DataBUSScreenFR <TContext>();
            BUSUIScreenFR <TContext>        UIScreenFR        = new BUSUIScreenFR <TContext>();
            DataBUSViewFR <TContext>        dataBUSViewFR     = new DataBUSViewFR <TContext>();
            BUSUIViewFR <TContext>          busUIViewFR       = new BUSUIViewFR <TContext>();

            Application = UIApplicationFR.BusinessToUI(dataApplicationFR.DataToBusiness(applicationInfo.Application, context));
            applicationInfo.Screens.ForEach(screen =>
            {
                Screens.Add(UIScreenFR.BusinessToUI(dataScreenFR.DataToBusiness(screen, context)));
            });
            CurrentScreen  = applicationInfo.CurrentScreen == null ? null : UIScreenFR.BusinessToUI(dataScreenFR.DataToBusiness(applicationInfo.CurrentScreen, context));
            CurrentView    = applicationInfo.CurrentView == null ? null : busUIViewFR.BusinessToUI(dataBUSViewFR.DataToBusiness(applicationInfo.CurrentView, context));
            ScreensRouting = applicationInfo.ScreensRouting;
        }