Remove dynamic Theme

This commit is contained in:
chinboy
2025-02-06 20:04:42 +08:00
parent 374632c519
commit efd859c19e
3 changed files with 1 additions and 97 deletions
-83
View File
@@ -1,83 +0,0 @@
using AtomUI.Theme.TokenSystem;
namespace AtomUI.Theme;
public class DynamicTheme : Theme
{
private bool _needBroadcast;
private IList<string> _algorithms;
private IDictionary<string, string> _globalTokens;
private IList<ControlTokenConfigInfo> _controlTokenConfigInfos;
public DynamicTheme(string id, string defFilePath)
: base(id, defFilePath)
{
_algorithms = new List<string>();
_globalTokens = new Dictionary<string, string>();
_controlTokenConfigInfos = new List<ControlTokenConfigInfo>();
}
public override bool IsDynamic()
{
return true;
}
public IList<string> Algorithms
{
get => _algorithms;
set
{
_algorithms = value;
_needBroadcast = true;
}
}
public void AddAlgorithm(string algorithm)
{
if (!_algorithms.Contains(algorithm))
{
_algorithms.Add(algorithm);
_needBroadcast = true;
}
}
public IDictionary<string, string> GlobalTokens
{
get => _globalTokens;
set
{
_globalTokens = value;
_needBroadcast = true;
}
}
public void AddGlobalToken(string name, string value)
{
_globalTokens.Add(name, value);
_needBroadcast = true;
}
public IList<ControlTokenConfigInfo> ControlTokenInfos
{
get => _controlTokenConfigInfos;
set
{
_controlTokenConfigInfos = value;
_needBroadcast = true;
}
}
public void AddControlToken(ControlTokenConfigInfo tokenConfigInfo)
{
// 先不检查重复,原则上是不能重复的
_controlTokenConfigInfos.Add(tokenConfigInfo);
_needBroadcast = true;
}
internal override void NotifyLoadThemeDef()
{
}
}
-1
View File
@@ -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();
}
+1 -13
View File
@@ -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()
{
// 最开始的是用户指定的目录