PageRenderTime 15ms CodeModel.GetById 9ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/CodeMaid/UI/Dialogs/Options/Digging/DiggingViewModel.cs

https://bitbucket.org/s_cadwallader/codemaid
C# | 266 lines | 179 code | 33 blank | 54 comment | 20 complexity | dbe7b8133376102be037341cf3f580c3 MD5 | raw file
Possible License(s): LGPL-3.0
  1#region CodeMaid is Copyright 2007-2013 Steve Cadwallader.
  2
  3// CodeMaid is free software: you can redistribute it and/or modify
  4// it under the terms of the GNU Lesser General Public License version 3
  5// as published by the Free Software Foundation.
  6//
  7// CodeMaid is distributed in the hope that it will be useful,
  8// but WITHOUT ANY WARRANTY; without even the implied warranty of
  9// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 10// GNU Lesser General Public License for more details <http://www.gnu.org/licenses/>.
 11
 12#endregion CodeMaid is Copyright 2007-2013 Steve Cadwallader.
 13
 14using SteveCadwallader.CodeMaid.Properties;
 15
 16namespace SteveCadwallader.CodeMaid.UI.Dialogs.Options.Digging
 17{
 18    /// <summary>
 19    /// The view model for digging options.
 20    /// </summary>
 21    public class DiggingViewModel : OptionsPageViewModel
 22    {
 23        #region Constructors
 24
 25        /// <summary>
 26        /// Initializes a new instance of the <see cref="DiggingViewModel"/> class.
 27        /// </summary>
 28        /// <param name="package">The hosting package.</param>
 29        public DiggingViewModel(CodeMaidPackage package)
 30            : base(package)
 31        {
 32        }
 33
 34        #endregion Constructors
 35
 36        #region Overrides of OptionsPageViewModel
 37
 38        /// <summary>
 39        /// Gets the header.
 40        /// </summary>
 41        public override string Header
 42        {
 43            get { return "Digging (Spade)"; }
 44        }
 45
 46        /// <summary>
 47        /// Loads the settings.
 48        /// </summary>
 49        public override void LoadSettings()
 50        {
 51            CacheFiles = Settings.Default.Digging_CacheFiles;
 52            CenterOnWhole = Settings.Default.Digging_CenterOnWhole;
 53            ComplexityAlertThreshold = Settings.Default.Digging_ComplexityAlertThreshold;
 54            ComplexityWarningThreshold = Settings.Default.Digging_ComplexityWarningThreshold;
 55            IndentationMargin = Settings.Default.Digging_IndentationMargin;
 56            SecondarySortTypeByName = Settings.Default.Digging_SecondarySortTypeByName;
 57            ShowItemComplexity = Settings.Default.Digging_ShowItemComplexity;
 58            ShowItemMetadata = Settings.Default.Digging_ShowItemMetadata;
 59            ShowMethodParameters = Settings.Default.Digging_ShowMethodParameters;
 60            SynchronizeOutlining = Settings.Default.Digging_SynchronizeOutlining;
 61        }
 62
 63        /// <summary>
 64        /// Saves the settings.
 65        /// </summary>
 66        public override void SaveSettings()
 67        {
 68            Settings.Default.Digging_CacheFiles = CacheFiles;
 69            Settings.Default.Digging_CenterOnWhole = CenterOnWhole;
 70            Settings.Default.Digging_ComplexityAlertThreshold = ComplexityAlertThreshold;
 71            Settings.Default.Digging_ComplexityWarningThreshold = ComplexityWarningThreshold;
 72            Settings.Default.Digging_IndentationMargin = IndentationMargin;
 73            Settings.Default.Digging_SecondarySortTypeByName = SecondarySortTypeByName;
 74            Settings.Default.Digging_ShowItemComplexity = ShowItemComplexity;
 75            Settings.Default.Digging_ShowItemMetadata = ShowItemMetadata;
 76            Settings.Default.Digging_ShowMethodParameters = ShowMethodParameters;
 77            Settings.Default.Digging_SynchronizeOutlining = SynchronizeOutlining;
 78        }
 79
 80        #endregion Overrides of OptionsPageViewModel
 81
 82        #region Options
 83
 84        private bool _cacheFiles;
 85
 86        /// <summary>
 87        /// Gets or sets the flag indicating if files should be cached.
 88        /// </summary>
 89        public bool CacheFiles
 90        {
 91            get { return _cacheFiles; }
 92            set
 93            {
 94                if (_cacheFiles != value)
 95                {
 96                    _cacheFiles = value;
 97                    NotifyPropertyChanged("CacheFiles");
 98                }
 99            }
100        }
101
102        private bool _centerOnWhole;
103
104        /// <summary>
105        /// Gets or sets the flag indicating if the view should center on the whole item upon navigation.
106        /// </summary>
107        public bool CenterOnWhole
108        {
109            get { return _centerOnWhole; }
110            set
111            {
112                if (_centerOnWhole != value)
113                {
114                    _centerOnWhole = value;
115                    NotifyPropertyChanged("CenterOnWhole");
116                }
117            }
118        }
119
120        private int _complexityAlertThreshold;
121
122        /// <summary>
123        /// Gets or sets the complexity alert threshold.
124        /// </summary>
125        public int ComplexityAlertThreshold
126        {
127            get { return _complexityAlertThreshold; }
128            set
129            {
130                if (_complexityAlertThreshold != value)
131                {
132                    _complexityAlertThreshold = value;
133                    NotifyPropertyChanged("ComplexityAlertThreshold");
134                }
135            }
136        }
137
138        private int _complexityWarningThreshold;
139
140        /// <summary>
141        /// Gets or sets the complexity warning threshold.
142        /// </summary>
143        public int ComplexityWarningThreshold
144        {
145            get { return _complexityWarningThreshold; }
146            set
147            {
148                if (_complexityWarningThreshold != value)
149                {
150                    _complexityWarningThreshold = value;
151                    NotifyPropertyChanged("ComplexityWarningThreshold");
152                }
153            }
154        }
155
156        private int _indentationMargin;
157
158        /// <summary>
159        /// Gets or sets the indentation margin.
160        /// </summary>
161        public int IndentationMargin
162        {
163            get { return _indentationMargin; }
164            set
165            {
166                if (_indentationMargin != value)
167                {
168                    _indentationMargin = value;
169                    NotifyPropertyChanged("IndentationMargin");
170                }
171            }
172        }
173
174        private bool _secondarySortTypeByName;
175
176        /// <summary>
177        /// Gets or sets the flag indicating if secondary sorting during type layout should be on name.
178        /// </summary>
179        public bool SecondarySortTypeByName
180        {
181            get { return _secondarySortTypeByName; }
182            set
183            {
184                if (_secondarySortTypeByName != value)
185                {
186                    _secondarySortTypeByName = value;
187                    NotifyPropertyChanged("SecondarySortTypeByName");
188                }
189            }
190        }
191
192        private bool _showItemComplexity;
193
194        /// <summary>
195        /// Gets or sets the flag indicating if item complexity should be shown.
196        /// </summary>
197        public bool ShowItemComplexity
198        {
199            get { return _showItemComplexity; }
200            set
201            {
202                if (_showItemComplexity != value)
203                {
204                    _showItemComplexity = value;
205                    NotifyPropertyChanged("ShowItemComplexity");
206                }
207            }
208        }
209
210        private bool _showItemMetadata;
211
212        /// <summary>
213        /// Gets or sets the flag indicating if item metadata should be shown.
214        /// </summary>
215        public bool ShowItemMetadata
216        {
217            get { return _showItemMetadata; }
218            set
219            {
220                if (_showItemMetadata != value)
221                {
222                    _showItemMetadata = value;
223                    NotifyPropertyChanged("ShowItemMetadata");
224                }
225            }
226        }
227
228        private bool _showMethodParameters;
229
230        /// <summary>
231        /// Gets or sets the flag indicating if method parameters should be shown.
232        /// </summary>
233        public bool ShowMethodParameters
234        {
235            get { return _showMethodParameters; }
236            set
237            {
238                if (_showMethodParameters != value)
239                {
240                    _showMethodParameters = value;
241                    NotifyPropertyChanged("ShowMethodParameters");
242                }
243            }
244        }
245
246        private bool _synchronizeOutlining;
247
248        /// <summary>
249        /// Gets or sets the flag indicating if outlining should be synchronized with the code file.
250        /// </summary>
251        public bool SynchronizeOutlining
252        {
253            get { return _synchronizeOutlining; }
254            set
255            {
256                if (_synchronizeOutlining != value)
257                {
258                    _synchronizeOutlining = value;
259                    NotifyPropertyChanged("SynchronizeOutlining");
260                }
261            }
262        }
263
264        #endregion Options
265    }
266}