diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2019-04-10 14:38:10 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2019-04-10 14:38:10 +0300 |
| commit | 4f6dcbb46919167f2478fb70368fcf00ae52b2a8 (patch) | |
| tree | b4b4c80bf903a0bdbb6c3be6bd34fe41f735987b /Software/Visual_Studio/Scripting/Tango.Scripting.IDE/ProjectItem.cs | |
| parent | 3df4879fafbcac567e17a560e727935102f296cd (diff) | |
| parent | 254a8529c649da07f302db8ba1173be2153850e6 (diff) | |
| download | Tango-4f6dcbb46919167f2478fb70368fcf00ae52b2a8.tar.gz Tango-4f6dcbb46919167f2478fb70368fcf00ae52b2a8.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/Scripting/Tango.Scripting.IDE/ProjectItem.cs')
| -rw-r--r-- | Software/Visual_Studio/Scripting/Tango.Scripting.IDE/ProjectItem.cs | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Scripting/Tango.Scripting.IDE/ProjectItem.cs b/Software/Visual_Studio/Scripting/Tango.Scripting.IDE/ProjectItem.cs new file mode 100644 index 000000000..8adc26dc7 --- /dev/null +++ b/Software/Visual_Studio/Scripting/Tango.Scripting.IDE/ProjectItem.cs @@ -0,0 +1,57 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using System.Windows; +using System.Windows.Media.Imaging; +using Tango.Core; +using Tango.SharedUI.Helpers; + +namespace Tango.Scripting.IDE +{ + public abstract class ProjectItem : ExtendedObject, IProjectItem + { + private static Dictionary<String, BitmapSource> _imageCache; + + static ProjectItem() + { + _imageCache = new Dictionary<string, BitmapSource>(); + } + + public string Name { get; set; } + public ObservableCollection<IProjectItem> Items { get; set; } + + public ProjectItem() + { + Items = new ObservableCollection<IProjectItem>(); + } + + public abstract BitmapSource Image { get; } + + public abstract FrameworkElement OnGetView(); + + private FrameworkElement GetView() + { + return OnGetView(); + } + + protected static BitmapSource GetImage(String name) + { + if (_imageCache.ContainsKey(name)) + { + return _imageCache[name]; + } + else + { + var image = ResourceHelper.GetImageFromResources(name); + _imageCache.Add(name, image); + return image; + } + } + + public abstract bool CanOpen { get; } + public FrameworkElement View => GetView(); + } +} |
