Changeset 2931 for trunk/sources
- Timestamp:
- 03/05/10 01:03:30 (15 years ago)
- Location:
- trunk/sources
- Files:
-
- 1 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core/3.3/Attributes/CreatableAttribute.cs
r2790 r2931 21 21 22 22 using System; 23 using System.Collections.Generic;24 using System.Text;25 23 26 24 namespace HeuristicLab.Core { -
trunk/sources/HeuristicLab.Core/3.3/Attributes/ItemAttribute.cs
r2790 r2931 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using System.Text; 25 using System.Resources; 26 using System.Drawing; 23 using HeuristicLab.Common; 27 24 28 25 namespace HeuristicLab.Core { 29 26 [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)] 30 27 public sealed class ItemAttribute : Attribute { 31 public string Name { get; set; } 32 public string Description { get; set; } 28 private string name; 29 public string Name { 30 get { return name; } 31 set { name = value == null ? string.Empty : value; } 32 } 33 private string description; 34 public string Description { 35 get { return description; } 36 set { description = value == null ? string.Empty : value; } 37 } 33 38 34 39 public ItemAttribute() { 35 Name = null;36 Description = null;40 Name = string.Empty; 41 Description = string.Empty; 37 42 } 38 43 public ItemAttribute(string name, string description) { … … 42 47 43 48 public static string GetName(Type type) { 44 object[] attribs = type.GetCustomAttributes(typeof(ItemAttribute), true);49 object[] attribs = type.GetCustomAttributes(typeof(ItemAttribute), false); 45 50 if (attribs.Length > 0) return ((ItemAttribute)attribs[0]).Name; 46 else return null;51 else return type.GetPrettyName(); 47 52 } 48 53 public static string GetDescription(Type type) { 49 object[] attribs = type.GetCustomAttributes(typeof(ItemAttribute), true);54 object[] attribs = type.GetCustomAttributes(typeof(ItemAttribute), false); 50 55 if (attribs.Length > 0) return ((ItemAttribute)attribs[0]).Description; 51 else return null;56 else return string.Empty; 52 57 } 53 58 } -
trunk/sources/HeuristicLab.Core/3.3/NamedItem.cs
r2851 r2931 21 21 22 22 using System; 23 using System.Collections.Generic; 24 using System.Text; 25 using System.Xml; 23 using HeuristicLab.Common; 26 24 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 27 using HeuristicLab.Common;28 25 29 26 namespace HeuristicLab.Core { … … 38 35 get { return name; } 39 36 set { 40 if (!CanChangeName) throw new NotSupportedException("Name of NamedItem cannot be changed."); 41 if (value == null) throw new ArgumentNullException(); 42 if (!name.Equals(value)) { 43 CancelEventArgs<string> e = new CancelEventArgs<string>(value); 37 if (!CanChangeName) throw new NotSupportedException("Name cannot be changed."); 38 if (!(name.Equals(value) || (value == null) && (name == string.Empty))) { 39 CancelEventArgs<string> e = value == null ? new CancelEventArgs<string>(string.Empty) : new CancelEventArgs<string>(value); 44 40 OnNameChanging(e); 45 41 if (!e.Cancel) { 46 name = value ;42 name = value == null ? string.Empty : value; 47 43 OnNameChanged(); 48 44 } … … 58 54 get { return description; } 59 55 set { 60 if (!CanChangeDescription) throw new NotSupportedException("Description of NamedItemcannot be changed.");61 if ( (description == null) || (!description.Equals(value))) {62 description = value ;56 if (!CanChangeDescription) throw new NotSupportedException("Description cannot be changed."); 57 if (!(description.Equals(value) || (value == null) && (description == string.Empty))) { 58 description = value == null ? string.Empty : value; 63 59 OnDescriptionChanged(); 64 60 } … … 84 80 /// <param name="value">The value of the current instance.</param> 85 81 protected NamedItem(string name) { 86 if (name == null) th row new ArgumentNullException();87 this.name = name;82 if (name == null) this.name = string.Empty; 83 else this.name = name; 88 84 description = string.Empty; 89 85 } 90 86 protected NamedItem(string name, string description) { 91 if (name == null) throw new ArgumentNullException(); 92 this.name = name; 93 this.description = description; 87 if (name == null) this.name = string.Empty; 88 else this.name = name; 89 if (description == null) this.description = string.Empty; 90 else this.description = description; 94 91 } 95 92 -
trunk/sources/HeuristicLab.Core/3.3/Scope.cs
r2830 r2931 82 82 SubScopes = new ScopeList(); 83 83 } 84 public Scope(string name, string description) 85 : base(name, description) { 86 parent = null; 87 Variables = new VariableCollection(); 88 SubScopes = new ScopeList(); 89 } 84 90 85 91 /// <inheritdoc/> -
trunk/sources/HeuristicLab.Optimizer/3.3/HeuristicLab.Optimizer-3.3.csproj
r2900 r2931 95 95 <Compile Include="MenuItems\OpenMenuItem.cs" /> 96 96 <Compile Include="MenuItems\ExitMenuItem.cs" /> 97 <Compile Include="HeuristicLabOptimizerApplication.cs" />98 97 <Compile Include="HeuristicLabOptimizerPlugin.cs" /> 99 98 <Compile Include="IOptimizerUserInterfaceItemProvider.cs" /> -
trunk/sources/HeuristicLab.Optimizer/3.3/HeuristicLabOptimizerPlugin.cs.frame
r2790 r2931 20 20 #endregion 21 21 22 using System.Windows.Forms; 22 23 using HeuristicLab.PluginInfrastructure; 23 24 … … 33 34 public class HeuristicLabOptimizerPlugin : PluginBase { 34 35 } 36 37 [Application("Optimizer", "HeuristicLab Optimizer 3.3.0.$WCREV$")] 38 internal class HeuristicLabOptimizerApplication : ApplicationBase { 39 public override void Run() { 40 OptimizerMainForm mainForm = new OptimizerMainForm(typeof(IOptimizerUserInterfaceItemProvider)); 41 Application.Run(mainForm); 42 } 43 } 35 44 } -
trunk/sources/HeuristicLab.Optimizer/3.3/OptimizerMainForm.cs
r2791 r2931 21 21 22 22 using System; 23 using System.Linq; 23 24 using System.Reflection; 24 25 using System.Windows.Forms; … … 41 42 protected override void OnInitialized(EventArgs e) { 42 43 base.OnInitialized(e); 43 Title = "HeuristicLab Optimizer " + Assembly.GetExecutingAssembly().GetName().Version.ToString(); 44 AssemblyFileVersionAttribute version = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(AssemblyFileVersionAttribute), true). 45 Cast<AssemblyFileVersionAttribute>().FirstOrDefault(); 46 Title = "HeuristicLab Optimizer"; 47 if (version != null) Title += " " + version.Version; 44 48 ViewClosed += new EventHandler<ViewEventArgs>(FileManager.ViewClosed); 45 49 OperatorsSidebar operatorsSidebar = new OperatorsSidebar(); -
trunk/sources/HeuristicLab.Parameters/3.3/ValueParameter.cs
r2924 r2931 45 45 46 46 public override IDeepCloneable Clone(Cloner cloner) { 47 ValueParameter<T> clone = new ValueParameter<T>( name, description, Value);47 ValueParameter<T> clone = new ValueParameter<T>(Name, Description, Value); 48 48 cloner.RegisterClonedObject(this, clone); 49 49 clone.Value = (T)cloner.Clone(Value); -
trunk/sources/HeuristicLab.Persistence.GUI/3.3/HeuristicLabPersistenceGUIPlugin.cs.frame
r2754 r2931 10 10 11 11 12 [Application("Persistence Configuration" )]12 [Application("Persistence Configuration", "Configure type mappings of persistence")] 13 13 public class HeuristicLabPersistenceGUIApplication : ApplicationBase { 14 14 public override void Run() {
Note: See TracChangeset
for help on using the changeset viewer.