ClearFontCache() public static method

public static ClearFontCache ( ) : void
return void
        private static void ThreadActivateTheme(object param)
        {
            if (!(param is ThreadParams))
            {
                Log.Error("param at ThreadActivateTheme has wrong type");
                return;
            }
            ThreadParams threadParams = (ThreadParams)param;

            GUIWaitCursor.Show();

            // Need to initialize fonts and references if they change based on the theme.
            // Check current theme.
            bool initFonts      = (GUIGraphicsContext.HasThemeSpecificSkinFile(@"\fonts.xml"));
            bool initReferences = (GUIGraphicsContext.HasThemeSpecificSkinFile(@"\references.xml"));

            // Change the theme and save this new setting.
            SetTheme(threadParams._themeName);
            SkinSettings.Save();

            // Check new theme.
            initFonts      = initFonts || GUIGraphicsContext.HasThemeSpecificSkinFile(@"\fonts.xml");
            initReferences = initReferences || GUIGraphicsContext.HasThemeSpecificSkinFile(@"\references.xml");

            // Reset fonts if needed.
            if (initFonts)
            {
                // Reinitializing the device while changing fonts freezes the UI.
                // Add some sleep() to present the wait cursor animation for at least some user feedback.
                Thread.Sleep(500);
                GUIFontManager.ClearFontCache();
                GUIFontManager.LoadFonts(GUIGraphicsContext.GetThemedSkinFile(@"\fonts.xml"));
                GUIFontManager.InitializeDeviceObjects();
                Thread.Sleep(500);
            }

            // Force a reload of the control references if needed.
            if (initReferences)
            {
                GUIControlFactory.ClearReferences();
            }

            // Reactivate the current window and refocus on the control used to change the theme.
            // This applies the new theme to the current window immediately.
            GUIWindowManager.ResetAllControls();
            GUIWindowManager.SendThreadCallbackAndWait((p1, p2, p3) =>
            {
                GUIWindowManager.ActivateWindow(p1, true, true, (int)p3);
                return(0);
            }, GUIWindowManager.ActiveWindow, 0, threadParams._focusControlId);

            GUIWaitCursor.Hide();
        }
Example #2
0
 public static void ChangeLanguage(string language)
 {
     GUIFontManager.ClearFontCache();
     if (_stringProvider == null)
     {
         Load(language);
     }
     else
     {
         _stringProvider.ChangeLanguage(GetCultureName(language));
         if (_stringProvider.Characters > GUIGraphicsContext.CharsInCharacterSet)
         {
             GUIGraphicsContext.CharsInCharacterSet = _stringProvider.Characters;
         }
     }
 }