aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.CodeGeneration/ICodeObject.cs
blob: 04423581314d440b86a11f0d9bc3f5c7e3febb6e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tango.CodeGeneration
{
    /// <summary>
    /// Represents a code object.
    /// </summary>
    public interface ICodeObject
    {
        /// <summary>
        /// Generates the code represented by this code object.
        /// </summary>
        String GenerateCode();

        /// <summary>
        /// Gets the template associated with this code object.
        /// </summary>
        String GetTemplate();
    }
}
="p">; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows; 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]); } } } } }