internal static IExpressionResponse GetIExpressionResponse(Expression expIn)
        {
            ExpressionResponse expOut = new ExpressionResponse();

            expOut.Description = expIn.Description;
            expOut.Name = expIn.Name;
            expOut.Rating = expIn.Rating;
            expOut.Triggered = expIn.Triggered;
            
            expOut.ExpressionDetailCollection = new Collection<IExpressionDetail>();
            if ( expIn.ExpressionDetails != null)
            {
                foreach (CustomProperty prop in expIn.ExpressionDetails)
                {
                    expOut.ExpressionDetailCollection.Add(new ExpressionDetail(prop.Name,prop.Value));
                }
            }

            if ( expIn.Properties != null)
            {
                foreach (CustomProperty property in expIn.Properties)
                {
                    expOut.Properties[property.Name] = property.Value;
                }
            }

            return expOut;
        }
        internal static Expression GetExpression(IExpressionResponse expr)
        {
            if (null == expr)
                throw new ArgumentNullException("expr");

            Expression expression = new Expression();

            expression.Description = expr.Description;
            expression.Name = expr.Name;
            expression.Rating = expr.Rating;
            expression.Triggered = expr.Triggered;

            expression.ExpressionDetails = new CustomProperty[0];
            int index = 0;
            if (expr.ExpressionDetailCollection != null && expr.ExpressionDetailCollection.Count > 0)
            {
                expression.ExpressionDetails = new CustomProperty[expr.ExpressionDetailCollection.Count];
                foreach (IExpressionDetail detail in expr.ExpressionDetailCollection)
                {
                    expression.ExpressionDetails[index++] = new CustomProperty(detail.Name, detail.Value);
                }
            }

            expression.Properties = new CustomProperty[0];
            if ( expr.Properties != null && expr.Properties.Count > 0)
            {
                index = 0;
                expression.Properties = new CustomProperty[expr.Properties.Count];
                foreach (string key in expr.Properties.Keys)
                {
                    expression.Properties[index++] = new CustomProperty(key, expr.Properties[key]);
                }
            }

            return expression;
        }
Beispiel #3
0
 public UIExpression(Expression expression)
 {
     m_expression = expression;
 }