示例#1
0
        public static IExternalTheme GetCurrentTheme()
        {
            if (themeLoader == null)
            {
                return(null);
            }

#if DEBUG
            if (theme != null)
            {
                return(theme);
            }
#endif
            Tizen.Applications.ThemeManager.Theme tizenTheme = null;

            try
            {
                tizenTheme = themeLoader.CurrentTheme;
            }
            catch (Exception e)
            {
                Tizen.Log.Info("NUI", $"[Ignorable] {e.GetType().Name} occurred while getting current theme using {themeLoader.GetType().FullName}: {e.Message}");
            }

            if (tizenTheme == null || string.IsNullOrEmpty(tizenTheme.Id) || string.IsNullOrEmpty(tizenTheme.Version))
            {
                return(null);
            }

            Tizen.Log.Info("NUI", $"TizenTheme: Id({tizenTheme.Id}), Version({tizenTheme.Version}), Title({tizenTheme.Title})");

            return(new TizenExternalTheme(tizenTheme));
        }
示例#2
0
        public static bool SetTheme(string id)
        {
            if (themeLoader != null)
            {
                try
                {
                    themeLoader.CurrentTheme = themeLoader.LoadTheme(id);
                    return(true);
                }
                catch (Exception e)
                {
                    Tizen.Log.Info("NUI", $"[Ignorable] {e.GetType().Name} occurred while getting load theme using {themeLoader.GetType().FullName}: {e.Message}");
                }
            }

            return(false);
        }