source: trunk/CrypPlugins/Dictionary/DictionarySettings.cs @ 1785

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

shortened license text to boilerplate notice in all source files

File size: 2.7 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 System.Windows.Controls;
22using Cryptool.PluginBase;
23using System.ComponentModel;
24using System.Collections.ObjectModel;
25using System.IO;
26using Cryptool.PluginBase.Miscellaneous;
27
28namespace Dictionary
29{
30  public class CryptoolDictionarySettings : ISettings
31  {
32    # region private_variables
33    private int currentDictionary;
34    private ObservableCollection<string> collection = new ObservableCollection<string>();
35    # endregion private_variables
36
37    public delegate void ExecuteCallback();
38
39    public CryptoolDictionarySettings()
40    {
41    }
42
43    [TaskPane("Dictionary", "Select dictionary with keywords.", "", 0, true, DisplayLevel.Beginner, ControlType.DynamicComboBox, new string[] { "Collection" })]
44    public int Dictionary
45    {
46      get { return currentDictionary; }
47      set
48      {
49        if (value != currentDictionary)
50        {
51          HasChanges = true;
52          this.currentDictionary = value;
53          OnPropertyChanged("Dictionary");
54        }
55      }
56    }
57
58    // CrypWin requires this to be a collection of strings
59    [DontSave]
60    public ObservableCollection<string> Collection
61    {
62      get { return collection; }
63      set
64      {
65        if (value != collection)
66        {
67          collection = value;
68        }
69        OnPropertyChanged("Collection");
70      }
71    }
72
73    #region ISettings Members
74
75    private bool hasChanges;
76    public bool HasChanges
77    {
78      get { return hasChanges; }
79      set
80      {
81        if (value != hasChanges)
82        {
83          hasChanges = value;
84          OnPropertyChanged("HasChanges");
85        }
86      }
87    }
88
89    #endregion
90
91    #region INotifyPropertyChanged Members
92
93    public event PropertyChangedEventHandler PropertyChanged;
94
95    protected void OnPropertyChanged(string name)
96    {
97        if (PropertyChanged != null)
98        {
99            PropertyChanged(this, new PropertyChangedEventArgs(name));
100        }
101    }
102
103    #endregion
104 
105  }
106}
Note: See TracBrowser for help on using the repository browser.