コード例 #1
0
        internal void ApplyKeyActions(IExternalTheme externalTheme, Theme theme)
        {
            var style = theme.GetStyle(componentType.FullName);

            foreach (var item in list)
            {
                if (item.IsFinalizer)
                {
                    item.Action(style, null);
                    continue;
                }

                string newValue = externalTheme.GetValue(item.Key);
                if (newValue != null)
                {
                    if (style == null || style.GetType() != styleType)
                    {
                        style = Activator.CreateInstance(styleType) as ViewStyle;
                        theme.AddStyleWithoutClone(componentType.FullName, style);
                    }

                    // Invoke action with the existing style to overwrite properties of it.
                    item.Action(style, newValue);
                }
            }
        }
コード例 #2
0
ファイル: ExternalThemeManager.cs プロジェクト: upple/TizenFX
        private static void OnTizenThemeChanged(object sender, Tizen.Applications.ThemeManager.ThemeEventArgs e)
        {
#if DEBUG
            theme = null;
#endif
            Tizen.Log.Info("NUI", $"TizenTheme: Id({e.Theme.Id}), Version({e.Theme.Version}), Title({e.Theme.Title})");
            sharedResourcePath = null;
            ThemeManager.ApplyExternalTheme(new TizenExternalTheme(e.Theme));
        }
コード例 #3
0
ファイル: ExternalThemeManager.cs プロジェクト: upple/TizenFX
        public static void SetTestTheme(IExternalTheme testTheme)
        {
            if (testTheme == null)
            {
                throw new ArgumentNullException(nameof(testTheme));
            }

            if (string.IsNullOrEmpty(testTheme.Id) || string.IsNullOrEmpty(testTheme.Version))
            {
                throw new ArgumentException();
            }

            theme = testTheme;
            ThemeManager.ApplyExternalTheme(theme);
        }
コード例 #4
0
ファイル: ExternalThemeManager.cs プロジェクト: upple/TizenFX
        public static void SetTestTheme(string id, string version, Dictionary <string, string> testData)
        {
            if (id == null)
            {
                throw new ArgumentNullException(nameof(id));
            }
            if (version == null)
            {
                throw new ArgumentNullException(nameof(version));
            }
            if (testData == null)
            {
                throw new ArgumentNullException(nameof(testData));
            }

            theme = new DictionaryExternalTheme(id, version, testData);
            ThemeManager.ApplyExternalTheme(theme);
        }