source: trunk/CrypPlugins/PrimesGenerator/PrimesGeneratorSettings.cs @ 2527

Last change on this file since 2527 was 2334, checked in by Matthäus Wander, 11 years ago

removed 1006 occurences of DisplayLevel in 218 files (see #122)

File size: 2.0 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.Linq;
4using System.Text;
5using Cryptool.PluginBase;
6
7namespace Cryptool.PrimesGenerator
8{
9  public class PrimesGeneratorSettings: ISettings
10  {
11    public const string MODE = "Mode";
12    public const string INPUT = "Input";
13
14    #region ISettings Members
15
16    private bool m_HasChanges = false;
17   
18    [PropertySaveOrder(0)]
19    public bool HasChanges
20    {
21      get
22      {
23        return m_HasChanges;
24      }
25      set
26      {
27        m_HasChanges = value;
28      }
29    }
30
31    #endregion
32
33
34    #region Properties
35
36    private int m_SelectedMode;
37    [PropertySaveOrder(1)]
38    [ContextMenu("Mode", "Select ", 1, ContextMenuControlType.ComboBox, null, new string[] { "A Primenumber with n digits", "A Primenumber less or equal than n" })]
39    [TaskPane("Mode", "Select ", null, 1, false, ControlType.ComboBox, new string[] { "A Primenumber with n digits", "A Primenumber less or equal than n" })]
40    public int Mode
41    {
42      get { return this.m_SelectedMode; }
43      set
44      {
45        if (value != m_SelectedMode) HasChanges = true;
46        this.m_SelectedMode = value;
47        FirePropertyChangedEvent(MODE);
48      }
49    }
50
51    private string m_Input;
52    [PropertySaveOrder(2)]
53    [TaskPane("Value of n", "The value of n.", null, 2, false, ControlType.TextBox, ValidationType.RegEx, "[1-9][0-9]+")]
54    public string Input
55    {
56      get { if(string.IsNullOrEmpty(this.m_Input)) return "100"; else return m_Input; }
57      set
58      {
59        if (value != m_Input) HasChanges = true;
60        this.m_Input = value;
61        FirePropertyChangedEvent(INPUT);
62      }
63    }
64
65    #endregion
66
67    #region INotifyPropertyChanged Members
68
69    public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
70
71    private void FirePropertyChangedEvent(string propertyName)
72    {
73      if (PropertyChanged != null) PropertyChanged(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
74    }
75    #endregion
76  }
77}
Note: See TracBrowser for help on using the repository browser.