Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Hive-3.4/sources/HeuristicLab.Clients.Hive/3.4/ServiceClients/HiveItem.cs @ 5676

Last change on this file since 5676 was 5676, checked in by ascheibe, 13 years ago

#1233 worked on Administration UI

File size: 3.3 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2010 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.ComponentModel;
24using System.Drawing;
25using HeuristicLab.Common;
26using HeuristicLab.Core;
27
28namespace HeuristicLab.Clients.Hive {
29
30  public partial class HiveItem : IItem {
31
32    public HiveItem() {
33    }
34
35
36    protected HiveItem(HiveItem original, Cloner cloner) {
37      this.Id = original.Id;
38    }
39
40    public IDeepCloneable Clone(Cloner cloner) {
41      return new HiveItem(this, cloner);
42    }
43
44    public object Clone() {
45      return Clone(new Cloner());
46    }
47
48    protected void RaisePropertyChanged(string propertyName) {
49      OnPropertyChanged(new PropertyChangedEventArgs(propertyName));
50      if ((propertyName != "Id") && (propertyName != "Modified") && (propertyName != "ItemImage")) {
51        Modified = true;
52      }
53    }
54    protected virtual void OnPropertyChanged(PropertyChangedEventArgs e) {
55      PropertyChangedEventHandler handler = PropertyChanged;
56      if (handler != null) handler(this, e);
57    }
58
59    #region IItem Members
60    public string ItemName {
61      get { return ItemAttribute.GetName(this.GetType()); }
62    }
63    public string ItemDescription {
64      get { return ItemAttribute.GetDescription(this.GetType()); }
65    }
66    public Version ItemVersion {
67      get { return ItemAttribute.GetVersion(this.GetType()); }
68    }
69    public Image ItemImage {
70      get { return HeuristicLab.Common.Resources.VSImageLibrary.Class; }
71    }
72
73    private bool modified;
74    public bool Modified {
75      get { return modified; }
76      private set {
77        if (value != modified) {
78          modified = value;
79          OnModifiedChanged();
80          RaisePropertyChanged("Modified");
81          //OnItemImageChanged();             ??
82          //RaisePropertyChanged("ItemImage");  ??
83        }
84      }
85    }
86
87    public event EventHandler ItemImageChanged;
88    protected virtual void OnItemImageChanged() {
89      EventHandler handler = ItemImageChanged;
90      if (handler != null) handler(this, EventArgs.Empty);
91    }
92    public event EventHandler ToStringChanged;
93    protected virtual void OnToStringChanged() {
94      EventHandler handler = ToStringChanged;
95      if (handler != null) handler(this, EventArgs.Empty);
96    }
97    public event EventHandler ModifiedChanged;
98    protected virtual void OnModifiedChanged() {
99      EventHandler handler = ModifiedChanged;
100      if (handler != null) handler(this, EventArgs.Empty);
101    }
102    public override string ToString() {
103      return ItemName;
104    }
105    #endregion
106  }
107}
Note: See TracBrowser for help on using the repository browser.