public BinaryLogicalOperator(IElementCreationContext context, BinaryLogicalOperatorType defaultType)
            : base(context, context.Owner.GetBooleanType())
        {
            ParameterA = context.Owner.CreateParameter("a", context.Owner.GetBooleanType());
            ParameterB = context.Owner.CreateParameter("b", context.Owner.GetBooleanType());

            Parameters.Add(ParameterA);
            Parameters.Add(ParameterB);

            var services = new[]
            {
                new BinaryLogicalOperatorService(BinaryLogicalOperatorType.And, "And", (a, b) => a && b),
                new BinaryLogicalOperatorService(BinaryLogicalOperatorType.Or, "Or", (a, b) => a || b),
            };

            foreach (var service in services)
            {
                AddAction(new ElementAction(service.Text, () => OperatorType = service.Type));
            }

            _services = services.ToDictionary(s => s.Type, s => s);

            OperatorType = defaultType;

            if (!string.IsNullOrWhiteSpace(context.Data))
            {
                var data = JsonConvert.DeserializeObject <BinaryLogicalOperatorData>(context.Data);

                OperatorType = data.OperatorType;
            }
        }
        public BinaryLogicalOperator(IElementCreationContext context, BinaryLogicalOperatorType defaultType) 
            : base(context, context.Owner.GetBooleanType())
        {
            ParameterA = context.Owner.CreateParameter("a", context.Owner.GetBooleanType());
            ParameterB = context.Owner.CreateParameter("b", context.Owner.GetBooleanType());

            Parameters.Add(ParameterA);
            Parameters.Add(ParameterB);

            var services = new[]
            {
                new BinaryLogicalOperatorService(BinaryLogicalOperatorType.And, "And", (a, b) => a && b),
                new BinaryLogicalOperatorService(BinaryLogicalOperatorType.Or, "Or", (a, b) => a || b),
            };

            foreach (var service in services)
            {
                AddAction(new ElementAction(service.Text, () => OperatorType = service.Type));
            }

            _services = services.ToDictionary(s => s.Type, s => s);

            OperatorType = defaultType;

            if (!string.IsNullOrWhiteSpace(context.Data))
            {
                var data = JsonConvert.DeserializeObject<BinaryLogicalOperatorData>(context.Data);

                OperatorType = data.OperatorType;
            }
        }
            internal BinaryLogicalOperatorService(BinaryLogicalOperatorType operatorType, string text,
                                                  Func <bool, bool, bool> func)
            {
                if (func == null)
                {
                    throw new ArgumentNullException(nameof(func));
                }

                _operatorType = operatorType;
                _text         = text;
                _func         = func;
            }
            internal BinaryLogicalOperatorService(BinaryLogicalOperatorType operatorType, string text,
                Func<bool, bool, bool> func)
            {
                if (func == null) throw new ArgumentNullException(nameof(func));

                _operatorType = operatorType;
                _text = text;
                _func = func;
            }