PageRenderTime 24ms CodeModel.GetById 20ms app.highlight 2ms RepoModel.GetById 0ms app.codeStats 0ms

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