Esempio n. 1
0
 /// <summary>
 /// Releases all lazy initialized resources. This will reduce the memory consumption
 /// of this instance.
 /// When requested again, the skin resources will be loaded again automatically.
 /// </summary>
 /// <remarks>
 /// To invoke this method, use method <see cref="SkinManager.ReleaseSkinResources"/>.
 /// </remarks>
 internal virtual void Release()
 {
     _localResourceFilePaths = null;
     if (_localStyleResources != null)
     {
         _localStyleResources.Dispose();
     }
     _localStyleResources = null;
     ReleaseAllGUIModels();
     _inheritedSkinResources = null;
 }
Esempio n. 2
0
 public void InstallSkinResources(SkinResources skinResources)
 {
     // Setup the resource chain and use the default skin as last fallback
     skinResources.SetupResourceChain(_skins, DefaultSkin);
     // Initialize SkinContext with new resource bundle
     SkinContext.SkinResources = skinResources;
     skinResources.InitializeStyleResourceLoading(); // Initializes the resource file dictionary
     Fonts.FontManager.Load(skinResources);          // Needs an initialized resource file dictionary - loads font files
     skinResources.LoadAllStyleResources();          // Needs the FontManager
     // Notify others that we loaded a new skin or theme
     SkinResourcesMessaging.SendSkinResourcesMessage(SkinResourcesMessaging.MessageType.SkinOrThemeChanged);
 }
Esempio n. 3
0
 internal override void SetupResourceChain(IDictionary<string, Skin> skins, Skin defaultSkin)
 {
   CheckMetadataInitialized();
   Theme inheritTheme;
   if (_basedOnTheme != null && _parentSkin.Themes.TryGetValue(_basedOnTheme, out inheritTheme))
     InheritedSkinResources = inheritTheme;
   else
   {
     SkinResources parentDefaultTheme = _parentSkin.DefaultTheme;
     InheritedSkinResources = parentDefaultTheme != null && parentDefaultTheme != this ? parentDefaultTheme : _parentSkin;
   }
   _inheritedSkinResources.SetupResourceChain(skins, defaultSkin);
 }
Esempio n. 4
0
        public bool InstallBackgroundManager(Skin skin)
        {
            // Loading and disposing of the background manager will be handled by the BackgroundManagerData class
            UninstallBackgroundManager();
            SkinResources current = skin;

            while (current != null)
            {
                if (current is Skin && _backgroundManagerData.Install((Skin)current))
                {
                    return(true);
                }
                current = current.InheritedSkinResources;
            }
            return(false);
        }
Esempio n. 5
0
 protected ICollection<ListItem> CollectSkinResourcesColors(SkinResources resourceBundle)
 {
   ICollection<ListItem> result = new List<ListItem>();
   foreach (KeyValuePair<object, object> localStyleResource in resourceBundle.LocalStyleResources)
   {
     object key = localStyleResource.Key;
     object value = localStyleResource.Value;
     object c;
     object testString;
     int testInt;
     if (TypeConverter.Convert(value, typeof(Color), out c))
       // Avoid conversion of strings containing int values
       if (!TypeConverter.Convert(value, typeof(string), out testString) || !int.TryParse((string) testString, out testInt))
       {
         Color color = (Color) c;
         result.Add(BuildColorListItem(key.ToString(), color));
       }
   }
   SkinResources inherited = resourceBundle.InheritedSkinResources;
   if (inherited != null)
     CollectionUtils.AddAll(result, CollectSkinResourcesColors(inherited));
   return result;
 }
 protected void OnSkinResourcesChanged(SkinResources newResources)
 {
   if (_active)
     UpdateTarget();
 }
Esempio n. 7
0
 public StyleResourceModelLoader(SkinResources parent)
 {
     _parent = parent;
 }
Esempio n. 8
0
 /// <summary>
 /// Releases all lazy initialized resources. This will reduce the memory consumption
 /// of this instance.
 /// When requested again, the skin resources will be loaded again automatically.
 /// </summary>
 /// <remarks>
 /// To invoke this method, use method <see cref="SkinManager.ReleaseSkinResources"/>.
 /// </remarks>
 internal virtual void Release()
 {
   _localResourceFilePaths = null;
   if (_localStyleResources != null)
     _localStyleResources.Dispose();
   _localStyleResources = null;
   ReleaseAllGUIModels();
   _inheritedSkinResources = null;
 }
Esempio n. 9
0
 public StyleResourceModelLoader(SkinResources parent)
 {
   _parent = parent;
 }
Esempio n. 10
0
 public void InstallSkinResources(SkinResources skinResources)
 {
   // Setup the resource chain and use the default skin as last fallback
   skinResources.SetupResourceChain(_skins, DefaultSkin);
   // Initialize SkinContext with new resource bundle
   SkinContext.SkinResources = skinResources;
   skinResources.InitializeStyleResourceLoading(); // Initializes the resource file dictionary
   Fonts.FontManager.Load(skinResources); // Needs an initialized resource file dictionary - loads font files
   skinResources.LoadAllStyleResources(); // Needs the FontManager
   // Notify others that we loaded a new skin or theme
   SkinResourcesMessaging.SendSkinResourcesMessage(SkinResourcesMessaging.MessageType.SkinOrThemeChanged);
 }