/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

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