source: trunk/CrypPlugins/Concatenate/ConcatenateSettings.cs @ 2263

Last change on this file since 2263 was 1259, checked in by Matthäus Wander, 12 years ago

shortened license text to boilerplate notice in all source files

File size: 3.0 KB
Line 
1/*
2   Copyright 2008 Thomas Schmid, University of Siegen
3
4   Licensed under the Apache License, Version 2.0 (the "License");
5   you may not use this file except in compliance with the License.
6   You may obtain a copy of the License at
7
8       http://www.apache.org/licenses/LICENSE-2.0
9
10   Unless required by applicable law or agreed to in writing, software
11   distributed under the License is distributed on an "AS IS" BASIS,
12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   See the License for the specific language governing permissions and
14   limitations under the License.
15*/
16
17using System;
18using System.Collections.Generic;
19using System.Linq;
20using System.Text;
21using Cryptool.PluginBase.IO;
22using Cryptool.PluginBase;
23using Cryptool.PluginBase.Miscellaneous;
24using System.ComponentModel;
25
26namespace Concatenate
27{
28  public class ConcatenateSettings : ISettings
29  {
30    public event GuiLogNotificationEventHandler OnGuiLogNotificationOccured;
31
32    public enum DataTypes
33    {
34      CryptoolStream, String, ByteArray, Boolean, Integer
35    }
36
37    private Concatenate MyConcatenate { get; set; }
38
39    public ConcatenateSettings(Concatenate concatenate)
40    {
41      MyConcatenate = concatenate;
42    }
43
44    public bool CanChangeProperty { get; set; }
45
46    private DataTypes currentDataType;
47    public DataTypes CurrentDataType
48    {
49      get { return currentDataType; }
50      set
51      {
52        if (currentDataType != value)
53        {
54          currentDataType = value;
55          MyConcatenate.CreateInputOutput(MyConcatenate.CanSendPropertiesChangedEvent);
56
57          // OnPropertyChanged("CurrentDataType");
58        }
59      }
60    }
61
62    [ContextMenu("Type", "Select DataType of plugin.", 0, DisplayLevel.Beginner, ContextMenuControlType.ComboBox, null, new string[] { "CryptoolStream", "string", "byte[]", "boolean", "int" })]
63    [TaskPane("Type", "Select DataType of plugin.", "", 0, false, DisplayLevel.Beginner, ControlType.ComboBox, new string[] { "CryptoolStream", "string", "byte[]", "boolean", "int" })]
64    public int DataType
65    {
66      get { return (int)CurrentDataType; }
67      set
68      {
69        if (CanChangeProperty)
70        {
71          if (value != (int)CurrentDataType) HasChanges = true;
72          CurrentDataType = (DataTypes)value;
73        }
74        else EventsHelper.GuiLogMessage(OnGuiLogNotificationOccured, null, new GuiLogEventArgs("Can't change type while plugin is connected.", null, NotificationLevel.Warning));
75        OnPropertyChanged("DataType");
76      }
77    }
78
79    #region ISettings Members
80    private bool hasChanges;
81    public bool HasChanges
82    {
83      get { return hasChanges; }
84      set { hasChanges = value; }
85    }
86    #endregion
87
88    #region INotifyPropertyChanged Members
89
90    public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
91
92    protected void OnPropertyChanged(string name)
93    {
94      EventsHelper.PropertyChanged(PropertyChanged, this, new PropertyChangedEventArgs(name));
95    }
96
97    #endregion
98  }
99}
Note: See TracBrowser for help on using the repository browser.