source: trunk/CrypPlugins/Converter/ConverterSettings.cs @ 679

Last change on this file since 679 was 679, checked in by falk, 12 years ago

converter can do a lot more now.

File size: 4.1 KB
Line 
1/*                             
2   Copyright 2009 Team CrypTool (Sven Rech,Dennis Nolte,Raoul Falk,Nils Kopal), Uni Duisburg-Essen
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.ComponentModel;
20using System.Linq;
21using System.Text;
22using System.Windows;
23using System.Windows.Media;
24using System.Windows.Controls;
25using Cryptool.PluginBase;
26
27namespace Cryptool.Plugins.Converter
28{
29    public class ConverterSettings : ISettings
30    {
31        #region private variables
32        private int converter = 9; // 0 = String, 1 = int, 2 = short, 3 = byte, 4 = double, 5 = bigInteger, 6= Int[] , 7=Byte[], 8=CryptoolStream, 9 = default
33        private bool hasChanges;
34        private bool numeric = false;
35        private bool formatAmer = false;
36        #endregion
37
38        #region taskpane
39     //   [ContextMenu("Numeric Interpretation", "Choose whether inputs are treated as numeric values if possible", 1, DisplayLevel.Beginner, ContextMenuControlType.ComboBox, new int[] { 1, 2 }, "numeric", "non numeric")]
40        [TaskPane("Converter", "Choose the output type", null, 1, false, DisplayLevel.Beginner, ControlType.ComboBox, new string[] { "string", "int", "short", "byte", "double", "BigInteger", "int[]", "byte[]","Cryptoolstream" })]
41       
42     
43        public int Converter
44        {
45            get { return this.converter; }
46            set
47            {
48                if (value != this.converter)
49                {
50                    this.converter = value;
51                    OnPropertyChanged("Converter");
52                    HasChanges = true;
53
54                   ChangePluginIcon(converter+1);
55                }
56            }
57        }
58        [TaskPane("Numeric", "Choose whether inputs are interpreted as numeric values if possible", null, 1, false, DisplayLevel.Beginner, ControlType.ComboBox, new string[] { "no", "yes" })]
59        public bool Numeric
60        {
61            get { return this.numeric; }
62            set
63            {
64                if (value != this.numeric)
65                {
66                    this.numeric = value;
67                    OnPropertyChanged("Numeric");
68                    HasChanges = true;
69                }
70            }
71        }
72
73        [TaskPane("Format", "Choose whether double values are recognized via german or american syntax. German: \"123.345.34,34\" American: \"123,345,34.34 ", null, 1, false, DisplayLevel.Beginner, ControlType.ComboBox, new string[] { "german", "american" })]
74        public bool FormatAmer
75        {
76            get { return this.formatAmer; }
77            set
78            {
79                if (value != this.formatAmer)
80                {
81                    this.formatAmer = value;
82                    OnPropertyChanged("Format");
83                    HasChanges = true;
84                }
85            }
86        }
87        #endregion
88
89        #region ISettings Member
90
91        public bool HasChanges
92        {
93            get { return hasChanges; }
94            set { hasChanges = value; }
95
96        }
97
98        #endregion
99
100        #region INotifyPropertyChanged Member
101
102        public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;
103
104        protected void OnPropertyChanged(string name)
105        {
106
107        }
108        public event StatusChangedEventHandler OnPluginStatusChanged;
109        private void ChangePluginIcon(int iconIndex)
110        {
111            if (OnPluginStatusChanged != null) OnPluginStatusChanged(null, new StatusEventArgs(StatusChangedMode.ImageUpdate, iconIndex));
112        }
113        #endregion
114    }
115}
Note: See TracBrowser for help on using the repository browser.