Exemplo n.º 1
0
        public void OnInjectDependencies(Signal <float> exampleSignal)
        {
            // instantiate a command object
            ExampleCommand command = new ExampleCommand();

            // register a command as a listener of the signal
            exampleSignal.AddCommand(command);

            // ...
            // further calls to exampleSignal.Dispatch( float value ) will also
            // invoke command.Execute( float value )
        }
Exemplo n.º 2
0
        public void InstantiateBindings()
        {
            foreach (IList <Binding> bindingList in binder.Values)
            {
                foreach (Binding binding in bindingList)
                {
                    this.Get(binding.Key, binding.Name, false);
                }
            }
            if (exceptions.Count != 0)
            {
                IList <string> previousString  = new List <string>();
                string         exceptionString = "Bindings not found for the following:\n";

                for (int i = 0; i < exceptions.Count; i++)
                {
                    BindingNotFoundException bindingNotFoundException = exceptions[i];
                    if (!previousString.Contains(bindingNotFoundException.Message))
                    {
                        previousString.Add(bindingNotFoundException.Message);
                        exceptionString += bindingNotFoundException.Message + "\n";
                        for (int x = i; x < exceptions.Count; x++)
                        {
                            BindingNotFoundException nextException = exceptions[x];
                            if (bindingNotFoundException.Message.Equals(nextException.Message))
                            {
                                if (nextException.BaseClass != null)
                                {
                                    exceptionString += "\tin class " + nextException.BaseClass + "\n";
                                }
                            }
                        }
                    }
                }
                throw new BindingNotFoundException(exceptionString);
            }
            //Initialize commands
            foreach (KeyValuePair <Type, IList <Type> > pairs in signalsToCommands)
            {
                Signal s = (Signal)this.Get(pairs.Key, "", true);
                foreach (Type commands in pairs.Value)
                {
                    s.AddCommand(commands);
                }
            }
        }
Exemplo n.º 3
0
 public void RegisterCommand(Command command)
 {
     _localCommands.Add(_signal.AddCommand(command));
 }