/// <summary> Unregister a theme target from the ThemeManager </summary> /// <param name="target"> Theme target </param> public static void UnregisterTarget(ThemeTarget target) { if (!s_initialized) { Init(); } if (target == null) { return; } if (target.ThemeId == Guid.Empty) { return; } if (!Database.Contains(target.ThemeId)) { return; } if (!ThemeTargets.ContainsKey(target.ThemeId)) { return; } if (!ThemeTargets[target.ThemeId].Contains(target)) { return; } ThemeTargets[target.ThemeId].Remove(target); }
/// <summary> Register a theme target to the ThemeManager. If the given theme target does not have a valid ThemeId, it will not get registered </summary> /// <param name="target"> Theme target </param> public static void RegisterTarget(ThemeTarget target) { if (!s_initialized) { Init(); } if (target == null) { return; } if (target.ThemeId == Guid.Empty) { return; } if (!Database.Contains(target.ThemeId)) { return; } if (!ThemeTargets.ContainsKey(target.ThemeId)) { ThemeTargets.Add(target.ThemeId, new List <ThemeTarget>()); } if (ThemeTargets[target.ThemeId].Contains(target)) { return; } ThemeTargets[target.ThemeId].Add(target); target.UpdateTarget(Database.GetThemeData(target.ThemeId)); }