private static void ProcessTheme(List <InteractionModel> commands)
        {
            var lastCommand = commands?.FirstOrDefault()?.Attributes.Commands.OrderByDescending(x => x.Timestamp)
                              .FirstOrDefault(x => x.Type == "change_theme");

            var parameterValue = lastCommand?.Parameters.FirstOrDefault()?.Name;

            if (!string.IsNullOrEmpty(parameterValue))
            {
                var model = VisualizationModel.GetCurrent();

                if (model.Theme != parameterValue)
                {
                    model.Theme = parameterValue;
                }
            }
        }
        private static void ProcessSubscriptionEmail(List <InteractionModel> commands)
        {
            var lastCommand = commands?.FirstOrDefault()?.Attributes.Commands.OrderByDescending(x => x.Timestamp)
                              .FirstOrDefault(x => x.Type == "add_news_subscription");

            var parameterValue = lastCommand?.Parameters.FirstOrDefault()?.Email;

            if (!string.IsNullOrEmpty(parameterValue))
            {
                var model = VisualizationModel.GetCurrent();

                if (model.SubscriptionEmail != parameterValue)
                {
                    model.SubscriptionEmail = parameterValue;
                }
            }
        }
示例#3
0
        public VisualizationModel GetDataForRendering(ModelingResult modelingResult)
        {
            var result = new VisualizationModel
            {
                ExecutionPercent = modelingResult.ExecutionPercent.ToString("F"),

                Container = new ContainerRenderingModel
                {
                    Name   = modelingResult.Container.Name,
                    Width  = modelingResult.Container.Width + Interval,
                    Length = modelingResult.Container.Length + Interval
                }
            };

            foreach (var line in modelingResult.PlacingPlan)
            {
                foreach (var box in line)
                {
                    var item = new BoxRenderingModel
                    {
                        LineNumber = modelingResult.PlacingPlan.IndexOf(line) + 1,
                        Xo         = box.XPos + Interval,
                        X1         = box.XPos + box.Length + Interval,
                        Yo         = box.YPos + Interval,
                        Y1         = box.YPos + box.Width + Interval,
                        Zo         = box.ZPos + Interval,
                        Z1         = box.ZPos + box.Height + Interval,
                        Color      = DefineBoxColor(box.Name),
                        Name       = box.Name
                    };

                    result.Boxes.Add(item);
                }
            }

            return(result);
        }