diff --git a/samples/PhotoFrame/PhotoFrame.Logic/UI/ViewModels/IViewModel.cs b/samples/PhotoFrame/PhotoFrame.Logic/UI/ViewModels/IViewModel.cs index 928779d7..111f5cc7 100644 --- a/samples/PhotoFrame/PhotoFrame.Logic/UI/ViewModels/IViewModel.cs +++ b/samples/PhotoFrame/PhotoFrame.Logic/UI/ViewModels/IViewModel.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace PhotoFrame.Logic.UI.ViewModels +namespace PhotoFrame.Logic.UI.ViewModels { /// /// Marker interface for view models diff --git a/samples/PhotoFrame/PhotoFrame.Logic/UI/ViewModels/ViewModelBase.cs b/samples/PhotoFrame/PhotoFrame.Logic/UI/ViewModels/ViewModelBase.cs index 9d658b80..95e54b6b 100644 --- a/samples/PhotoFrame/PhotoFrame.Logic/UI/ViewModels/ViewModelBase.cs +++ b/samples/PhotoFrame/PhotoFrame.Logic/UI/ViewModels/ViewModelBase.cs @@ -1,10 +1,8 @@ using PhotoFrame.Logic.BL; using PhotoFrame.Logic.Config; using System; -using System.Collections.Generic; using System.ComponentModel; using System.Runtime.CompilerServices; -using System.Text; namespace PhotoFrame.Logic.UI.ViewModels { @@ -12,24 +10,20 @@ namespace PhotoFrame.Logic.UI.ViewModels { public event PropertyChangedEventHandler PropertyChanged; protected IFrameController FrameController { get; } - protected IFrameConfig FrameConfig; + protected readonly IFrameConfig FrameConfig; + // ReSharper disable once MemberCanBePrivate.Global public bool IsStopped { get; private set; } - private string _ImageUri = ""; + private string _imageUri = ""; public string ImageUri { - get - { - return _ImageUri; - } + get => _imageUri; private set { - if(!string.Equals(_ImageUri, value)) - { - _ImageUri = value; - RaisePropertyChanged(); - } + if (string.Equals(_imageUri, value)) return; + _imageUri = value; + RaisePropertyChanged(); } } @@ -39,16 +33,16 @@ namespace PhotoFrame.Logic.UI.ViewModels FrameController.CurrentPhotoChanged -= FrameController_CurrentPhotoChanged; } - private static int _Counter = 0; + private static int _counter; - public ViewModelBase(IFrameController frameController, IFrameConfig config) + protected ViewModelBase(IFrameController frameController, IFrameConfig config) { FrameController = frameController; FrameConfig = config; ImageUri = frameController.CurrentPhoto; FrameController.CurrentPhotoChanged += FrameController_CurrentPhotoChanged; - _Counter++; - Console.WriteLine($"Number of ViewModels: {_Counter}"); + _counter++; + Console.WriteLine($"Number of ViewModels: {_counter}"); } private void FrameController_CurrentPhotoChanged(object sender, CurrentPhotoChangedEventArgs e) @@ -61,8 +55,8 @@ namespace PhotoFrame.Logic.UI.ViewModels ~ViewModelBase() { - _Counter--; - Console.WriteLine($"Number of ViewModels: {_Counter}"); + _counter--; + Console.WriteLine($"Number of ViewModels: {_counter}"); } protected void RaisePropertyChanged([CallerMemberName]string propertyName = "") diff --git a/samples/PhotoFrame/PhotoFrame.Logic/UI/ViewModels/ViewModelBorder.cs b/samples/PhotoFrame/PhotoFrame.Logic/UI/ViewModels/ViewModelBorder.cs index 731434fe..a94b2544 100644 --- a/samples/PhotoFrame/PhotoFrame.Logic/UI/ViewModels/ViewModelBorder.cs +++ b/samples/PhotoFrame/PhotoFrame.Logic/UI/ViewModels/ViewModelBorder.cs @@ -1,9 +1,6 @@ using PhotoFrame.Logic.BL; using PhotoFrame.Logic.Config; -using System; -using System.Collections.Generic; using System.Drawing; -using System.Text; namespace PhotoFrame.Logic.UI.ViewModels { @@ -22,7 +19,7 @@ namespace PhotoFrame.Logic.UI.ViewModels private string ColorToString(Color color) { - return $"#{color.R.ToString("x2")}{color.G.ToString("x2")}{color.B.ToString("x2")}"; + return $"#{color.R:x2}{color.G:x2}{color.B:x2}"; } } } diff --git a/samples/PhotoFrame/PhotoFrame.Logic/UI/ViewModels/ViewModelColorize.cs b/samples/PhotoFrame/PhotoFrame.Logic/UI/ViewModels/ViewModelColorize.cs index fb7fa10b..c9ed4159 100644 --- a/samples/PhotoFrame/PhotoFrame.Logic/UI/ViewModels/ViewModelColorize.cs +++ b/samples/PhotoFrame/PhotoFrame.Logic/UI/ViewModels/ViewModelColorize.cs @@ -1,8 +1,5 @@ using PhotoFrame.Logic.BL; using PhotoFrame.Logic.Config; -using System; -using System.Collections.Generic; -using System.Text; namespace PhotoFrame.Logic.UI.ViewModels { diff --git a/samples/PhotoFrame/PhotoFrame.Logic/UI/ViewModels/ViewModelNormal.cs b/samples/PhotoFrame/PhotoFrame.Logic/UI/ViewModels/ViewModelNormal.cs index 40546d87..995ae04c 100644 --- a/samples/PhotoFrame/PhotoFrame.Logic/UI/ViewModels/ViewModelNormal.cs +++ b/samples/PhotoFrame/PhotoFrame.Logic/UI/ViewModels/ViewModelNormal.cs @@ -1,8 +1,5 @@ using PhotoFrame.Logic.BL; using PhotoFrame.Logic.Config; -using System; -using System.Collections.Generic; -using System.Text; namespace PhotoFrame.Logic.UI.ViewModels { diff --git a/samples/PhotoFrame/PhotoFrame.Logic/UI/ViewModels/ViewSwitchInfo.cs b/samples/PhotoFrame/PhotoFrame.Logic/UI/ViewModels/ViewSwitchInfo.cs index 2820248b..32659f99 100644 --- a/samples/PhotoFrame/PhotoFrame.Logic/UI/ViewModels/ViewSwitchInfo.cs +++ b/samples/PhotoFrame/PhotoFrame.Logic/UI/ViewModels/ViewSwitchInfo.cs @@ -1,7 +1,4 @@ using PhotoFrame.Logic.BL; -using System; -using System.Collections.Generic; -using System.Text; namespace PhotoFrame.Logic.UI.ViewModels { @@ -14,9 +11,13 @@ namespace PhotoFrame.Logic.UI.ViewModels SwitchType = switchType; } + // ReSharper disable once AutoPropertyCanBeMadeGetOnly.Local public string ViewResourceId { get; private set; } + // ReSharper disable once AutoPropertyCanBeMadeGetOnly.Local public IViewModel ViewModel { get; private set; } + // ReSharper disable once AutoPropertyCanBeMadeGetOnly.Local public ViewSwitchType SwitchType { get; private set; } + // ReSharper disable once UnusedMember.Global public string SwitchTypeString => SwitchType.ToString(); } } diff --git a/samples/PhotoFrame/PhotoFrame.Logic/UI/Views/IView.cs b/samples/PhotoFrame/PhotoFrame.Logic/UI/Views/IView.cs index 8e28fbc4..0f29bc43 100644 --- a/samples/PhotoFrame/PhotoFrame.Logic/UI/Views/IView.cs +++ b/samples/PhotoFrame/PhotoFrame.Logic/UI/Views/IView.cs @@ -1,7 +1,4 @@ using PhotoFrame.Logic.BL; -using System; -using System.Collections.Generic; -using System.Text; namespace PhotoFrame.Logic.UI.Views { diff --git a/samples/PhotoFrame/PhotoFrame.Logic/UI/Views/IViewManager.cs b/samples/PhotoFrame/PhotoFrame.Logic/UI/Views/IViewManager.cs index f1fad6ff..de70ca77 100644 --- a/samples/PhotoFrame/PhotoFrame.Logic/UI/Views/IViewManager.cs +++ b/samples/PhotoFrame/PhotoFrame.Logic/UI/Views/IViewManager.cs @@ -1,7 +1,4 @@ using PhotoFrame.Logic.BL; -using System; -using System.Collections.Generic; -using System.Text; namespace PhotoFrame.Logic.UI.Views { diff --git a/samples/PhotoFrame/PhotoFrame.Logic/UI/Views/ViewBase.cs b/samples/PhotoFrame/PhotoFrame.Logic/UI/Views/ViewBase.cs index 36086085..805e6e16 100644 --- a/samples/PhotoFrame/PhotoFrame.Logic/UI/Views/ViewBase.cs +++ b/samples/PhotoFrame/PhotoFrame.Logic/UI/Views/ViewBase.cs @@ -6,17 +6,17 @@ namespace PhotoFrame.Logic.UI.Views { public abstract class ViewBase : IView { - private string _Uri; + private readonly string _uri; - protected IAppModel AppModel { get; } + private IAppModel AppModel { get; } protected IFrameController FrameController { get; } protected IFrameConfig FrameConfig { get; } public IViewModel ViewModel { get; private set; } - public ViewBase(string uri, IAppModel appModel, IFrameController frameController, IFrameConfig frameConfig) + protected ViewBase(string uri, IAppModel appModel, IFrameController frameController, IFrameConfig frameConfig) { - _Uri = uri; + _uri = uri; AppModel = appModel; FrameController = frameController; FrameConfig = frameConfig; @@ -25,7 +25,7 @@ namespace PhotoFrame.Logic.UI.Views public void Activate(ViewSwitchType switchType) { ViewModel = CreateViewModel(); - AppModel.SwitchToView(new ViewSwitchInfo(_Uri, ViewModel, switchType)); + AppModel.SwitchToView(new ViewSwitchInfo(_uri, ViewModel, switchType)); } public void Deactivate() diff --git a/samples/PhotoFrame/PhotoFrame.Logic/UI/Views/ViewBorder.cs b/samples/PhotoFrame/PhotoFrame.Logic/UI/Views/ViewBorder.cs index 622d7f8b..e32c25ad 100644 --- a/samples/PhotoFrame/PhotoFrame.Logic/UI/Views/ViewBorder.cs +++ b/samples/PhotoFrame/PhotoFrame.Logic/UI/Views/ViewBorder.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Drawing; -using System.Text; -using PhotoFrame.Logic.BL; +using PhotoFrame.Logic.BL; using PhotoFrame.Logic.Config; using PhotoFrame.Logic.UI.ViewModels; diff --git a/samples/PhotoFrame/PhotoFrame.Logic/UI/Views/ViewColorize.cs b/samples/PhotoFrame/PhotoFrame.Logic/UI/Views/ViewColorize.cs index b1befe58..1a4af896 100644 --- a/samples/PhotoFrame/PhotoFrame.Logic/UI/Views/ViewColorize.cs +++ b/samples/PhotoFrame/PhotoFrame.Logic/UI/Views/ViewColorize.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using PhotoFrame.Logic.BL; +using PhotoFrame.Logic.BL; using PhotoFrame.Logic.Config; using PhotoFrame.Logic.UI.ViewModels; diff --git a/samples/PhotoFrame/PhotoFrame.Logic/UI/Views/ViewManager.cs b/samples/PhotoFrame/PhotoFrame.Logic/UI/Views/ViewManager.cs index 60de3962..197ba2f6 100644 --- a/samples/PhotoFrame/PhotoFrame.Logic/UI/Views/ViewManager.cs +++ b/samples/PhotoFrame/PhotoFrame.Logic/UI/Views/ViewManager.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Text; using PhotoFrame.Logic.BL; using PhotoFrame.Logic.Config; @@ -8,15 +6,15 @@ namespace PhotoFrame.Logic.UI.Views { public class ViewManager : IViewManager { - private IAppModel _AppModel; - private IFrameController _FrameController; - private IFrameConfig _FrameConfig; + private readonly IAppModel _appModel; + private readonly IFrameController _frameController; + private readonly IFrameConfig _frameConfig; public ViewManager(IAppModel appModel, IFrameController frameController, IFrameConfig frameConfig) { - _AppModel = appModel; - _FrameController = frameController; - _FrameConfig = frameConfig; + _appModel = appModel; + _frameController = frameController; + _frameConfig = frameConfig; } public IView CreateView(ViewType viewType) @@ -24,11 +22,11 @@ namespace PhotoFrame.Logic.UI.Views switch(viewType) { case ViewType.Normal: - return new ViewNormal(_AppModel, _FrameController, _FrameConfig); + return new ViewNormal(_appModel, _frameController, _frameConfig); case ViewType.Border: - return new ViewBorder(_AppModel, _FrameController, _FrameConfig); + return new ViewBorder(_appModel, _frameController, _frameConfig); case ViewType.Colorized: - return new ViewColorize(_AppModel, _FrameController, _FrameConfig); + return new ViewColorize(_appModel, _frameController, _frameConfig); default: throw new NotSupportedException($"ViewType [{viewType}] not supported!"); } diff --git a/samples/PhotoFrame/PhotoFrame.Logic/UI/Views/ViewNormal.cs b/samples/PhotoFrame/PhotoFrame.Logic/UI/Views/ViewNormal.cs index 18500de3..3c4205c3 100644 --- a/samples/PhotoFrame/PhotoFrame.Logic/UI/Views/ViewNormal.cs +++ b/samples/PhotoFrame/PhotoFrame.Logic/UI/Views/ViewNormal.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using PhotoFrame.Logic.BL; +using PhotoFrame.Logic.BL; using PhotoFrame.Logic.Config; using PhotoFrame.Logic.UI.ViewModels;