aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Modules/Tango.MachineStudio.RML/Properties/AssemblyInfo.cs
blob: 062f0ace5080ffd1472a98b23653a40e530054cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;

[assembly: AssemblyTitle("Tango - Machine Studio RML Module")]
[assembly: AssemblyVersion("2.0.11.1737")]

[assembly: ComVisible(false)]

[assembly: ThemeInfo(
    ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
                                     //(used if a resource is not found in the page,
                                     // or application resource dictionaries)
    ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
                                              //(used if a resource is not found in the page,
                                              // app, or any theme specific resource dictionaries)
)]
n>; using Tango.Settings; namespace Tango.MachineStudio.Common.Resources { /// <summary> /// The shared resource dictionary is a specialized resource dictionary /// that loads it content only once. If a second instance with the same source /// is created, it only merges the resources from the cache. /// </summary> public class SharedResourceDictionary : ResourceDictionary { /// <summary> /// Internal cache of loaded dictionaries /// </summary> public static Dictionary<Uri, ResourceDictionary> _sharedDictionaries = new Dictionary<Uri, ResourceDictionary>(); /// <summary> /// Local member of the source uri /// </summary> private Uri _sourceUri; /// <summary> /// Gets or sets the uniform resource identifier (URI) to load resources from. /// </summary> public new Uri Source { get { return _sourceUri; } set { _sourceUri = value; var settings = SettingsManager.Default.GetOrCreate<MachineStudioSettings>(); //add current theme MachineStudioTheme wTheme = settings.Theme; if ((wTheme == MachineStudioTheme.Dark && value.LocalPath.Contains("Light")) || (wTheme == MachineStudioTheme.Light && value.LocalPath.Contains("Dark"))) return; if (!_sharedDictionaries.ContainsKey(value)) { // If the dictionary is not yet loaded, load it by setting // the source of the base class base.Source = value; // add it to the cache _sharedDictionaries.Add(value, this); } else { // If the dictionary is already loaded, get it from the cache MergedDictionaries.Add(_sharedDictionaries[value]); } } } } }