Exemplo n.º 1
0
 public void AddService(ButtonService bs)
 {
     //NOTE: should this worry about catching/avoiding
     //a "key already exists" ArgumentException?
     //I'd say under normal operation that shouldn't happen,
     //and would mean either A) a poorly-coded service,
     //or B) trying to add a redundant service to a button
     Services.Add(bs.ServiceType, bs);
     bs.Subscribe();
 }
Exemplo n.º 2
0
        /// intended to use in a fluent-interface type of way; these are generic so
        /// that the proper subtype will be returned rather than a generic CoreButton
        #region ButtonService helpers

        ///<summary>
        /// Add a ButtonService to this button and subscribe to its hooks
        ///</summary>
        public static T AddNewService <T>(this T button, ButtonService service) where T : ICoreButton
        {
            button.AddService(service);
            return(button);
        }