Пример #1
0
        private static void ThreadActivateTheme()
        {
            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(_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.ActivateWindow(GUIWindowManager.ActiveWindow, true, true, _focusControlId);

            GUIWaitCursor.Hide();
        }
 public void Dispose()
 {
     GUIWaitCursor.Hide();
 }
 public WaitCursor()
 {
     GUIWaitCursor.Show();
 }