diff --git a/src/AtomUI.Theme/DynamicTheme.cs b/src/AtomUI.Theme/DynamicTheme.cs deleted file mode 100644 index 6aeed708c..000000000 --- a/src/AtomUI.Theme/DynamicTheme.cs +++ /dev/null @@ -1,83 +0,0 @@ -using AtomUI.Theme.TokenSystem; - -namespace AtomUI.Theme; - -public class DynamicTheme : Theme -{ - private bool _needBroadcast; - private IList _algorithms; - private IDictionary _globalTokens; - private IList _controlTokenConfigInfos; - - public DynamicTheme(string id, string defFilePath) - : base(id, defFilePath) - { - _algorithms = new List(); - _globalTokens = new Dictionary(); - _controlTokenConfigInfos = new List(); - } - - public override bool IsDynamic() - { - return true; - } - - public IList Algorithms - { - get => _algorithms; - - set - { - _algorithms = value; - _needBroadcast = true; - } - } - - public void AddAlgorithm(string algorithm) - { - if (!_algorithms.Contains(algorithm)) - { - _algorithms.Add(algorithm); - _needBroadcast = true; - } - } - - public IDictionary GlobalTokens - { - get => _globalTokens; - - set - { - _globalTokens = value; - _needBroadcast = true; - } - } - - public void AddGlobalToken(string name, string value) - { - _globalTokens.Add(name, value); - _needBroadcast = true; - } - - public IList ControlTokenInfos - { - get => _controlTokenConfigInfos; - - set - { - _controlTokenConfigInfos = value; - _needBroadcast = true; - } - } - - public void AddControlToken(ControlTokenConfigInfo tokenConfigInfo) - { - // 先不检查重复,原则上是不能重复的 - _controlTokenConfigInfos.Add(tokenConfigInfo); - _needBroadcast = true; - } - - internal override void NotifyLoadThemeDef() - { - } -} \ No newline at end of file diff --git a/src/AtomUI.Theme/IThemeManager.cs b/src/AtomUI.Theme/IThemeManager.cs index 0ef54abdd..178ee3a72 100644 --- a/src/AtomUI.Theme/IThemeManager.cs +++ b/src/AtomUI.Theme/IThemeManager.cs @@ -9,7 +9,6 @@ public interface IThemeManager public void UnLoadTheme(string id); public void SetActiveTheme(string id); - public void RegisterDynamicTheme(DynamicTheme dynamicTheme); public void ScanThemes(); } \ No newline at end of file diff --git a/src/AtomUI.Theme/ThemeManager.cs b/src/AtomUI.Theme/ThemeManager.cs index 9ffb6d302..7d771ce86 100644 --- a/src/AtomUI.Theme/ThemeManager.cs +++ b/src/AtomUI.Theme/ThemeManager.cs @@ -184,19 +184,7 @@ internal class ThemeManager : Styles, IThemeManager ThemeChangedEvent?.Invoke(this, new ThemeChangedEventArgs(theme, oldTheme)); } - - public void RegisterDynamicTheme(DynamicTheme dynamicTheme) - { - if (_themePool.ContainsKey(dynamicTheme.Id)) - { - // TODO 需要记录一个日志 - return; - } - - _themePool.Add(dynamicTheme.Id, dynamicTheme); - dynamicTheme.NotifyRegistered(); - } - + public void ScanThemes() { // 最开始的是用户指定的目录