source: trunk/CrypPlugins/NumberGenerator/Generator.cs @ 2496

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

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

File size: 3.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 Cryptool.PluginBase.Generator;
22using Cryptool.PluginBase;
23using System.Windows.Controls;
24using System.ComponentModel;
25using Cryptool.PluginBase.IO;
26using System.Runtime.Remoting.Contexts;
27using Cryptool.PluginBase.Miscellaneous;
28
29namespace NumberGenerator
30{
31  [Author("Thomas Schmid", "thomas.schmid@cryptool.org", "Uni Siegen", "http://www.uni-siegen.de")]
32  [PluginInfo(true, "Number Input", "Simple number generator", null, "NumberGenerator/icon.png")]
33  public class Generator : IInput
34  {
35   
36    public Generator()
37    {
38      settings = new GeneratorSettings();
39      settings.PropertyChanged += settings_PropertyChanged;
40    }
41
42    void settings_PropertyChanged(object sender, PropertyChangedEventArgs e)
43    {
44      if (e.PropertyName == "IntegerStartValue")
45      {
46        IntegerValue = settings.IntegerStartValue;
47      }
48    }
49
50    #region properties
51
52    private int integerValue;
53    [PropertyInfo(Direction.OutputData, "Integer value.", "The generated ineteger value.", "", false, false, QuickWatchFormat.Text, null)]
54    public int IntegerValue
55    {
56      get { return integerValue; }
57      set 
58      {
59        if (value != integerValue)
60        {
61          integerValue = value;
62          OnPropertyChanged("IntegerValue");
63        }
64      }
65    }
66    #endregion properties
67
68    #region IPlugin Members
69    public event StatusChangedEventHandler OnPluginStatusChanged;
70    public event GuiLogNotificationEventHandler OnGuiLogNotificationOccured;
71    public event PluginProgressChangedEventHandler OnPluginProgressChanged;
72
73    private GeneratorSettings settings;
74    public ISettings Settings
75    {
76      get { return settings; }
77    }
78
79    public UserControl Presentation
80    {
81      get { return null; }
82    }
83
84    public UserControl QuickWatchPresentation
85    {
86      get { return null; }
87    }
88
89    public void PreExecution()
90    {
91    }
92
93    public void Execute()
94    {
95      EventsHelper.ProgressChanged(OnPluginProgressChanged, this, new PluginProgressEventArgs(50, 100));
96      OnPropertyChanged("IntegerValue");
97      EventsHelper.ProgressChanged(OnPluginProgressChanged, this, new PluginProgressEventArgs(100, 100));
98    }
99
100    public void PostExecution()
101    {
102     
103    }
104
105    public void Pause()
106    {
107     
108    }
109
110    public void Stop()
111    {
112     
113    }
114
115    public void Initialize()
116    {
117     
118    }
119
120    public void Dispose()
121    {
122     
123    }
124
125    #endregion
126
127    #region INotifyPropertyChanged Members
128
129    public event PropertyChangedEventHandler PropertyChanged;
130
131    #endregion
132
133    # region helperMethods
134    public void OnPropertyChanged(string name)
135    {
136      EventsHelper.PropertyChanged(PropertyChanged, this, new PropertyChangedEventArgs(name));
137    }
138
139    private void GuiLogMessage(string message, NotificationLevel logLevel)
140    {
141      EventsHelper.GuiLogMessage(OnGuiLogNotificationOccured, this, new GuiLogEventArgs(message, this, logLevel));
142    }
143    #endregion
144  }
145}
Note: See TracBrowser for help on using the repository browser.