Exemplo n.º 1
0
        /// <summary>
        /// Subscribe a control to a registered theme and apply it
        /// </summary>
        /// <param name="ctl"></param>
        /// <param name="themeName"></param>
        public void Subscribe(IThemeManageable ctl, string themeName)
        {
            if (!ManagedThemes.Keys.Contains(themeName))
            {
//                if (ctl is WTLabelManaged)
//                    RegisterTheme(new LabelTheme(), themeName);
            }

            ManagedTheme mtheme;

            if (ManagedThemes.TryGetValue(themeName, out mtheme))
            {
                ctl.ManagedTheme = mtheme;
                mtheme.Subscribe(ctl);
            }
            else
            {
                throw new ArgumentException("Tried to subscribe unregistered theme");
            }
        }
Exemplo n.º 2
0
 public void Unsubscribe(IThemeManageable control)
 {
     control.SetTheme(null);
     Subscribers.Remove(control);
 }
Exemplo n.º 3
0
 public void Subscribe(IThemeManageable control)
 {
     control.SetTheme(this.Theme);
     Subscribers.Add(control);
 }
Exemplo n.º 4
0
        //public void Subscribe(IThemeManageable ctl, ManagedTheme mtheme)
        //{
        //    ctl.SetManagedTheme(mtheme);
        //    mtheme.Subscribe(ctl);
        //}

        /// <summary>
        /// Unsubscribe a control from a registered control theme and un-apply it
        /// </summary>
        /// <param name="ctl"></param>
        public void Unsubscribe(IThemeManageable ctl)
        {
            ctl.ManagedTheme.Unsubscribe(ctl);
            ctl.ManagedTheme = null;
        }