Ejemplo n.º 1
0
        /// <summary>
        /// Adds the automation extension to the context
        /// </summary>
        /// <param name="context"></param>
        /// <param name="extension"></param>
        public static void AddAutomation(this IDynamicBindingContext context, IAutomationExtension extension)
        {
            Guard.NotNull(() => context, context);
            Guard.NotNull(() => extension, extension);

            context.AddExport(extension);
            context.AddExportsFromInterfaces(extension);
            context.AddExportsFromInterfaces(extension.Owner);

            var mel = extension.Owner as ModelElement;

            if (mel != null)
            {
                context.AddExport(mel);
            }
        }
Ejemplo n.º 2
0
 private static void AddEventArgsToBindingContext(IEvent <EventArgs> args, IDynamicBindingContext context)
 {
     //context.AddInterfaceLayer(this.Owner);
     if (args != null)
     {
         // Export the entire event
         context.AddExport(args);
         if (args.EventArgs != null)
         {
             // Export the args and all its concrete types in the inheritance
             context.AddExportsFromInheritance(args.EventArgs);
         }
     }
 }
Ejemplo n.º 3
0
        private void Execute(IDynamicBindingContext context, bool withAutomation)
        {
            if (withAutomation)
            {
                context.AddAutomation(this);
            }

            context.AddExport(this.Settings);
            context.AddInterfaceLayer(this.Owner);

            var isValid = this.CommandBinding.Evaluate(context);

            if (isValid)
            {
                tracer.Verbose(Resources.CommandAutomation_BindingEvaluatedTrue);
                this.CommandBinding.Value.Execute();
            }
            else
            {
                tracer.Warn(Resources.CommandAutomation_BindingEvaluatedFalse,
                            this.Name, ObjectDumper.ToString(this.CommandBinding.EvaluationResults, 5));
            }
        }