/CodeMaid/UI/Dialogs/Options/Compatibility/CompatibilityViewModel.cs

https://bitbucket.org/s_cadwallader/codemaid · C# · 100 lines · 52 code · 18 blank · 30 comment · 3 complexity · 28088fbfce16ab2dfced763a3e63854d 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 System.Linq;
  12. using EnvDTE;
  13. using SteveCadwallader.CodeMaid.Properties;
  14. namespace SteveCadwallader.CodeMaid.UI.Dialogs.Options.Compatibility
  15. {
  16. /// <summary>
  17. /// The view model for compatibility options.
  18. /// </summary>
  19. public class CompatibilityViewModel : OptionsPageViewModel
  20. {
  21. #region Constructors
  22. /// <summary>
  23. /// Initializes a new instance of the <see cref="CompatibilityViewModel"/> class.
  24. /// </summary>
  25. /// <param name="package">The hosting package.</param>
  26. public CompatibilityViewModel(CodeMaidPackage package)
  27. : base(package)
  28. {
  29. }
  30. #endregion Constructors
  31. #region Overrides of OptionsPageViewModel
  32. /// <summary>
  33. /// Gets the header.
  34. /// </summary>
  35. public override string Header
  36. {
  37. get { return "Compatibility"; }
  38. }
  39. /// <summary>
  40. /// Loads the settings.
  41. /// </summary>
  42. public override void LoadSettings()
  43. {
  44. UseReSharperSilentCleanup = Settings.Default.Compatibility_UseReSharperSilentCleanup;
  45. }
  46. /// <summary>
  47. /// Saves the settings.
  48. /// </summary>
  49. public override void SaveSettings()
  50. {
  51. Settings.Default.Compatibility_UseReSharperSilentCleanup = UseReSharperSilentCleanup;
  52. }
  53. #endregion Overrides of OptionsPageViewModel
  54. #region Options
  55. /// <summary>
  56. /// Gets or sets the flag indicating if ReSharper silent cleanup should be utilized during cleanup.
  57. /// </summary>
  58. public bool UseReSharperSilentCleanup
  59. {
  60. get { return _useReSharperSilentCleanup; }
  61. set
  62. {
  63. if (_useReSharperSilentCleanup != value)
  64. {
  65. _useReSharperSilentCleanup = value;
  66. NotifyPropertyChanged("UseReSharperSilentCleanup");
  67. }
  68. }
  69. }
  70. private bool _useReSharperSilentCleanup;
  71. #endregion Options
  72. #region Enables
  73. /// <summary>
  74. /// Gets a flag indicating if the UseReSharperSilentCleanup option should be enabled.
  75. /// </summary>
  76. public bool UseReSharperSilentCleanupEnabled
  77. {
  78. get { return Package.IDE.Commands.OfType<Command>().Any(x => x.Name == "ReSharper_SilentCleanupCode"); }
  79. }
  80. #endregion Enables
  81. }
  82. }