示例#1
0
 static AdornerResources()
 {
     SystemEvents.UserPreferenceChanged += (UserPreferenceChangedEventHandler)((sender, e) =>
     {
         if (!AdornerResources._themeInUse || !AdornerResources.IsResourceCategory(e.Category))
         {
             return;
         }
         AdornerResources.EnsureResources(true);
     });
 }
示例#2
0
        public static object FindResource(ResourceKey key)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }
            object resource;

            if (AdornerResources.FindResourceHelper(key, out resource))
            {
                return(resource);
            }
            if (AdornerResources._queryElement == null)
            {
                AdornerResources._queryElement = new FrameworkElement();
            }
            return(AdornerResources._queryElement.FindResource((object)key));
        }
示例#3
0
 private static FontFamily GetFontFamily(ResourceKey key)
 {
     return((FontFamily)AdornerResources.FindResource(key));
 }
示例#4
0
 private static double GetFontSize(ResourceKey key)
 {
     return((double)AdornerResources.FindResource(key));
 }
示例#5
0
 private static ResourceKey CreateKey(string name)
 {
     return(AdornerResources.CreateResourceKey(typeof(AdornerFonts), name));
 }
示例#6
0
 static AdornerFonts()
 {
     AdornerResources.RegisterResources((LoadResourcesCallback)(() => (ResourceDictionary) new AdornerFontResourceDictionary()));
 }
示例#7
0
 private static Color GetColor(ResourceKey key)
 {
     return((Color)AdornerResources.FindResource(key));
 }
示例#8
0
 private static Brush GetBrush(ResourceKey key)
 {
     return((Brush)AdornerResources.FindResource(key));
 }
示例#9
0
 public static void Refresh()
 {
     AdornerResources.EnsureResources(true);
 }