#region License Information
/* HeuristicLab
* Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
*
* This file is part of HeuristicLab.
*
* HeuristicLab is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* HeuristicLab is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with HeuristicLab. If not, see .
*/
#endregion
using System;
using System.ComponentModel;
using HeuristicLab.Clients.Common;
using HeuristicLab.Common;
using HeuristicLab.Core;
using HeuristicLab.PluginInfrastructure;
namespace HeuristicLab.Clients.OKB {
[Item("AlgorithmClass", "An OKB algorithm class.")]
public partial class AlgorithmClass : OKBItem, INamedOKBItem {
public AlgorithmClass() {
Name = "New Algorithm Class";
PropertyChanged += new PropertyChangedEventHandler(OnPropertyChanged);
}
public override IDeepCloneable Clone(Cloner cloner) {
AlgorithmClass clone = new AlgorithmClass();
cloner.RegisterClonedObject(this, clone);
clone.Name = Name;
clone.Description = Description;
clone.Algorithms = (ItemCollection)cloner.Clone(Algorithms);
return clone;
}
public override string ToString() {
return Name;
}
public override void Store() {
using (AdminServiceClient adminService = ClientFactory.CreateClient()) {
try {
adminService.StoreAlgorithmClass(this);
}
catch (Exception ex) {
ErrorHandling.ShowErrorDialog(ex);
}
}
}
private void OnPropertyChanged(object sender, PropertyChangedEventArgs e) {
if (e.PropertyName.Equals("Name"))
OnToStringChanged();
}
}
}