Esempio n. 1
0
 public static void OnThemeChanged(Control control, ThemeChangedCallback callback)
 {
     if (control == null)
     {
         return;
     }
     if (callback == null)
     {
         CustomControlHandlers.Remove(control);
         return;
     }
     CustomControlHandlers[control] = callback;
     control.Disposed += CustomThemeCallback_ControlDisposed;
 }
Esempio n. 2
0
        /// <summary>
        /// Register a handler for a non-default type when theming is requested.
        /// </summary>
        /// <param name="type"></param>
        /// <param name="callback"></param>
        public static void RegisterCustomThemeHandler(Type type, ThemeChangedCallback callback)
        {
            if (callback == null)
            {
                CustomTypeHandlers.Remove(type);
                return;
            }

            if (CustomTypeHandlers.ContainsKey(type))
            {
                CustomTypeHandlers[type] += callback;
            }
            else
            {
                CustomTypeHandlers[type] = callback;
            }
        }