Changeset 7213 for branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3
- Timestamp:
- 12/20/11 11:45:18 (13 years ago)
- Location:
- branches/HeuristicLab.TimeSeries
- Files:
-
- 19 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HeuristicLab.TimeSeries
-
branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Attributes/ItemAttribute.cs
r5445 r7213 21 21 22 22 using System; 23 using System.Drawing; 23 24 using System.Linq; 24 25 using System.Reflection; … … 82 83 } 83 84 } 85 public static Image GetImage(Type type) { 86 var staticItemImageProperty = type.GetProperty("StaticItemImage", BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy); 87 return staticItemImageProperty == null ? null : (Image)staticItemImageProperty.GetValue(null, null); 88 } 84 89 } 85 90 } -
branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Collections/ItemArray.cs
r5445 r7213 26 26 using HeuristicLab.Collections; 27 27 using HeuristicLab.Common; 28 using HeuristicLab.Common.Resources;29 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 29 … … 42 41 get { return ItemAttribute.GetVersion(this.GetType()); } 43 42 } 43 public static Image StaticItemImage { 44 get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; } 45 } 44 46 public virtual Image ItemImage { 45 get { return VSImageLibrary.Class; }47 get { return ItemAttribute.GetImage(this.GetType()); } 46 48 } 47 49 -
branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Collections/ItemCollection.cs
r5445 r7213 26 26 using HeuristicLab.Collections; 27 27 using HeuristicLab.Common; 28 using HeuristicLab.Common.Resources;29 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 29 … … 42 41 get { return ItemAttribute.GetVersion(this.GetType()); } 43 42 } 43 public static Image StaticItemImage { 44 get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; } 45 } 44 46 public virtual Image ItemImage { 45 get { return VSImageLibrary.Class; }47 get { return ItemAttribute.GetImage(this.GetType()); } 46 48 } 47 49 -
branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Collections/ItemDictionary.cs
r5445 r7213 25 25 using HeuristicLab.Collections; 26 26 using HeuristicLab.Common; 27 using HeuristicLab.Common.Resources;28 27 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 28 … … 44 43 get { return ItemAttribute.GetVersion(this.GetType()); } 45 44 } 45 public static Image StaticItemImage { 46 get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; } 47 } 46 48 public virtual Image ItemImage { 47 get { return VSImageLibrary.Class; }49 get { return ItemAttribute.GetImage(this.GetType()); } 48 50 } 49 51 -
branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Collections/ItemList.cs
r5445 r7213 26 26 using HeuristicLab.Collections; 27 27 using HeuristicLab.Common; 28 using HeuristicLab.Common.Resources;29 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 29 … … 42 41 get { return ItemAttribute.GetVersion(this.GetType()); } 43 42 } 43 public static Image StaticItemImage { 44 get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; } 45 } 44 46 public virtual Image ItemImage { 45 get { return VSImageLibrary.Class; }47 get { return ItemAttribute.GetImage(this.GetType()); } 46 48 } 47 49 -
branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Collections/ItemSet.cs
r6525 r7213 26 26 using HeuristicLab.Collections; 27 27 using HeuristicLab.Common; 28 using HeuristicLab.Common.Resources;29 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 29 … … 42 41 get { return ItemAttribute.GetVersion(this.GetType()); } 43 42 } 43 public static Image StaticItemImage { 44 get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; } 45 } 44 46 public virtual Image ItemImage { 45 get { return VSImageLibrary.Class; }47 get { return ItemAttribute.GetImage(this.GetType()); } 46 48 } 47 49 -
branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Collections/KeyedItemCollection.cs
r5445 r7213 40 40 get { return ItemAttribute.GetVersion(this.GetType()); } 41 41 } 42 public static Image StaticItemImage { 43 get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; } 44 } 42 45 public virtual Image ItemImage { 43 get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; }46 get { return ItemAttribute.GetImage(this.GetType()); } 44 47 } 45 48 -
branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Collections/ReadOnlyItemArray.cs
r5445 r7213 24 24 using HeuristicLab.Collections; 25 25 using HeuristicLab.Common; 26 using HeuristicLab.Common.Resources;27 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 27 … … 40 39 get { return ItemAttribute.GetVersion(this.GetType()); } 41 40 } 41 public static Image StaticItemImage { 42 get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; } 43 } 42 44 public virtual Image ItemImage { 43 get { return VSImageLibrary.Class; }45 get { return ItemAttribute.GetImage(this.GetType()); } 44 46 } 45 47 -
branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Collections/ReadOnlyItemCollection.cs
r5445 r7213 24 24 using HeuristicLab.Collections; 25 25 using HeuristicLab.Common; 26 using HeuristicLab.Common.Resources;27 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 27 … … 40 39 get { return ItemAttribute.GetVersion(this.GetType()); } 41 40 } 41 public static Image StaticItemImage { 42 get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; } 43 } 42 44 public virtual Image ItemImage { 43 get { return VSImageLibrary.Class; }45 get { return ItemAttribute.GetImage(this.GetType()); } 44 46 } 45 47 -
branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Collections/ReadOnlyItemDictionary.cs
r5445 r7213 24 24 using HeuristicLab.Collections; 25 25 using HeuristicLab.Common; 26 using HeuristicLab.Common.Resources;27 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 27 … … 43 42 get { return ItemAttribute.GetVersion(this.GetType()); } 44 43 } 44 public static Image StaticItemImage { 45 get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; } 46 } 45 47 public virtual Image ItemImage { 46 get { return VSImageLibrary.Class; }48 get { return ItemAttribute.GetImage(this.GetType()); } 47 49 } 48 50 -
branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Collections/ReadOnlyItemList.cs
r5445 r7213 24 24 using HeuristicLab.Collections; 25 25 using HeuristicLab.Common; 26 using HeuristicLab.Common.Resources;27 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 27 … … 40 39 get { return ItemAttribute.GetVersion(this.GetType()); } 41 40 } 41 public static Image StaticItemImage { 42 get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; } 43 } 42 44 public virtual Image ItemImage { 43 get { return VSImageLibrary.Class; }45 get { return ItemAttribute.GetImage(this.GetType()); } 44 46 } 45 47 -
branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Collections/ReadOnlyItemSet.cs
r5445 r7213 24 24 using HeuristicLab.Collections; 25 25 using HeuristicLab.Common; 26 using HeuristicLab.Common.Resources;27 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 27 … … 40 39 get { return ItemAttribute.GetVersion(this.GetType()); } 41 40 } 41 public static Image StaticItemImage { 42 get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; } 43 } 42 44 public virtual Image ItemImage { 43 get { return VSImageLibrary.Class; }45 get { return ItemAttribute.GetImage(this.GetType()); } 44 46 } 45 47 -
branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Collections/ReadOnlyKeyedItemCollection.cs
r5445 r7213 24 24 using HeuristicLab.Collections; 25 25 using HeuristicLab.Common; 26 using HeuristicLab.Common.Resources;27 26 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 28 27 … … 40 39 get { return ItemAttribute.GetVersion(this.GetType()); } 41 40 } 41 public static Image StaticItemImage { 42 get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; } 43 } 42 44 public virtual Image ItemImage { 43 get { return VSImageLibrary.Class; }45 get { return ItemAttribute.GetImage(this.GetType()); } 44 46 } 45 47 -
branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Executable.cs
r5445 r7213 29 29 [StorableClass] 30 30 public abstract class Executable : Item, IExecutable { 31 public static new Image StaticItemImage { 32 get { return HeuristicLab.Common.Resources.VSImageLibrary.Event; } 33 } 31 34 public override Image ItemImage { 32 35 get { … … 35 38 else if (ExecutionState == ExecutionState.Paused) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutablePaused; 36 39 else if (ExecutionState == ExecutionState.Stopped) return HeuristicLab.Common.Resources.VSImageLibrary.ExecutableStopped; 37 else return HeuristicLab.Common.Resources.VSImageLibrary.Event;40 else return base.ItemImage; 38 41 } 39 42 } -
branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Item.cs
r5445 r7213 41 41 get { return ItemAttribute.GetVersion(this.GetType()); } 42 42 } 43 public static Image StaticItemImage { 44 get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; } 45 } 43 46 public virtual Image ItemImage { 44 get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; }47 get { return ItemAttribute.GetImage(this.GetType()); } 45 48 } 46 49 -
branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Log.cs
r6862 r7213 33 33 public string Filename { get; set; } 34 34 35 public override ImageItemImage {35 public static new Image StaticItemImage { 36 36 get { return HeuristicLab.Common.Resources.VSImageLibrary.File; } 37 37 } -
branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/Scope.cs
r5445 r7213 32 32 [StorableClass] 33 33 public sealed class Scope : NamedItem, IScope { 34 public override ImageItemImage {34 public static new Image StaticItemImage { 35 35 get { return HeuristicLab.Common.Resources.VSImageLibrary.OrgChart; } 36 36 } -
branches/HeuristicLab.TimeSeries/HeuristicLab.Core/3.3/ThreadSafeLog.cs
r6862 r7213 30 30 [Item("ThreadSafeLog", "A thread-safe log for logging string messages.")] 31 31 [StorableClass] 32 public class ThreadSafeLog : Log, IDeepCloneable{33 pr otectedReaderWriterLockSlim locker = new ReaderWriterLockSlim();32 public sealed class ThreadSafeLog : Log { 33 private ReaderWriterLockSlim locker = new ReaderWriterLockSlim(); 34 34 35 35 public override IEnumerable<string> Messages { … … 38 38 try { 39 39 return messages.ToArray(); // return copy of messages 40 } 41 finally { locker.ExitReadLock(); } 40 } finally { locker.ExitReadLock(); } 42 41 } 43 42 } 44 43 45 44 [StorableConstructor] 46 pr otectedThreadSafeLog(bool deserializing) : base(deserializing) { }45 private ThreadSafeLog(bool deserializing) : base(deserializing) { } 47 46 public ThreadSafeLog(long maxMessageCount = -1) 48 47 : base(maxMessageCount) { 49 48 } 50 49 51 protected ThreadSafeLog(ThreadSafeLog original, Cloner cloner) { 52 original.locker.EnterReadLock(); 53 try { 54 cloner.RegisterClonedObject(original, this); 55 this.messages = new List<string>(original.messages); 56 this.maxMessageCount = original.maxMessageCount; 57 } 58 finally { original.locker.ExitReadLock(); } 59 } 50 private ThreadSafeLog(ThreadSafeLog original, Cloner cloner) 51 : base(original, cloner) { } 60 52 61 53 public override IDeepCloneable Clone(Cloner cloner) { 62 return new ThreadSafeLog(this, cloner); 54 locker.EnterReadLock(); 55 try { 56 return new ThreadSafeLog(this, cloner); 57 } finally { locker.ExitReadLock(); } 63 58 } 64 59 … … 67 62 try { 68 63 messages.Clear(); 69 } 70 finally { locker.ExitWriteLock(); } 64 } finally { locker.ExitWriteLock(); } 71 65 OnCleared(); 72 66 } … … 78 72 messages.Add(s); 79 73 CapMessages(); 80 } 81 finally { locker.ExitWriteLock(); } 74 } finally { locker.ExitWriteLock(); } 82 75 OnMessageAdded(s); 83 76 } … … 89 82 messages.Add(s); 90 83 CapMessages(); 91 } 92 finally { locker.ExitWriteLock(); } 84 } finally { locker.ExitWriteLock(); } 93 85 OnMessageAdded(s); 94 86 }
Note: See TracChangeset
for help on using the changeset viewer.