source: trunk/CrypPlugins/CrypPluginTemplate/ExamplePluginCT2Settings.cs @ 1507

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

Updated plugin template. The template shall become the default way to create a new CT2 plugin.

File size: 2.7 KB
Line 
1/* HOWTO: Change year, author name and organization.
2   Copyright 2010 Your Name, University of Duckburg
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*/
16using System;
17using System.Collections.Generic;
18using System.Linq;
19using System.Text;
20using Cryptool.PluginBase;
21using System.ComponentModel;
22
23namespace Cryptool.Plugin
24{
25    public class ExamplePluginCT2Settings : ISettings
26    {
27        #region Private Variables
28
29        private bool hasChanges = false;
30        private int subtrahend = 0;
31
32        #endregion
33
34        #region TaskPane Settings
35
36        /// <summary>
37        /// HOWTO: This is an example for a setting entity shown in the settings pane on the right of the CT2 main window.
38        /// This example setting uses a number field input, but there are many more input types available, see ControlType enumeration.
39        /// </summary>
40        [TaskPane("Subtrahend", "Amount to subtract from input number", null, 1, false, DisplayLevel.Beginner, ControlType.NumericUpDown, ValidationType.RangeInteger, 0, Int32.MaxValue)]
41        public int Subtrahend
42        {
43            get
44            {
45                return subtrahend;
46            }
47            set
48            {
49                // HOWTO: If a setting changes, you must set hasChanges manually to true.
50                if (subtrahend != value)
51                {
52                    subtrahend = value;
53                    hasChanges = true;
54                }
55            }
56        }
57
58        #endregion
59
60        #region ISettings Members
61
62        /// <summary>
63        /// HOWTO: This flags indicates whether some setting has been changed since the last save.
64        /// If a property was changed, this becomes true, hence CrypTool will ask automatically if you want to save your changes.
65        /// </summary>
66        public bool HasChanges
67        {
68            get
69            {
70                return hasChanges;
71            }
72            set
73            {
74                hasChanges = value;
75            }
76        }
77
78        #endregion
79
80        #region INotifyPropertyChanged Members
81
82        public event PropertyChangedEventHandler PropertyChanged;
83
84        #endregion
85    }
86}
Note: See TracBrowser for help on using the repository browser.