Пример #1
0
        public virtual ActionResult <object> InitializeScreen([FromBody] RequestScreenModel model)
        {
            // Проверка, что такой скрин уже не проинициализирован
            if (screenInfo.Screen == null || screenInfo.Screen.Name != model.NewScreenName)
            {
                // Очистка информации
                viewInfo.Dispose();

                // Инициализация скрина
                screenInfo.Initialize(model.NewScreenName, model.NewViewName, context);
                screenInfo.ActionType = ActionType.InitializeScreen;
                screenInfoUI.Initialize(screenInfo, context);

                // Восстановление контекста при переходе на экран, который присутствует в хлебных крошках
                if (ComponentsRecordsInfo.GetCrumbs().FirstOrDefault(i => i.ViewId == screenInfo.CurrentView?.ViewId) != null)
                {
                    ComponentsRecordsInfo.RestoreContext(new List <View>()
                    {
                        context.Views
                        .Include(bo => bo.BusObject)
                        .ThenInclude(boc => boc.BusObjectComponents)
                        .ThenInclude(bc => bc.BusComp)
                        .FirstOrDefault(i => i.Id == screenInfo.CurrentView.ViewId)
                    });
                }
            }
            else
            {
                screenInfo.ActionType = ActionType.ReloadScreen;
            }
            return(Ok(screenInfoUI.Serialize()));
        }
Пример #2
0
 public virtual ActionResult <object> ScreenInfo(string screenName)
 {
     if (screenInfo.Screen != null && screenInfo.Screen.Name != screenName)
     {
         IScreenInfo newScreenInfo = (IScreenInfo)screenInfo.Clone();
         newScreenInfo.Initialize(screenName, null, context);
         IScreenInfoUI newScreenInfoUI = (IScreenInfoUI)screenInfoUI.Clone();
         newScreenInfoUI.Initialize(newScreenInfo, context);
         return(Ok(newScreenInfoUI.Serialize()));
     }
     else
     {
         return(Ok(screenInfoUI.Serialize()));
     }
 }