mirror of
https://github.com/AtomUI/AtomUI.git
synced 2026-10-28 23:08:36 +08:00
Remove dynamic Theme
This commit is contained in:
@@ -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()
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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()
|
||||
{
|
||||
// 最开始的是用户指定的目录
|
||||
|
||||
Reference in New Issue
Block a user