From 6ffc68fd2b27eaa8102575cbd8bd0d977f319228 Mon Sep 17 00:00:00 2001 From: Luka Grabarevic Date: Mon, 9 Jul 2018 09:54:53 +0200 Subject: [PATCH] Refactoring/quality of life changes (#26) * Updated squirrel.windows to 1.8.0 * Updated further nuget packages * Added new resharper style settings * Applied new code styles to whole solution * Fixed resharper async/await issues --- .../Base/View/BuildProviderViewBase.cs | 17 +- .../Base/ViewModel/ProviderViewModelBase.cs | 48 +- .../SubViewModels/BuildDefinitionViewModel.cs | 24 +- .../BuildsAppReborn.Access.UI.csproj | 10 +- .../DefaultNotificationProvider.cs | 61 +- .../Notifications/NotificationHelper.cs | 4 - .../Windows10NotificationProvider.cs | 51 +- .../Properties/AssemblyInfo.cs | 1 - .../TfsBuildProviderViewModelBase.cs | 172 +-- .../Views/TfsBuildProviderViewBase.xaml.cs | 4 - .../TFS2017/View/Tfs2017BuildProviderView.cs | 15 +- .../Tfs2017BuildProviderViewModel.cs | 9 - .../VSTS/View/VstsBuildProviderView.cs | 15 +- .../ViewModel/VstsBuildProviderViewModel.cs | 9 - BuildsAppReborn.Access.UI/packages.config | 4 +- BuildsAppReborn.Access/Base/NamedObject.cs | 6 - BuildsAppReborn.Access/BuildMonitor.cs | 84 +- .../BuildsAppReborn.Access.csproj | 5 +- BuildsAppReborn.Access/GitHub/GitHubCommit.cs | 6 - .../GitHub/GitHubSourceVersion.cs | 13 +- .../TFS/Models/Internal/LinksContainer.cs | 12 +- .../TFS/Models/Internal/Repository.cs | 5 - .../TFS/Models/Internal/Resource.cs | 4 - .../TFS/Models/TfsArtifact.cs | 15 +- BuildsAppReborn.Access/TFS/Models/TfsBuild.cs | 54 +- .../TFS/Models/TfsBuildDefinition.cs | 14 +- .../TFS/Models/TfsProject.cs | 4 - .../TFS/Models/TfsPullRequest.cs | 6 +- .../TFS/Models/TfsSourceVersion.cs | 9 +- .../TFS/Models/TfsTestRun.cs | 16 +- BuildsAppReborn.Access/TFS/Models/TfsUser.cs | 41 +- .../TFS/TfsBuildProviderBase.cs | 114 +- .../TFS2017/Models/Tfs2017Build.cs | 4 - .../TFS2017/Models/Tfs2017BuildDefinition.cs | 4 - .../TFS2017/Models/Tfs2017PullRequest.cs | 4 - .../TFS2017/Models/Tfs2017SourceVersion.cs | 5 - .../TFS2017/Tfs2017BuildProvider.cs | 7 +- .../VSTS/Models/VstsBuild.cs | 5 - .../VSTS/Models/VstsBuildDefinition.cs | 4 - .../VSTS/Models/VstsPullRequest.cs | 4 - .../VSTS/Models/VstsSourceVersion.cs | 5 - .../VSTS/VstsBuildProvider.cs | 4 - BuildsAppReborn.Access/packages.config | 2 +- .../Properties/AssemblyInfo.cs | 3 +- BuildsAppReborn.Client/App.xaml.cs | 28 +- .../BuildsAppReborn.Client.csproj | 53 +- BuildsAppReborn.Client/Cache/BuildCache.cs | 53 +- .../Controls/StackedBarGraph.xaml.cs | 38 +- .../StackedBarGraphHeightConverter.cs | 12 - .../Controls/StackedItem.cs | 8 +- .../Controls/StackedItemCollection.cs | 8 - .../BuildItemToRelativeMarginConverter.cs | 9 +- .../Converter/BuildStatusToImageConverter.cs | 5 - ...tusToSolidColorBrushBackgroundConverter.cs | 5 +- ...tusToSolidColorBrushForegroundConverter.cs | 5 +- .../BuildTimeToElapsedTimeConverter.cs | 13 +- .../Converter/CountToVisibilityConverter.cs | 6 +- .../Converter/EnumDescriptionConverter.cs | 9 - .../FallBackNulltoLoadingConverter.cs | 4 - .../Converter/MinutesToTimeSpanConverter.cs | 4 - .../Converter/NullVisibilityConverter.cs | 4 - .../TestRunToStackedItemsConverter.cs | 4 - .../TimeSpanToNiceStringConverter.cs | 26 +- .../GlobalSettingsContainer.cs | 26 +- .../Interfaces/ICloseable.cs | 4 - .../Interfaces/IHasDataContext.cs | 4 - .../Interfaces/ISaveable.cs | 8 - .../Interfaces/ISubSettingsControl.cs | 4 - .../Notification/NotificationManager.cs | 23 +- .../Properties/AssemblyInfo.cs | 1 - .../Resources/IconProvider.cs | 26 +- BuildsAppReborn.Client/UpdateChecker.cs | 68 +- .../ViewModels/BuildsStatusViewModel.cs | 35 +- .../ViewModels/NotifyIconViewModel.cs | 48 +- .../Settings/GeneralSettingsViewModel.cs | 60 +- .../Settings/ServerSettingsViewModel.cs | 52 +- .../ViewModels/Settings/SettingsViewModel.cs | 15 +- .../Views/BuildsStatusView.xaml.cs | 12 - .../Views/GeneralSettingsControl.xaml.cs | 8 - .../Views/ServerSettingsControl.xaml.cs | 14 +- .../Views/SettingsView.xaml.cs | 22 +- BuildsAppReborn.Client/packages.config | 11 +- BuildsAppReborn.Contracts.UI/BuildItem.cs | 20 - .../BuildStatusGroup.cs | 20 +- .../DeselectionPreventionBehavior.cs | 8 - .../IBuildProviderView.cs | 4 - .../IBuildProviderViewModel.cs | 9 - .../Notifications/INotificationProvider.cs | 8 - .../NotificationProviderExtensions.cs | 5 - .../BuildsAppReborn.Contracts.csproj | 5 +- .../BuildProviderExportAttribute.cs | 10 +- .../Composition/IBuildProviderMetadata.cs | 4 - .../Composition/IIdentifierMetadata.cs | 4 - .../Composition/IPriorityMetadata.cs | 4 - .../Composition/IdentifierExportAttribute.cs | 8 - .../Composition/PriorityExportAttribute.cs | 8 - .../BuildDefinitionEqualityComparer.cs | 5 +- .../Extensions/BuildEqualityComparer.cs | 13 +- .../BuildProviderSettingsExtensions.cs | 29 +- .../Extensions/PullRequestEqualityComparer.cs | 4 - .../IBuildMonitorAdvanced.cs | 8 +- .../IBuildMonitorBasic.cs | 15 +- BuildsAppReborn.Contracts/IBuildProvider.cs | 10 +- .../Models/Base/IObjectItem.cs | 4 - .../Models/Base/IWebItem.cs | 4 - .../Models/BuildMonitorSettings.cs | 51 +- .../Models/BuildViewStyle.cs | 6 +- .../Models/DataResponse.cs | 10 +- .../DataResponseUnsuccessfulException.cs | 8 - .../Models/GeneralSettings.cs | 8 - BuildsAppReborn.Contracts/Models/IArtifact.cs | 4 - BuildsAppReborn.Contracts/Models/IBuild.cs | 4 - .../Models/IBuildDefinition.cs | 4 - .../Models/INamedObject.cs | 4 - BuildsAppReborn.Contracts/Models/IProject.cs | 4 - .../Models/IPullRequest.cs | 4 - .../Models/ISourceVersion.cs | 4 - BuildsAppReborn.Contracts/Models/ITestRun.cs | 4 - BuildsAppReborn.Contracts/Models/IUser.cs | 4 - .../Models/WindowSetting.cs | 4 - BuildsAppReborn.Contracts/packages.config | 2 +- .../Properties/AssemblyInfo.cs | 3 +- .../SettingsContainerTests.cs | 19 +- .../TestData/DummyDefinition.cs | 6 +- .../TestData/DummyProject.cs | 4 - .../BuildsAppReborn.Infrastructure.csproj | 5 +- .../Collections/RangeObservableCollection.cs | 6 +- BuildsAppReborn.Infrastructure/Consts.cs | 3 +- .../ExportFactoryContainer.cs | 21 +- .../Helper/CloneHelper.cs | 4 - .../Helper/EnumHelper.cs | 4 - .../Helper/HttpRequestHelper.cs | 20 +- .../InterfaceTypeConverter.cs | 7 +- .../LazyContainer.cs | 132 +- .../SettingsContainer{TValue}.cs | 9 - .../TolerantEnumConverter.cs | 10 +- .../UrlValidator.cs | 4 - .../ViewModelBase.cs | 8 - .../Wpf/InverseBooleanConverter.cs | 7 +- .../Wpf/WaitingIndicator.cs | 8 - .../packages.config | 2 +- .../BuildsAppReborn.Package.csproj | 2 +- .../Properties/AssemblyInfo.cs | 3 +- BuildsAppReborn.sln | 7 +- BuildsAppReborn.sln.DotSettings | 1287 ++++++----------- 145 files changed, 1066 insertions(+), 2487 deletions(-) diff --git a/BuildsAppReborn.Access.UI/Base/View/BuildProviderViewBase.cs b/BuildsAppReborn.Access.UI/Base/View/BuildProviderViewBase.cs index eb5dd4d..23fd7f3 100644 --- a/BuildsAppReborn.Access.UI/Base/View/BuildProviderViewBase.cs +++ b/BuildsAppReborn.Access.UI/Base/View/BuildProviderViewBase.cs @@ -1,6 +1,5 @@ using System; using System.Windows.Controls; - using BuildsAppReborn.Access.UI.Resources; using BuildsAppReborn.Contracts.UI; @@ -8,22 +7,12 @@ namespace BuildsAppReborn.Access.UI.View { internal abstract class BuildProviderViewBase : UserControl, IBuildProviderView { - #region Implementation of IBuildProviderView + public String Header => Resource.TfsConnectBoxLabel; public virtual IBuildProviderViewModel ViewModel { - get - { - return (IBuildProviderViewModel)DataContext; - } - protected set - { - DataContext = value; - } + get { return (IBuildProviderViewModel) DataContext; } + protected set { DataContext = value; } } - - public String Header => Resource.TfsConnectBoxLabel; - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Access.UI/Base/ViewModel/ProviderViewModelBase.cs b/BuildsAppReborn.Access.UI/Base/ViewModel/ProviderViewModelBase.cs index 6dbda54..ddd87fe 100644 --- a/BuildsAppReborn.Access.UI/Base/ViewModel/ProviderViewModelBase.cs +++ b/BuildsAppReborn.Access.UI/Base/ViewModel/ProviderViewModelBase.cs @@ -2,8 +2,6 @@ using System.Collections.Generic; using System.ComponentModel.Composition; using System.Linq; -using System.Windows.Input; - using BuildsAppReborn.Contracts; using BuildsAppReborn.Contracts.Composition; using BuildsAppReborn.Contracts.Models; @@ -14,26 +12,28 @@ namespace BuildsAppReborn.Access.UI.ViewModel { internal abstract class ProviderViewModelBase : ViewModelBase, IBuildProviderViewModel, IPartImportsSatisfiedNotification { - #region Implementation of IBuildProviderViewModel + public abstract String DisplayName { get; protected set; } public BuildMonitorSettings MonitorSettings { get; private set; } - public virtual void Initialize(BuildMonitorSettings settings) - { - if (settings == null) throw new ArgumentNullException(nameof(settings)); - MonitorSettings = settings; - OnInitialized(); - } + public abstract IEnumerable SelectedBuildDefinitions { get; } - public abstract String DisplayName { get; protected set; } + public Boolean SupportsDefaultCredentials => BuildProviderMetaData.SupportedAuthenticationModes.HasFlag(AuthenticationModes.Default); - public abstract IEnumerable SelectedBuildDefinitions { get; } + public Boolean SupportsPersonalAccessToken => BuildProviderMetaData.SupportedAuthenticationModes.HasFlag(AuthenticationModes.AccessToken); public abstract String Url { get; } - #endregion + public virtual void Initialize(BuildMonitorSettings settings) + { + if (settings == null) + { + throw new ArgumentNullException(nameof(settings)); + } - #region Implementation of IPartImportsSatisfiedNotification + MonitorSettings = settings; + OnInitialized(); + } public virtual void OnImportsSatisfied() { @@ -57,40 +57,18 @@ public virtual void OnImportsSatisfied() } } - #endregion - - #region Public Properties - - public Boolean SupportsDefaultCredentials => BuildProviderMetaData.SupportedAuthenticationModes.HasFlag(AuthenticationModes.Default); - - public Boolean SupportsPersonalAccessToken => BuildProviderMetaData.SupportedAuthenticationModes.HasFlag(AuthenticationModes.AccessToken); - - #endregion - - #region Protected Properties - protected IBuildProvider BuildProvider { get; private set; } protected IBuildProviderMetadata BuildProviderMetaData { get; private set; } - #endregion - - #region Protected Methods - protected virtual void OnInitialized() { } - #endregion - - #region Private Fields - [ImportMany] #pragma warning disable 649 private Lazy[] buildProviders; #pragma warning restore 649 - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Access.UI/Base/ViewModel/SubViewModels/BuildDefinitionViewModel.cs b/BuildsAppReborn.Access.UI/Base/ViewModel/SubViewModels/BuildDefinitionViewModel.cs index 4d7d143..545868d 100644 --- a/BuildsAppReborn.Access.UI/Base/ViewModel/SubViewModels/BuildDefinitionViewModel.cs +++ b/BuildsAppReborn.Access.UI/Base/ViewModel/SubViewModels/BuildDefinitionViewModel.cs @@ -1,5 +1,4 @@ using System; - using BuildsAppReborn.Contracts.Models; using BuildsAppReborn.Infrastructure; @@ -7,26 +6,21 @@ namespace BuildsAppReborn.Access.UI.ViewModel.SubViewModels { internal class BuildDefinitionViewModel : ViewModelBase { - #region Constructors - public BuildDefinitionViewModel(IBuildDefinition buildDefinition) { - if (buildDefinition == null) throw new ArgumentNullException(nameof(buildDefinition)); + if (buildDefinition == null) + { + throw new ArgumentNullException(nameof(buildDefinition)); + } + BuildDefinition = buildDefinition; } - #endregion - - #region Public Properties - public IBuildDefinition BuildDefinition { get; } public Boolean IsSelected { - get - { - return this.isSelected; - } + get { return this.isSelected; } set { this.isSelected = value; @@ -36,12 +30,6 @@ public Boolean IsSelected public String Name => BuildDefinition.Name; - #endregion - - #region Private Fields - private Boolean isSelected; - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Access.UI/BuildsAppReborn.Access.UI.csproj b/BuildsAppReborn.Access.UI/BuildsAppReborn.Access.UI.csproj index 94d8376..94ab16c 100644 --- a/BuildsAppReborn.Access.UI/BuildsAppReborn.Access.UI.csproj +++ b/BuildsAppReborn.Access.UI/BuildsAppReborn.Access.UI.csproj @@ -43,13 +43,11 @@ 4.0 - - ..\packages\ToastNotifications.2.1.0\lib\net452\ToastNotifications.dll - True + + ..\packages\ToastNotifications.2.2.5\lib\net40\ToastNotifications.dll - - ..\packages\ToastNotifications.Messages.2.1.0\lib\net452\ToastNotifications.Messages.dll - True + + ..\packages\ToastNotifications.Messages.2.2.5\lib\net40\ToastNotifications.Messages.dll diff --git a/BuildsAppReborn.Access.UI/Notifications/DefaultNotificationProvider.cs b/BuildsAppReborn.Access.UI/Notifications/DefaultNotificationProvider.cs index 0dc518e..f068e3d 100644 --- a/BuildsAppReborn.Access.UI/Notifications/DefaultNotificationProvider.cs +++ b/BuildsAppReborn.Access.UI/Notifications/DefaultNotificationProvider.cs @@ -6,9 +6,9 @@ using BuildsAppReborn.Contracts.Models; using BuildsAppReborn.Contracts.UI.Notifications; using ToastNotifications; +using ToastNotifications.Core; using ToastNotifications.Lifetime; using ToastNotifications.Messages; -using ToastNotifications.Messages.Core; using ToastNotifications.Position; namespace BuildsAppReborn.Access.UI.Notifications @@ -17,39 +17,38 @@ namespace BuildsAppReborn.Access.UI.Notifications [PartCreationPolicy(CreationPolicy.Shared)] internal class DefaultNotificationProvider : NotificationProviderBase, INotificationProvider { - #region Constructors - [ImportingConstructor] public DefaultNotificationProvider(GeneralSettings generalSettings) : base(generalSettings) { this.notifier = new Notifier(cfg => - { - cfg.PositionProvider = new PrimaryScreenPositionProvider(Corner.BottomRight, 10, 50); - cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(TimeSpan.FromSeconds(10), MaximumNotificationCount.FromCount(3)); - cfg.Dispatcher = Application.Current.Dispatcher; - }); + { + cfg.PositionProvider = new PrimaryScreenPositionProvider(Corner.BottomRight, 10, 50); + cfg.LifetimeSupervisor = new TimeAndCountBasedLifetimeSupervisor(TimeSpan.FromSeconds(10), MaximumNotificationCount.FromCount(3)); + cfg.Dispatcher = Application.Current.Dispatcher; + }); } - #endregion - - #region Implementation of INotificationProvider + public Boolean IsSupported => true; public void ShowBuild(IBuild build, Func iconProvider, Action notificationClickAction) { - if (build == null) return; + if (build == null) + { + return; + } var sb = new StringBuilder(); sb.AppendLine(GetTitle(build)); sb.AppendLine(build.GenerateStatus()); sb.AppendLine(build.GenerateUsername()); var displayOptions = new MessageOptions - { - NotificationClickAction = n => - { - notificationClickAction?.Invoke(build); - n.Close(); - } - }; + { + NotificationClickAction = n => + { + notificationClickAction?.Invoke(build); + n.Close(); + } + }; switch (build.Status) { @@ -92,25 +91,17 @@ public void ShowMessage(String title, String message, Action clickAction) else { var displayOptions = new MessageOptions - { - NotificationClickAction = n => - { - clickAction.Invoke(); - n.Close(); - } - }; + { + NotificationClickAction = n => + { + clickAction.Invoke(); + n.Close(); + } + }; this.notifier.ShowInformation(sb.ToString(), displayOptions); } } - public Boolean IsSupported => true; - - #endregion - - #region Private Fields - - private Notifier notifier; - - #endregion + private readonly Notifier notifier; } } \ No newline at end of file diff --git a/BuildsAppReborn.Access.UI/Notifications/NotificationHelper.cs b/BuildsAppReborn.Access.UI/Notifications/NotificationHelper.cs index 4c6ecfb..8bf52a2 100644 --- a/BuildsAppReborn.Access.UI/Notifications/NotificationHelper.cs +++ b/BuildsAppReborn.Access.UI/Notifications/NotificationHelper.cs @@ -5,8 +5,6 @@ namespace BuildsAppReborn.Access.UI.Notifications { internal static class NotificationHelper { - #region Public Static Methods - public static String GenerateStatus(this IBuild build) { return build.Status.ToString(); @@ -29,7 +27,5 @@ public static String GenerateUsername(this IBuild build) { return build.Requester.DisplayName; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Access.UI/Notifications/Windows10NotificationProvider.cs b/BuildsAppReborn.Access.UI/Notifications/Windows10NotificationProvider.cs index 76efdd3..dc15822 100644 --- a/BuildsAppReborn.Access.UI/Notifications/Windows10NotificationProvider.cs +++ b/BuildsAppReborn.Access.UI/Notifications/Windows10NotificationProvider.cs @@ -12,16 +12,25 @@ namespace BuildsAppReborn.Access.UI.Notifications [PartCreationPolicy(CreationPolicy.Shared)] internal class Windows10NotificationProvider : NotificationProviderBase, INotificationProvider { - #region Constructors - [ImportingConstructor] public Windows10NotificationProvider(GeneralSettings generalSettings) : base(generalSettings) { } - #endregion - - #region Implementation of INotificationProvider + public Boolean IsSupported + { + get + { + // somehow windows version is not correctly provided when in debug, but release works +#if !DEBUG + var os = Environment.OSVersion; + return os.Version.Major >= 10; +#endif +#if DEBUG + return true; +#endif + } + } public void ShowBuild(IBuild build, Func iconProvider, Action notificationClickAction) { @@ -40,11 +49,17 @@ public void ShowBuild(IBuild build, Func iconProvider, Action { notificationClickAction.Invoke(build); }; + if (notificationClickAction != null) + { + toast.Activated += (sender, args) => { notificationClickAction.Invoke(build); }; + } // Show the toast. Be sure to specify the AppUserModelId on your application's shortcut! ToastNotificationManager.CreateToastNotifier(AppId).Show(toast); @@ -69,29 +84,15 @@ public void ShowMessage(String title, String message, Action clickAction) // Create the toast and attach event listeners var toast = new ToastNotification(toastXml); - if (clickAction != null) toast.Activated += (sender, args) => { clickAction.Invoke(); }; + if (clickAction != null) + { + toast.Activated += (sender, args) => { clickAction.Invoke(); }; + } // Show the toast. Be sure to specify the AppUserModelId on your application's shortcut! ToastNotificationManager.CreateToastNotifier(AppId).Show(toast); } - public Boolean IsSupported - { - get - { - // somehow windows version is not correctly provided when in debug, but release works -#if !DEBUG - var os = Environment.OSVersion; - return os.Version.Major >= 10; -#endif -#if DEBUG - return true; -#endif - } - } - - #endregion - // Code partially from: https://www.whitebyte.info/programming/c/how-to-make-a-notification-from-a-c-desktop-application-in-windows-10 private const String AppId = "com.squirrel.BuildsAppReborn.BuildsAppReborn.Client"; diff --git a/BuildsAppReborn.Access.UI/Properties/AssemblyInfo.cs b/BuildsAppReborn.Access.UI/Properties/AssemblyInfo.cs index d0981e7..ab27bcf 100644 --- a/BuildsAppReborn.Access.UI/Properties/AssemblyInfo.cs +++ b/BuildsAppReborn.Access.UI/Properties/AssemblyInfo.cs @@ -24,7 +24,6 @@ //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, diff --git a/BuildsAppReborn.Access.UI/TFS/ViewModel/TfsBuildProviderViewModelBase.cs b/BuildsAppReborn.Access.UI/TFS/ViewModel/TfsBuildProviderViewModelBase.cs index c91b3ba..632e3a9 100644 --- a/BuildsAppReborn.Access.UI/TFS/ViewModel/TfsBuildProviderViewModelBase.cs +++ b/BuildsAppReborn.Access.UI/TFS/ViewModel/TfsBuildProviderViewModelBase.cs @@ -6,20 +6,16 @@ using System.Net; using System.Threading.Tasks; using System.Windows; - using BuildsAppReborn.Access.UI.ViewModel.SubViewModels; using BuildsAppReborn.Contracts.Models; using BuildsAppReborn.Infrastructure; using BuildsAppReborn.Infrastructure.Collections; - using Prism.Commands; namespace BuildsAppReborn.Access.UI.ViewModel { internal abstract class TfsBuildProviderViewModelBase : ProviderViewModelBase { - #region Constructors - protected TfsBuildProviderViewModelBase(IEqualityComparer buildDefinitionEqualityComparer) { this.buildDefinitionEqualityComparer = buildDefinitionEqualityComparer; @@ -28,66 +24,10 @@ protected TfsBuildProviderViewModelBase(IEqualityComparer buil InitializeCommands(); } - #endregion - - #region Overrides of Base - - public override String DisplayName - { - get - { - return String.IsNullOrWhiteSpace(this.displayName) ? ProviderName : this.displayName; - } - protected set - { - this.displayName = value; - OnPropertyChanged(); - } - } - - protected override void OnInitialized() - { - base.OnInitialized(); - - if (!MonitorSettings.ContainsKey(TfsBuildProviderBase.ProjectCredentialsSettingKey)) - { - MonitorSettings[TfsBuildProviderBase.ProjectCredentialsSettingKey] = CredentialCache.DefaultCredentials; - } - SetDisplayName(MonitorSettings.SelectedBuildDefinitions); - - // ReSharper disable once ExplicitCallerInfoArgument - OnPropertyChanged(nameof(ProjectUrl)); - ConnectCommand?.RaiseCanExecuteChanged(); - - if (!SupportsDefaultCredentials && SupportsPersonalAccessToken) - { - ShowPersonalAccessTokenInput = true; - if (MonitorSettings.ContainsKey(TfsBuildProviderBase.PersonalAccessTokenSettingsKey)) - { - var token = MonitorSettings?.GetDefaultValueIfNotExists(TfsBuildProviderBase.PersonalAccessTokenSettingsKey); - if (!String.IsNullOrWhiteSpace(token)) - { - ShowPersonalAccessTokenInput = false; - } - } - } - } - - public override IEnumerable SelectedBuildDefinitions => new ObservableCollection(MonitorSettings.SelectedBuildDefinitions); - - public override String Url => ProjectUrl; - - #endregion - - #region Public Properties - public String AccessToken { // never show access token once provided - get - { - return String.Empty; - } + get { return String.Empty; } set { // ToDo: Token should only be saved if connection was successful @@ -104,12 +44,19 @@ public String AccessToken public DelegateCommand ConnectCommand { get; private set; } - public Boolean IsConnecting + public override String DisplayName { - get + get { return String.IsNullOrWhiteSpace(this.displayName) ? ProviderName : this.displayName; } + protected set { - return this.isConnecting; + this.displayName = value; + OnPropertyChanged(); } + } + + public Boolean IsConnecting + { + get { return this.isConnecting; } set { this.isConnecting = value; @@ -120,10 +67,7 @@ public Boolean IsConnecting public String ProjectUrl { - get - { - return MonitorSettings?.GetDefaultValueIfNotExists(TfsBuildProviderBase.ProjectUrlSettingKey); - } + get { return MonitorSettings?.GetDefaultValueIfNotExists(TfsBuildProviderBase.ProjectUrlSettingKey); } set { MonitorSettings[TfsBuildProviderBase.ProjectUrlSettingKey] = value; @@ -134,12 +78,11 @@ public String ProjectUrl } } + public override IEnumerable SelectedBuildDefinitions => new ObservableCollection(MonitorSettings.SelectedBuildDefinitions); + public Boolean ShowPersonalAccessTokenInput { - get - { - return this.showPersonalAccessTokenInput; - } + get { return this.showPersonalAccessTokenInput; } set { OnPropertyChanged(); @@ -149,10 +92,7 @@ public Boolean ShowPersonalAccessTokenInput public String StatusText { - get - { - return this.statusText; - } + get { return this.statusText; } set { this.statusText = value; @@ -160,34 +100,57 @@ public String StatusText } } - #endregion - - #region Protected Properties + public override String Url => ProjectUrl; protected abstract String ProviderName { get; } - #endregion + protected override void OnInitialized() + { + base.OnInitialized(); - #region Private Methods + if (!MonitorSettings.ContainsKey(TfsBuildProviderBase.ProjectCredentialsSettingKey)) + { + MonitorSettings[TfsBuildProviderBase.ProjectCredentialsSettingKey] = CredentialCache.DefaultCredentials; + } + + SetDisplayName(MonitorSettings.SelectedBuildDefinitions); + + // ReSharper disable once ExplicitCallerInfoArgument + OnPropertyChanged(nameof(ProjectUrl)); + ConnectCommand?.RaiseCanExecuteChanged(); + + if (!SupportsDefaultCredentials && SupportsPersonalAccessToken) + { + ShowPersonalAccessTokenInput = true; + if (MonitorSettings.ContainsKey(TfsBuildProviderBase.PersonalAccessTokenSettingsKey)) + { + var token = MonitorSettings?.GetDefaultValueIfNotExists(TfsBuildProviderBase.PersonalAccessTokenSettingsKey); + if (!String.IsNullOrWhiteSpace(token)) + { + ShowPersonalAccessTokenInput = false; + } + } + } + } private void ApplyBuildDefinitions(IEnumerable buildDefinitions) { BuildDefinitions.AddRange(buildDefinitions.Select(buildDefinition => - { - var selectedBuildDefinitions = MonitorSettings.SelectedBuildDefinitions; + { + var selectedBuildDefinitions = MonitorSettings.SelectedBuildDefinitions; - var vm = new BuildDefinitionViewModel(buildDefinition); + var vm = new BuildDefinitionViewModel(buildDefinition); - var definition = selectedBuildDefinitions.SingleOrDefault(a => a.Id == vm.BuildDefinition.Id); - if (definition != null && this.buildDefinitionEqualityComparer.Equals(definition, vm.BuildDefinition)) - { - vm.IsSelected = true; - } + var definition = selectedBuildDefinitions.SingleOrDefault(a => a.Id == vm.BuildDefinition.Id); + if (definition != null && this.buildDefinitionEqualityComparer.Equals(definition, vm.BuildDefinition)) + { + vm.IsSelected = true; + } - vm.PropertyChanged += BuildDefinitionPropertyChanged; + vm.PropertyChanged += BuildDefinitionPropertyChanged; - return vm; - })); + return vm; + })); } private void BuildDefinitionPropertyChanged(Object sender, PropertyChangedEventArgs e) @@ -216,16 +179,16 @@ private async Task OnConnectAsync() try { Application.Current.Dispatcher.Invoke(() => - { - foreach (var buildDefinitionViewModel in BuildDefinitions) - { - buildDefinitionViewModel.PropertyChanged -= BuildDefinitionPropertyChanged; - } + { + foreach (var buildDefinitionViewModel in BuildDefinitions) + { + buildDefinitionViewModel.PropertyChanged -= BuildDefinitionPropertyChanged; + } - BuildDefinitions.Clear(); - }); + BuildDefinitions.Clear(); + }); - var buildDefinitions = await Task.Run(() => BuildProvider.GetBuildDefinitions(MonitorSettings)); + var buildDefinitions = await Task.Run(() => BuildProvider.GetBuildDefinitionsAsync(MonitorSettings)).ConfigureAwait(false); if (buildDefinitions.IsSuccessStatusCode) { @@ -277,7 +240,8 @@ private void UpdateSelectedBuildDefinitionList(BuildDefinitionViewModel buildDef } else if (!buildDefinitionViewModel.IsSelected) { - var currentItem = MonitorSettings.SelectedBuildDefinitions.SingleOrDefault(definition => this.buildDefinitionEqualityComparer.Equals(definition, buildDefinitionViewModel.BuildDefinition)); + var currentItem = MonitorSettings.SelectedBuildDefinitions.SingleOrDefault( + definition => this.buildDefinitionEqualityComparer.Equals(definition, buildDefinitionViewModel.BuildDefinition)); MonitorSettings.SelectedBuildDefinitions.Remove(currentItem); } @@ -286,10 +250,6 @@ private void UpdateSelectedBuildDefinitionList(BuildDefinitionViewModel buildDef OnPropertyChanged(nameof(SelectedBuildDefinitions)); } - #endregion - - #region Private Fields - private readonly IEqualityComparer buildDefinitionEqualityComparer; private String displayName; @@ -299,7 +259,5 @@ private void UpdateSelectedBuildDefinitionList(BuildDefinitionViewModel buildDef private Boolean showPersonalAccessTokenInput; private String statusText; - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Access.UI/TFS/Views/TfsBuildProviderViewBase.xaml.cs b/BuildsAppReborn.Access.UI/TFS/Views/TfsBuildProviderViewBase.xaml.cs index b6fff6a..4f88f80 100644 --- a/BuildsAppReborn.Access.UI/TFS/Views/TfsBuildProviderViewBase.xaml.cs +++ b/BuildsAppReborn.Access.UI/TFS/Views/TfsBuildProviderViewBase.xaml.cs @@ -2,13 +2,9 @@ { internal abstract partial class TfsBuildProviderViewBase { - #region Constructors - internal TfsBuildProviderViewBase() { InitializeComponent(); } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Access.UI/TFS2017/View/Tfs2017BuildProviderView.cs b/BuildsAppReborn.Access.UI/TFS2017/View/Tfs2017BuildProviderView.cs index 5d35d3f..074fc66 100644 --- a/BuildsAppReborn.Access.UI/TFS2017/View/Tfs2017BuildProviderView.cs +++ b/BuildsAppReborn.Access.UI/TFS2017/View/Tfs2017BuildProviderView.cs @@ -1,5 +1,4 @@ using System.ComponentModel.Composition; - using BuildsAppReborn.Access.UI.ViewModel; using BuildsAppReborn.Access.UI.Views; using BuildsAppReborn.Contracts.Composition; @@ -11,21 +10,11 @@ namespace BuildsAppReborn.Access.UI.View [PartCreationPolicy(CreationPolicy.NonShared)] internal class Tfs2017BuildProviderView : TfsBuildProviderViewBase { - #region Overrides of Base - [Import(typeof(Tfs2017BuildProviderViewModel))] public override IBuildProviderViewModel ViewModel { - get - { - return base.ViewModel; - } - protected set - { - base.ViewModel = value; - } + get { return base.ViewModel; } + protected set { base.ViewModel = value; } } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Access.UI/TFS2017/ViewModel/Tfs2017BuildProviderViewModel.cs b/BuildsAppReborn.Access.UI/TFS2017/ViewModel/Tfs2017BuildProviderViewModel.cs index 856a08d..18fb474 100644 --- a/BuildsAppReborn.Access.UI/TFS2017/ViewModel/Tfs2017BuildProviderViewModel.cs +++ b/BuildsAppReborn.Access.UI/TFS2017/ViewModel/Tfs2017BuildProviderViewModel.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.ComponentModel.Composition; - using BuildsAppReborn.Contracts.Composition; using BuildsAppReborn.Contracts.Models; @@ -11,20 +10,12 @@ namespace BuildsAppReborn.Access.UI.ViewModel [PartCreationPolicy(CreationPolicy.NonShared)] internal class Tfs2017BuildProviderViewModel : TfsBuildProviderViewModelBase { - #region Constructors - [ImportingConstructor] public Tfs2017BuildProviderViewModel(IEqualityComparer buildDefinitionEqualityComparer) : base(buildDefinitionEqualityComparer) { } - #endregion - - #region Overrides of Base - protected override String ProviderName => Tfs2017BuildProvider.Name; - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Access.UI/VSTS/View/VstsBuildProviderView.cs b/BuildsAppReborn.Access.UI/VSTS/View/VstsBuildProviderView.cs index 5f3fed8..8c0da40 100644 --- a/BuildsAppReborn.Access.UI/VSTS/View/VstsBuildProviderView.cs +++ b/BuildsAppReborn.Access.UI/VSTS/View/VstsBuildProviderView.cs @@ -1,5 +1,4 @@ using System.ComponentModel.Composition; - using BuildsAppReborn.Access.UI.ViewModel; using BuildsAppReborn.Access.UI.Views; using BuildsAppReborn.Contracts.Composition; @@ -11,21 +10,11 @@ namespace BuildsAppReborn.Access.UI.View [PartCreationPolicy(CreationPolicy.NonShared)] internal class VstsBuildProviderView : TfsBuildProviderViewBase { - #region Overrides of Base - [Import(typeof(VstsBuildProviderViewModel))] public override IBuildProviderViewModel ViewModel { - get - { - return base.ViewModel; - } - protected set - { - base.ViewModel = value; - } + get { return base.ViewModel; } + protected set { base.ViewModel = value; } } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Access.UI/VSTS/ViewModel/VstsBuildProviderViewModel.cs b/BuildsAppReborn.Access.UI/VSTS/ViewModel/VstsBuildProviderViewModel.cs index 3b3b25e..b6fa3d8 100644 --- a/BuildsAppReborn.Access.UI/VSTS/ViewModel/VstsBuildProviderViewModel.cs +++ b/BuildsAppReborn.Access.UI/VSTS/ViewModel/VstsBuildProviderViewModel.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.ComponentModel.Composition; - using BuildsAppReborn.Contracts.Composition; using BuildsAppReborn.Contracts.Models; @@ -11,20 +10,12 @@ namespace BuildsAppReborn.Access.UI.ViewModel [PartCreationPolicy(CreationPolicy.NonShared)] internal class VstsBuildProviderViewModel : TfsBuildProviderViewModelBase { - #region Constructors - [ImportingConstructor] public VstsBuildProviderViewModel(IEqualityComparer buildDefinitionEqualityComparer) : base(buildDefinitionEqualityComparer) { } - #endregion - - #region Overrides of Base - protected override String ProviderName => VstsBuildProvider.Name; - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Access.UI/packages.config b/BuildsAppReborn.Access.UI/packages.config index 9ecdc15..9c75422 100644 --- a/BuildsAppReborn.Access.UI/packages.config +++ b/BuildsAppReborn.Access.UI/packages.config @@ -1,6 +1,6 @@  - - + + \ No newline at end of file diff --git a/BuildsAppReborn.Access/Base/NamedObject.cs b/BuildsAppReborn.Access/Base/NamedObject.cs index 5b676fd..060ea66 100644 --- a/BuildsAppReborn.Access/Base/NamedObject.cs +++ b/BuildsAppReborn.Access/Base/NamedObject.cs @@ -1,18 +1,12 @@ using System; - using BuildsAppReborn.Contracts.Models; - using Newtonsoft.Json; namespace BuildsAppReborn.Access.Base { public class NamedObject : INamedObject { - #region Public Properties - [JsonProperty("name")] public virtual String Name { get; protected set; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Access/BuildMonitor.cs b/BuildsAppReborn.Access/BuildMonitor.cs index 67f39d9..2f3608b 100644 --- a/BuildsAppReborn.Access/BuildMonitor.cs +++ b/BuildsAppReborn.Access/BuildMonitor.cs @@ -18,22 +18,42 @@ namespace BuildsAppReborn.Access [PartCreationPolicy(CreationPolicy.Shared)] internal sealed class BuildMonitor : IBuildMonitorAdvanced { - #region Constructors - [ImportingConstructor] - public BuildMonitor(LazyContainer buildProviders, LazyContainer notificationProviders, IEqualityComparer buildDefinitionEqualityComparer) + public BuildMonitor(LazyContainer buildProviders, + LazyContainer notificationProviders, + IEqualityComparer buildDefinitionEqualityComparer) { this.buildProviders = buildProviders; this.buildDefinitionEqualityComparer = buildDefinitionEqualityComparer; this.notificationProvider = notificationProviders.GetSupportedNotificationProvider(); #pragma warning disable 4014 - this.timer.Elapsed += (sender, args) => BeginPollingBuilds(); + this.timer.Elapsed += (sender, args) => BeginPollingBuildsAsync(); #pragma warning restore 4014 } - #endregion + public Boolean IsConfigured => this.providerSettingsGroup.Any() && this.providerSettingsGroup.SelectMany(a => a.Value).SelectMany(a => a.SelectedBuildDefinitions).Any(); + + public async Task BeginPollingBuildsAsync() + { + if (this.isPolling) + { + return; + } + + var builds = new List(); + this.isPolling = true; + foreach (var pair in this.providerSettingsGroup) + { + foreach (var setting in pair.Value) + { + builds.AddRange(await PollBuildsAsync(pair.Key, setting).ConfigureAwait(false)); + } + } + + OnBuildsUpdated(builds); - #region Implementation of IBuildMonitorAdvanced + this.isPolling = false; + } public void Start(IEnumerable settings, GeneralSettings generalSettingsParam) { @@ -63,34 +83,9 @@ public void Stop() public event BuildsUpdatedEventHandler BuildsUpdated; - public async Task BeginPollingBuilds() - { - if (this.isPolling) return; - - var builds = new List(); - this.isPolling = true; - foreach (var pair in this.providerSettingsGroup) - { - foreach (var setting in pair.Value) - { - builds.AddRange(await PollBuilds(pair.Key, setting)); - } - } - - OnBuildsUpdated(builds); - - this.isPolling = false; - } - - public Boolean IsConfigured => this.providerSettingsGroup.Any() && this.providerSettingsGroup.SelectMany(a => a.Value).SelectMany(a => a.SelectedBuildDefinitions).Any(); - - public event EventHandler MonitorStopped; - public event EventHandler MonitorStarted; - #endregion - - #region Private Methods + public event EventHandler MonitorStopped; private void Initialize(IEnumerable settings) { @@ -120,21 +115,20 @@ private void OnMonitorStopped() MonitorStopped?.Invoke(this, EventArgs.Empty); } - private async Task> PollBuilds(IBuildProvider provider, BuildMonitorSettings settings) + private async Task> PollBuildsAsync(IBuildProvider provider, BuildMonitorSettings settings) { try { - var builds = new DataResponse>(); if (this.generalSettings?.ViewStyle == BuildViewStyle.GroupByPullRequest) { - var prBuilds = await provider.GetBuildsByPullRequests(settings); + var prBuilds = await provider.GetBuildsByPullRequestsAsync(settings).ConfigureAwait(false); prBuilds.ThrowIfUnsuccessful(); var definitionsInUse = prBuilds.Data.GroupBy(a => a.Definition, build => build, this.buildDefinitionEqualityComparer).Select(a => a.Key); var unusedDefinitions = settings.SelectedBuildDefinitions.Except(definitionsInUse, this.buildDefinitionEqualityComparer).ToList(); if (unusedDefinitions.Any()) { - var defBuilds = await provider.GetBuilds(settings.SelectedBuildDefinitions, settings); + var defBuilds = await provider.GetBuildsAsync(settings.SelectedBuildDefinitions, settings).ConfigureAwait(false); defBuilds.ThrowIfUnsuccessful(); return prBuilds.Data.Concat(defBuilds.Data); @@ -143,7 +137,7 @@ private async Task> PollBuilds(IBuildProvider provider, Buil return prBuilds.Data; } - builds = await provider.GetBuilds(settings.SelectedBuildDefinitions, settings); + var builds = await provider.GetBuildsAsync(settings.SelectedBuildDefinitions, settings).ConfigureAwait(false); builds.ThrowIfUnsuccessful(); return builds.Data; @@ -151,21 +145,19 @@ private async Task> PollBuilds(IBuildProvider provider, Buil catch (DataResponseUnsuccessfulException ex) { this.logger.Warn($"Http status code {ex.StatusCode} returned while polling for builds!"); - this.notificationProvider?.ShowMessage("Failure on getting builds", $"Please check the connection for project(s) '{String.Join(", ", settings.SelectedBuildDefinitions.Select(b => b.Project.Name).Distinct())}'. StatusCode was '{ex.StatusCode}'. See log for more details."); + this.notificationProvider?.ShowMessage("Failure on getting builds", + $"Please check the connection for project(s) '{String.Join(", ", settings.SelectedBuildDefinitions.Select(b => b.Project.Name).Distinct())}'. StatusCode was '{ex.StatusCode}'. See log for more details."); } catch (Exception exception) { this.logger.Warn("Failure on polling builds", exception); - this.notificationProvider?.ShowMessage("Failure on getting builds", $"Please check the connection for project(s) '{String.Join(", ", settings.SelectedBuildDefinitions.Select(b => b.Project.Name).Distinct())}'. See log for details."); + this.notificationProvider?.ShowMessage("Failure on getting builds", + $"Please check the connection for project(s) '{String.Join(", ", settings.SelectedBuildDefinitions.Select(b => b.Project.Name).Distinct())}'. See log for details."); } return Enumerable.Empty(); } - #endregion - - #region Private Fields - private readonly IEqualityComparer buildDefinitionEqualityComparer; private readonly LazyContainer buildProviders; @@ -173,14 +165,12 @@ private async Task> PollBuilds(IBuildProvider provider, Buil private Boolean isPolling; - private ILog logger = LogManager.GetLogger(typeof(BuildMonitor)); + private readonly ILog logger = LogManager.GetLogger(typeof(BuildMonitor)); - private INotificationProvider notificationProvider; + private readonly INotificationProvider notificationProvider; private readonly Dictionary> providerSettingsGroup = new Dictionary>(); private readonly Timer timer = new Timer(); - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Access/BuildsAppReborn.Access.csproj b/BuildsAppReborn.Access/BuildsAppReborn.Access.csproj index a4a043f..8b968ab 100644 --- a/BuildsAppReborn.Access/BuildsAppReborn.Access.csproj +++ b/BuildsAppReborn.Access/BuildsAppReborn.Access.csproj @@ -34,9 +34,8 @@ ..\packages\log4net.2.0.8\lib\net45-full\log4net.dll True - - ..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll - True + + ..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll ..\packages\Svg.2.3.0\lib\net35\Svg.dll diff --git a/BuildsAppReborn.Access/GitHub/GitHubCommit.cs b/BuildsAppReborn.Access/GitHub/GitHubCommit.cs index ed5eefa..8abe165 100644 --- a/BuildsAppReborn.Access/GitHub/GitHubCommit.cs +++ b/BuildsAppReborn.Access/GitHub/GitHubCommit.cs @@ -1,24 +1,18 @@ using System; - using BuildsAppReborn.Access.Base; using BuildsAppReborn.Contracts.Models; using BuildsAppReborn.Infrastructure; - using Newtonsoft.Json; namespace BuildsAppReborn.Access { internal class GitHubCommit { - #region Public Properties - [JsonProperty("author")] [JsonConverter(typeof(InterfaceTypeConverter))] public INamedObject Author { get; private set; } [JsonProperty("message")] public String Message { get; private set; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Access/GitHub/GitHubSourceVersion.cs b/BuildsAppReborn.Access/GitHub/GitHubSourceVersion.cs index 7fac7d9..62439ea 100644 --- a/BuildsAppReborn.Access/GitHub/GitHubSourceVersion.cs +++ b/BuildsAppReborn.Access/GitHub/GitHubSourceVersion.cs @@ -1,7 +1,5 @@ using System; - using BuildsAppReborn.Contracts.Models; - using Newtonsoft.Json; // ReSharper disable UnassignedGetOnlyAutoProperty @@ -11,8 +9,6 @@ namespace BuildsAppReborn.Access { internal class GitHubSourceVersion : ISourceVersion { - #region Implementation of ISourceVersion - [JsonIgnore] public INamedObject Author => this.commit?.Author; @@ -22,13 +18,6 @@ internal class GitHubSourceVersion : ISourceVersion [JsonProperty("html_url")] public String PortalUrl { get; private set; } - #endregion - - #region Private Fields - - [JsonProperty("commit")] - private GitHubCommit commit; - - #endregion + [JsonProperty("commit")] private GitHubCommit commit; } } \ No newline at end of file diff --git a/BuildsAppReborn.Access/TFS/Models/Internal/LinksContainer.cs b/BuildsAppReborn.Access/TFS/Models/Internal/LinksContainer.cs index 7367c16..2257631 100644 --- a/BuildsAppReborn.Access/TFS/Models/Internal/LinksContainer.cs +++ b/BuildsAppReborn.Access/TFS/Models/Internal/LinksContainer.cs @@ -6,8 +6,6 @@ namespace BuildsAppReborn.Access.Models.Internal { internal abstract class LinksContainer { - #region Public Properties - [JsonIgnore] public String WebLink { @@ -21,18 +19,12 @@ public String WebLink return web[Href]; } } + return String.Empty; } } - #endregion - - #region Private Fields - - [JsonProperty("_links")] - private Dictionary> links; - - #endregion + [JsonProperty("_links")] private Dictionary> links; private const String Web = "web"; diff --git a/BuildsAppReborn.Access/TFS/Models/Internal/Repository.cs b/BuildsAppReborn.Access/TFS/Models/Internal/Repository.cs index 12e5e81..fb7efa3 100644 --- a/BuildsAppReborn.Access/TFS/Models/Internal/Repository.cs +++ b/BuildsAppReborn.Access/TFS/Models/Internal/Repository.cs @@ -1,5 +1,4 @@ using System; -using System.ComponentModel; using BuildsAppReborn.Infrastructure; using Newtonsoft.Json; @@ -7,15 +6,11 @@ namespace BuildsAppReborn.Access.Models.Internal { internal class Repository { - #region Public Properties - [JsonProperty("id")] public String Id { get; set; } [JsonConverter(typeof(TolerantEnumConverter))] [JsonProperty("type")] public RepositoryType RepositoryType { get; set; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Access/TFS/Models/Internal/Resource.cs b/BuildsAppReborn.Access/TFS/Models/Internal/Resource.cs index 88f2e4f..8d1e536 100644 --- a/BuildsAppReborn.Access/TFS/Models/Internal/Resource.cs +++ b/BuildsAppReborn.Access/TFS/Models/Internal/Resource.cs @@ -5,8 +5,6 @@ namespace BuildsAppReborn.Access.Models.Internal { internal class Resource { - #region Public Properties - [JsonProperty("data")] public String Data { get; private set; } @@ -18,7 +16,5 @@ internal class Resource [JsonProperty("url")] public String Url { get; private set; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Access/TFS/Models/TfsArtifact.cs b/BuildsAppReborn.Access/TFS/Models/TfsArtifact.cs index 55cef08..f8b89d8 100644 --- a/BuildsAppReborn.Access/TFS/Models/TfsArtifact.cs +++ b/BuildsAppReborn.Access/TFS/Models/TfsArtifact.cs @@ -7,7 +7,8 @@ namespace BuildsAppReborn.Access.Models { internal abstract class TfsArtifact : IArtifact { - #region Implementation of IArtifact + [JsonIgnore] + public String Data => this.resource?.Data; [JsonIgnore] public String DownloadUrl => this.resource?.DownloadUrl; @@ -20,16 +21,6 @@ internal abstract class TfsArtifact : IArtifact public String Type => this.resource?.Type; - [JsonIgnore] - public String Data => this.resource?.Data; - - #endregion - - #region Private Fields - - [JsonProperty("resource")] - private Resource resource; - - #endregion + [JsonProperty("resource")] private Resource resource; } } \ No newline at end of file diff --git a/BuildsAppReborn.Access/TFS/Models/TfsBuild.cs b/BuildsAppReborn.Access/TFS/Models/TfsBuild.cs index eae7207..d9ad190 100644 --- a/BuildsAppReborn.Access/TFS/Models/TfsBuild.cs +++ b/BuildsAppReborn.Access/TFS/Models/TfsBuild.cs @@ -14,17 +14,11 @@ namespace BuildsAppReborn.Access.Models // ReSharper disable once ClassNeverInstantiated.Global internal abstract class TfsBuild : LinksContainer, IBuild { - #region Constructors - public TfsBuild() { Artifacts = Enumerable.Empty(); } - #endregion - - #region Implementation of IBuild - [JsonIgnore] public IEnumerable Artifacts { get; internal set; } @@ -34,12 +28,27 @@ public TfsBuild() [JsonProperty("definition")] public abstract IBuildDefinition Definition { get; protected set; } + [JsonProperty("finishTime")] + public DateTime FinishDateTime { get; private set; } + [JsonProperty("id")] public Int32 Id { get; private set; } [JsonIgnore] public IPullRequest PullRequest { get; internal set; } + [JsonProperty("queueTime")] + public DateTime QueueDateTime { get; private set; } + + [JsonProperty("requestedFor")] + public abstract IUser Requester { get; protected set; } + + [JsonIgnore] + public ISourceVersion SourceVersion { get; internal set; } + + [JsonProperty("startTime")] + public DateTime StartDateTime { get; private set; } + [JsonIgnore] public BuildStatus Status { @@ -88,30 +97,11 @@ public BuildStatus Status [JsonIgnore] public IEnumerable TestRuns { get; internal set; } - [JsonProperty("finishTime")] - public DateTime FinishDateTime { get; private set; } - - [JsonProperty("queueTime")] - public DateTime QueueDateTime { get; private set; } - - [JsonProperty("startTime")] - public DateTime StartDateTime { get; private set; } - - [JsonProperty("requestedFor")] - public abstract IUser Requester { get; protected set; } - [JsonProperty("url")] public String Url { get; private set; } [JsonIgnore] - public String WebUrl => base.WebLink; - - [JsonIgnore] - public ISourceVersion SourceVersion { get; internal set; } - - #endregion - - #region Internal Properties + public String WebUrl => WebLink; [JsonProperty("repository")] internal Repository Repository { get; private set; } @@ -133,18 +123,10 @@ internal String SourceVersionInternal [JsonProperty("uri")] internal String Uri { get; private set; } - #endregion - - #region Private Fields - - [JsonProperty("result")] - private String result; + [JsonProperty("result")] private String result; private String sourceVersionInternal; - [JsonProperty("status")] - private String status; - - #endregion + [JsonProperty("status")] private String status; } } \ No newline at end of file diff --git a/BuildsAppReborn.Access/TFS/Models/TfsBuildDefinition.cs b/BuildsAppReborn.Access/TFS/Models/TfsBuildDefinition.cs index 0711c59..93357fa 100644 --- a/BuildsAppReborn.Access/TFS/Models/TfsBuildDefinition.cs +++ b/BuildsAppReborn.Access/TFS/Models/TfsBuildDefinition.cs @@ -9,7 +9,8 @@ namespace BuildsAppReborn.Access.Models // ReSharper disable once ClassNeverInstantiated.Global internal abstract class TfsBuildDefinition : IBuildDefinition { - #region Implementation of IBuildDefinition + [JsonIgnore] + public String BuildSettingsId { get; internal set; } [JsonProperty("id")] public Int32 Id { get; private set; } @@ -17,18 +18,13 @@ internal abstract class TfsBuildDefinition : IBuildDefinition [JsonProperty("name")] public String Name { get; private set; } - [JsonProperty("type")] - public String Type { get; private set; } - [JsonProperty("project")] public abstract IProject Project { get; protected set; } + [JsonProperty("type")] + public String Type { get; private set; } + [JsonProperty("url")] public String Url { get; private set; } - - [JsonIgnore] - public String BuildSettingsId { get; internal set; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Access/TFS/Models/TfsProject.cs b/BuildsAppReborn.Access/TFS/Models/TfsProject.cs index 85cbb8f..3108b20 100644 --- a/BuildsAppReborn.Access/TFS/Models/TfsProject.cs +++ b/BuildsAppReborn.Access/TFS/Models/TfsProject.cs @@ -9,8 +9,6 @@ namespace BuildsAppReborn.Access.Models // ReSharper disable once ClassNeverInstantiated.Global internal abstract class TfsProject : IProject { - #region Implementation of IProject - [JsonProperty("description")] public String Description { get; private set; } @@ -22,7 +20,5 @@ internal abstract class TfsProject : IProject [JsonProperty("url")] public String Url { get; private set; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Access/TFS/Models/TfsPullRequest.cs b/BuildsAppReborn.Access/TFS/Models/TfsPullRequest.cs index 0ebcc49..31e5eff 100644 --- a/BuildsAppReborn.Access/TFS/Models/TfsPullRequest.cs +++ b/BuildsAppReborn.Access/TFS/Models/TfsPullRequest.cs @@ -6,8 +6,6 @@ namespace BuildsAppReborn.Access.Models { internal abstract class TfsPullRequest : IPullRequest { - #region Implementation of IPullRequest - [JsonProperty("createdBy")] public virtual IUser CreatedBy { get; protected set; } @@ -21,7 +19,7 @@ internal abstract class TfsPullRequest : IPullRequest public String MergeStatus { get; private set; } [JsonProperty("sourceRefName")] - public String Source { get; private set; } + public String Source { get; private set; } [JsonProperty("status")] public String Status { get; private set; } @@ -31,7 +29,5 @@ internal abstract class TfsPullRequest : IPullRequest [JsonProperty("title")] public String Title { get; private set; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Access/TFS/Models/TfsSourceVersion.cs b/BuildsAppReborn.Access/TFS/Models/TfsSourceVersion.cs index a986d8b..b45da78 100644 --- a/BuildsAppReborn.Access/TFS/Models/TfsSourceVersion.cs +++ b/BuildsAppReborn.Access/TFS/Models/TfsSourceVersion.cs @@ -1,7 +1,6 @@ using System; using BuildsAppReborn.Access.Models.Internal; using BuildsAppReborn.Contracts.Models; - using Newtonsoft.Json; // ReSharper disable UnassignedGetOnlyAutoProperty @@ -10,17 +9,13 @@ namespace BuildsAppReborn.Access.Models { internal abstract class TfsSourceVersion : LinksContainer, ISourceVersion { - #region Implementation of ISourceVersion + [JsonProperty("author")] + public abstract INamedObject Author { get; protected set; } [JsonProperty("comment")] public String Comment { get; private set; } [JsonIgnore] public String PortalUrl => WebLink; - - [JsonProperty("author")] - public abstract INamedObject Author { get; protected set; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Access/TFS/Models/TfsTestRun.cs b/BuildsAppReborn.Access/TFS/Models/TfsTestRun.cs index 648e705..d8a27ba 100644 --- a/BuildsAppReborn.Access/TFS/Models/TfsTestRun.cs +++ b/BuildsAppReborn.Access/TFS/Models/TfsTestRun.cs @@ -6,13 +6,8 @@ namespace BuildsAppReborn.Access.Models { internal abstract class TfsTestRun : ITestRun { - #region Implementation of ITestRun - - [JsonProperty("url")] - public String Url { get; private set; } - - [JsonProperty("webAccessUrl")] - public String WebUrl { get; private set; } + [JsonProperty("unanalyzedTests")] + public Int32 FailedTests { get; private set; } [JsonProperty("id")] public Int32 Id { get; private set; } @@ -35,9 +30,10 @@ internal abstract class TfsTestRun : ITestRun [JsonProperty("totalTests")] public Int32 TotalTests { get; private set; } - [JsonProperty("unanalyzedTests")] - public Int32 FailedTests { get; private set; } + [JsonProperty("url")] + public String Url { get; private set; } - #endregion + [JsonProperty("webAccessUrl")] + public String WebUrl { get; private set; } } } \ No newline at end of file diff --git a/BuildsAppReborn.Access/TFS/Models/TfsUser.cs b/BuildsAppReborn.Access/TFS/Models/TfsUser.cs index d82f406..764edba 100644 --- a/BuildsAppReborn.Access/TFS/Models/TfsUser.cs +++ b/BuildsAppReborn.Access/TFS/Models/TfsUser.cs @@ -1,9 +1,7 @@ using System; using System.Threading.Tasks; - using BuildsAppReborn.Access.Base; using BuildsAppReborn.Contracts.Models; - using Newtonsoft.Json; // ReSharper disable UnusedAutoPropertyAccessor.Local @@ -13,23 +11,12 @@ namespace BuildsAppReborn.Access.Models // ReSharper disable once ClassNeverInstantiated.Global internal abstract class TfsUser : NamedObject, IUser { - #region Implementation of IUser - [JsonProperty("displayName")] public String DisplayName { get; private set; } [JsonProperty("id")] public String Id { get; private set; } - [JsonProperty("imageUrl")] - public String ImageUrl { get; private set; } - - [JsonProperty("uniqueName")] - public String UniqueName { get; private set; } - - [JsonProperty("url")] - public String Url { get; private set; } - [JsonIgnore] public Byte[] ImageData { @@ -39,39 +26,29 @@ public Byte[] ImageData { this.imageData = Task.Run(() => ImageDataLoader).Result; } + return this.imageData; } } - #endregion - - #region Overrides of Base + [JsonProperty("imageUrl")] + public String ImageUrl { get; private set; } public override String Name { - get - { - return base.Name ?? DisplayName; - } - protected set - { - base.Name = value; - } + get { return base.Name ?? DisplayName; } + protected set { base.Name = value; } } - #endregion + [JsonProperty("uniqueName")] + public String UniqueName { get; private set; } - #region Internal Properties + [JsonProperty("url")] + public String Url { get; private set; } [JsonIgnore] internal Task ImageDataLoader { get; set; } - #endregion - - #region Private Fields - private Byte[] imageData; - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Access/TFS/TfsBuildProviderBase.cs b/BuildsAppReborn.Access/TFS/TfsBuildProviderBase.cs index 2d8d5b3..f5ebe54 100644 --- a/BuildsAppReborn.Access/TFS/TfsBuildProviderBase.cs +++ b/BuildsAppReborn.Access/TFS/TfsBuildProviderBase.cs @@ -26,19 +26,17 @@ internal abstract class TfsBuildProviderBase>> GetBuildDefinitions(BuildMonitorSettings settings) + public virtual async Task>> GetBuildDefinitionsAsync(BuildMonitorSettings settings) { var projectUrl = settings.GetValueStrict(ProjectUrlSettingKey).TrimEnd('/'); if (!String.IsNullOrWhiteSpace(projectUrl)) { var requestUrl = $"{projectUrl}/_apis/build/definitions?api-version={ApiVersion}"; - var requestResponse = await GetRequestResponse(requestUrl, settings); + var requestResponse = await GetRequestResponseAsync(requestUrl, settings).ConfigureAwait(false); if (requestResponse.IsSuccessStatusCode) { - var result = await requestResponse.Content.ReadAsStringAsync(); + var result = await requestResponse.Content.ReadAsStringAsync().ConfigureAwait(false); var data = JsonConvert.DeserializeObject>(JObject.Parse(result)["value"].ToString()); foreach (var buildDefinition in data) { @@ -51,10 +49,10 @@ public virtual async Task>> GetBuildD return new DataResponse> {Data = Enumerable.Empty(), StatusCode = requestResponse.StatusCode}; } - throw new Exception($"Error while processing method!"); + throw new Exception("Error while processing method!"); } - public virtual async Task>> GetBuilds(IEnumerable buildDefinitions, BuildMonitorSettings settings) + public virtual async Task>> GetBuildsAsync(IEnumerable buildDefinitions, BuildMonitorSettings settings) { var buildDefinitionsList = buildDefinitions.ToList(); if (!buildDefinitionsList.Any()) @@ -63,21 +61,20 @@ public virtual async Task>> GetBuilds(IEnumerab } var projectUrl = settings.GetValueStrict(ProjectUrlSettingKey).TrimEnd('/'); - var maxBuilds = settings.GetDefaultValueIfNotExists(MaxBuildsPerDefinitionSettingsKey); + var maxBuilds = settings.GetDefaultValueIfNotExists(MaxBuildsPerDefinitionSettingsKey) ?? 5; // use fallback value when no value was defined via settings - if (!maxBuilds.HasValue) maxBuilds = 5; if (!String.IsNullOrWhiteSpace(projectUrl)) { var buildDefinitionsCommaList = String.Join(",", buildDefinitionsList.Select(a => a.Id)); var requestUrl = $"{projectUrl}/_apis/build/builds?api-version={ApiVersion}&definitions={buildDefinitionsCommaList}&maxBuildsPerDefinition={maxBuilds}"; - var requestResponse = await GetRequestResponse(requestUrl, settings); + var requestResponse = await GetRequestResponseAsync(requestUrl, settings).ConfigureAwait(false); if (requestResponse.IsSuccessStatusCode) { - var result = await requestResponse.Content.ReadAsStringAsync(); + var result = await requestResponse.Content.ReadAsStringAsync().ConfigureAwait(false); var data = JsonConvert.DeserializeObject>(JObject.Parse(result)["value"].ToString()); - await ResolveAddtionalBuildData(settings, data, projectUrl); + await ResolveAdditionalBuildDataAsync(settings, data, projectUrl).ConfigureAwait(false); return new DataResponse> {Data = data, StatusCode = requestResponse.StatusCode}; } @@ -85,32 +82,32 @@ public virtual async Task>> GetBuilds(IEnumerab return new DataResponse> {Data = Enumerable.Empty(), StatusCode = requestResponse.StatusCode}; } - throw new Exception($"Error while processing method!"); + throw new Exception("Error while processing method!"); } - public virtual async Task>> GetBuildsByPullRequests(BuildMonitorSettings settings) + public virtual async Task>> GetBuildsByPullRequestsAsync(BuildMonitorSettings settings) { var projectUrl = settings.GetValueStrict(ProjectUrlSettingKey).TrimEnd('/'); var requestUrl = $"{projectUrl}/_apis/git/pullrequests?api-version={ApiVersion}"; - var requestResponse = await GetRequestResponse(requestUrl, settings); + var requestResponse = await GetRequestResponseAsync(requestUrl, settings).ConfigureAwait(false); if (requestResponse.IsSuccessStatusCode) { var dict = new Dictionary>(); - var result = await requestResponse.Content.ReadAsStringAsync(); + var result = await requestResponse.Content.ReadAsStringAsync().ConfigureAwait(false); var data = JsonConvert.DeserializeObject>(JObject.Parse(result)["value"].ToString()); foreach (var pullRequest in data) { - var buildsResponse = await GetBuildsOfPullRequest(pullRequest, settings); + var buildsResponse = await GetBuildsOfPullRequestAsync(pullRequest, settings).ConfigureAwait(false); if (buildsResponse.IsSuccessStatusCode) { dict.Add(pullRequest, buildsResponse.Data); } else { - throw new Exception($"Error while processing method!"); + throw new Exception("Error while processing method!"); } } @@ -126,36 +123,28 @@ public virtual async Task>> GetBuildsByPullRequ return new DataResponse> {Data = dict.Values.SelectMany(a => a).ToList(), StatusCode = requestResponse.StatusCode}; } - throw new Exception($"Error while processing method!"); + throw new Exception("Error while processing method!"); } - #endregion - - #region Protected Properties - protected abstract String ApiVersion { get; } - #endregion - - #region Private Static Methods - - private static async Task GetImageData(BuildMonitorSettings settings, IUser user) + private static async Task GetImageDataAsync(BuildMonitorSettings settings, IUser user) { try { - var response = await GetRequestResponse(user.ImageUrl, settings); + var response = await GetRequestResponseAsync(user.ImageUrl, settings).ConfigureAwait(false); if (response.IsSuccessStatusCode) { if (response.Content.Headers.ContentType.MediaType == "image/png") { - return await response.Content.ReadAsByteArrayAsync(); + return await response.Content.ReadAsByteArrayAsync().ConfigureAwait(false); } if (response.Content.Headers.ContentType.MediaType == "image/svg+xml") { using (var memoryStream = new MemoryStream()) { - await response.Content.CopyToAsync(memoryStream); + await response.Content.CopyToAsync(memoryStream).ConfigureAwait(false); memoryStream.Position = 0; var svgDoc = SvgDocument.Open(memoryStream); @@ -173,44 +162,39 @@ private static async Task GetImageData(BuildMonitorSettings settings, IU return null; } - private static async Task GetRequestResponse(String requestUrl, BuildMonitorSettings settings) + private static async Task GetRequestResponseAsync(String requestUrl, BuildMonitorSettings settings) { var credentials = settings.GetValueStrict(ProjectCredentialsSettingKey); var accessToken = settings.GetDefaultValueIfNotExists(PersonalAccessTokenSettingsKey); if (!String.IsNullOrWhiteSpace(accessToken)) { - return await HttpRequestHelper.GetRequestResponse(requestUrl, accessToken); + return await HttpRequestHelper.GetRequestResponseAsync(requestUrl, accessToken).ConfigureAwait(false); } - return await HttpRequestHelper.GetRequestResponse(requestUrl, credentials); + return await HttpRequestHelper.GetRequestResponseAsync(requestUrl, credentials).ConfigureAwait(false); } - #endregion - - #region Private Methods - - private async Task>> GetBuildsOfPullRequest(IPullRequest pullRequest, BuildMonitorSettings settings) + private async Task>> GetBuildsOfPullRequestAsync(IPullRequest pullRequest, BuildMonitorSettings settings) { var projectUrl = settings.GetValueStrict(ProjectUrlSettingKey).TrimEnd('/'); - var maxBuilds = settings.GetDefaultValueIfNotExists(MaxBuildsPerDefinitionSettingsKey); + var maxBuilds = settings.GetDefaultValueIfNotExists(MaxBuildsPerDefinitionSettingsKey) ?? 5; // use fallback value when no value was defined via settings - if (!maxBuilds.HasValue) maxBuilds = 5; var requestUrl = $"{projectUrl}/_apis/build/builds?api-version={ApiVersion}&branchName=refs%2Fpull%2F{pullRequest.Id}%2Fmerge&$top={maxBuilds}"; - var requestResponse = await GetRequestResponse(requestUrl, settings); + var requestResponse = await GetRequestResponseAsync(requestUrl, settings).ConfigureAwait(false); if (requestResponse.IsSuccessStatusCode) { - var result = await requestResponse.Content.ReadAsStringAsync(); + var result = await requestResponse.Content.ReadAsStringAsync().ConfigureAwait(false); var data = JsonConvert.DeserializeObject>(JObject.Parse(result)["value"].ToString()); - await ResolveAddtionalBuildData(settings, data, projectUrl); + await ResolveAdditionalBuildDataAsync(settings, data, projectUrl).ConfigureAwait(false); return new DataResponse> {Data = data, StatusCode = requestResponse.StatusCode}; } - throw new Exception($"Error while processing method!"); + throw new Exception("Error while processing method!"); } private Tuple GetGitOwnerAndRepo(String gitHubRepoUrl) @@ -233,32 +217,32 @@ private Tuple GetGitOwnerAndRepo(String gitHubRepoUrl) return null; } - private async Task ResolveAddtionalBuildData(BuildMonitorSettings settings, List data, String projectUrl) + private async Task ResolveAdditionalBuildDataAsync(BuildMonitorSettings settings, List data, String projectUrl) { data.Select(d => d.Definition).OfType().ToList().ForEach(d => d.BuildSettingsId = settings.UniqueId); - data.Select(d => d.Requester).OfType().ToList().ForEach(a => a.ImageDataLoader = GetImageData(settings, a)); + data.Select(d => d.Requester).OfType().ToList().ForEach(a => a.ImageDataLoader = GetImageDataAsync(settings, a)); - await ResolveSourceVersion(data, projectUrl, settings); - await ResolveArtifacts(data, projectUrl, settings); - await ResolveTestRuns(data, projectUrl, settings); + await ResolveSourceVersionAsync(data, projectUrl, settings).ConfigureAwait(false); + await ResolveArtifactsAsync(data, projectUrl, settings).ConfigureAwait(false); + await ResolveTestRunsAsync(data, projectUrl, settings).ConfigureAwait(false); } - private async Task ResolveArtifacts(IEnumerable builds, String projectUrl, BuildMonitorSettings settings) + private async Task ResolveArtifactsAsync(IEnumerable builds, String projectUrl, BuildMonitorSettings settings) { foreach (var build in builds) { var requestUrl = $"{projectUrl}/_apis/build/builds/{build.Id}/artifacts?api-version={ApiVersion}"; - var requestResponse = await GetRequestResponse(requestUrl, settings); + var requestResponse = await GetRequestResponseAsync(requestUrl, settings).ConfigureAwait(false); if (requestResponse.IsSuccessStatusCode) { - var result = await requestResponse.Content.ReadAsStringAsync(); + var result = await requestResponse.Content.ReadAsStringAsync().ConfigureAwait(false); build.Artifacts = JsonConvert.DeserializeObject>(JObject.Parse(result)["value"].ToString()); } } } - private async Task ResolveSourceVersion(IEnumerable builds, String projectUrl, BuildMonitorSettings settings) + private async Task ResolveSourceVersionAsync(IEnumerable builds, String projectUrl, BuildMonitorSettings settings) { var grpByRepoType = builds.GroupBy(a => a.Repository.RepositoryType); foreach (var group in grpByRepoType) @@ -268,7 +252,7 @@ private async Task ResolveSourceVersion(IEnumerable builds, String proje foreach (var build in group) { var requestUrl = $"{projectUrl}/_apis/tfvc/changesets/{build.SourceVersionInternal}?api-version=1.0&includeDetails=true"; - await SetSourceVersion(settings, requestUrl, build); + await SetSourceVersionAsync(settings, requestUrl, build).ConfigureAwait(false); } } else if (group.Key == RepositoryType.TfsGit) @@ -276,7 +260,7 @@ private async Task ResolveSourceVersion(IEnumerable builds, String proje foreach (var build in group) { var requestUrl = $"{projectUrl}/_apis/git/repositories/{build.Repository.Id}/commits/{build.SourceVersionInternal}?api-version=1.0"; - await SetSourceVersion(settings, requestUrl, build); + await SetSourceVersionAsync(settings, requestUrl, build).ConfigureAwait(false); } } else if (group.Key == RepositoryType.GitHub) @@ -291,10 +275,10 @@ private async Task ResolveSourceVersion(IEnumerable builds, String proje var ownerAndRepo = GetGitOwnerAndRepo(build.Repository.Id); var requestUrl = $"{GitHubApiPrefix}/repos/{ownerAndRepo.Item1}/{ownerAndRepo.Item2}/commits/{build.SourceVersionInternal}"; - var requestResponse = await HttpRequestHelper.GetRequestResponse(requestUrl); + var requestResponse = await HttpRequestHelper.GetRequestResponseAsync(requestUrl).ConfigureAwait(false); if (requestResponse.IsSuccessStatusCode) { - var result = await requestResponse.Content.ReadAsStringAsync(); + var result = await requestResponse.Content.ReadAsStringAsync().ConfigureAwait(false); build.SourceVersion = JsonConvert.DeserializeObject(result); } } @@ -303,32 +287,30 @@ private async Task ResolveSourceVersion(IEnumerable builds, String proje } } - private async Task ResolveTestRuns(IEnumerable builds, String projectUrl, BuildMonitorSettings settings) + private static async Task ResolveTestRunsAsync(IEnumerable builds, String projectUrl, BuildMonitorSettings settings) { foreach (var build in builds) { var requestUrl = $"{projectUrl}/_apis/test/runs?api-version=1.0&buildUri={build.Uri}"; - var requestResponse = await GetRequestResponse(requestUrl, settings); + var requestResponse = await GetRequestResponseAsync(requestUrl, settings).ConfigureAwait(false); if (requestResponse.IsSuccessStatusCode) { - var result = await requestResponse.Content.ReadAsStringAsync(); + var result = await requestResponse.Content.ReadAsStringAsync().ConfigureAwait(false); build.TestRuns = JsonConvert.DeserializeObject>(JObject.Parse(result)["value"].ToString()); } } } - private async Task SetSourceVersion(BuildMonitorSettings settings, String requestUrl, TBuild build) where TInnerSourceVersion : ISourceVersion, new() + private static async Task SetSourceVersionAsync(BuildMonitorSettings settings, String requestUrl, TBuild build) where TInnerSourceVersion : ISourceVersion, new() { - var requestResponse = await GetRequestResponse(requestUrl, settings); + var requestResponse = await GetRequestResponseAsync(requestUrl, settings).ConfigureAwait(false); if (requestResponse.IsSuccessStatusCode) { - var result = await requestResponse.Content.ReadAsStringAsync(); + var result = await requestResponse.Content.ReadAsStringAsync().ConfigureAwait(false); build.SourceVersion = JsonConvert.DeserializeObject(result); } } - - #endregion } internal abstract class TfsBuildProviderBase diff --git a/BuildsAppReborn.Access/TFS2017/Models/Tfs2017Build.cs b/BuildsAppReborn.Access/TFS2017/Models/Tfs2017Build.cs index 2de0e74..5f160d4 100644 --- a/BuildsAppReborn.Access/TFS2017/Models/Tfs2017Build.cs +++ b/BuildsAppReborn.Access/TFS2017/Models/Tfs2017Build.cs @@ -6,14 +6,10 @@ namespace BuildsAppReborn.Access.Models { internal class Tfs2017Build : TfsBuild { - #region Overrides of Base - [JsonConverter(typeof(InterfaceTypeConverter))] public override IBuildDefinition Definition { get; protected set; } [JsonConverter(typeof(InterfaceTypeConverter))] public override IUser Requester { get; protected set; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Access/TFS2017/Models/Tfs2017BuildDefinition.cs b/BuildsAppReborn.Access/TFS2017/Models/Tfs2017BuildDefinition.cs index b826369..faf0568 100644 --- a/BuildsAppReborn.Access/TFS2017/Models/Tfs2017BuildDefinition.cs +++ b/BuildsAppReborn.Access/TFS2017/Models/Tfs2017BuildDefinition.cs @@ -7,11 +7,7 @@ namespace BuildsAppReborn.Access.Models // ReSharper disable once ClassNeverInstantiated.Global internal class Tfs2017BuildDefinition : TfsBuildDefinition { - #region Overrides of Base - [JsonConverter(typeof(InterfaceTypeConverter))] public override IProject Project { get; protected set; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Access/TFS2017/Models/Tfs2017PullRequest.cs b/BuildsAppReborn.Access/TFS2017/Models/Tfs2017PullRequest.cs index 3fc0a32..2a6d0bd 100644 --- a/BuildsAppReborn.Access/TFS2017/Models/Tfs2017PullRequest.cs +++ b/BuildsAppReborn.Access/TFS2017/Models/Tfs2017PullRequest.cs @@ -7,11 +7,7 @@ namespace BuildsAppReborn.Access.Models // ReSharper disable once UnusedMember.Global internal class Tfs2017PullRequest : TfsPullRequest { - #region Overrides of Base - [JsonConverter(typeof(InterfaceTypeConverter))] public override IUser CreatedBy { get; protected set; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Access/TFS2017/Models/Tfs2017SourceVersion.cs b/BuildsAppReborn.Access/TFS2017/Models/Tfs2017SourceVersion.cs index a1e85e6..8b7121b 100644 --- a/BuildsAppReborn.Access/TFS2017/Models/Tfs2017SourceVersion.cs +++ b/BuildsAppReborn.Access/TFS2017/Models/Tfs2017SourceVersion.cs @@ -1,17 +1,12 @@ using BuildsAppReborn.Contracts.Models; using BuildsAppReborn.Infrastructure; - using Newtonsoft.Json; namespace BuildsAppReborn.Access.Models { internal class Tfs2017SourceVersion : TfsSourceVersion { - #region Overrides of Base - [JsonConverter(typeof(InterfaceTypeConverter))] public override INamedObject Author { get; protected set; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Access/TFS2017/Tfs2017BuildProvider.cs b/BuildsAppReborn.Access/TFS2017/Tfs2017BuildProvider.cs index f0dd351..6ad4a4a 100644 --- a/BuildsAppReborn.Access/TFS2017/Tfs2017BuildProvider.cs +++ b/BuildsAppReborn.Access/TFS2017/Tfs2017BuildProvider.cs @@ -9,14 +9,11 @@ namespace BuildsAppReborn.Access { [BuildProviderExport(typeof(IBuildProvider), Id, Name, AuthenticationModes.Default | AuthenticationModes.AccessToken)] [PartCreationPolicy(CreationPolicy.Shared)] - internal class Tfs2017BuildProvider : TfsBuildProviderBase + internal class Tfs2017BuildProvider : TfsBuildProviderBase { - #region Overrides of Base - protected override String ApiVersion => "2.0"; - #endregion - internal const String Id = "08e2efa9-2407-4f2e-a159-aa2b223abaac"; internal const String Name = "TFS 2017"; diff --git a/BuildsAppReborn.Access/VSTS/Models/VstsBuild.cs b/BuildsAppReborn.Access/VSTS/Models/VstsBuild.cs index 45b80d2..3b1f669 100644 --- a/BuildsAppReborn.Access/VSTS/Models/VstsBuild.cs +++ b/BuildsAppReborn.Access/VSTS/Models/VstsBuild.cs @@ -6,15 +6,10 @@ namespace BuildsAppReborn.Access.Models { internal class VstsBuild : TfsBuild { - #region Overrides of Base - [JsonConverter(typeof(InterfaceTypeConverter))] public override IBuildDefinition Definition { get; protected set; } [JsonConverter(typeof(InterfaceTypeConverter))] public override IUser Requester { get; protected set; } - - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Access/VSTS/Models/VstsBuildDefinition.cs b/BuildsAppReborn.Access/VSTS/Models/VstsBuildDefinition.cs index f70be75..945bd5e 100644 --- a/BuildsAppReborn.Access/VSTS/Models/VstsBuildDefinition.cs +++ b/BuildsAppReborn.Access/VSTS/Models/VstsBuildDefinition.cs @@ -7,11 +7,7 @@ namespace BuildsAppReborn.Access.Models // ReSharper disable once ClassNeverInstantiated.Global internal class VstsBuildDefinition : TfsBuildDefinition { - #region Overrides of Base - [JsonConverter(typeof(InterfaceTypeConverter))] public override IProject Project { get; protected set; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Access/VSTS/Models/VstsPullRequest.cs b/BuildsAppReborn.Access/VSTS/Models/VstsPullRequest.cs index 44d8ad5..8c89a44 100644 --- a/BuildsAppReborn.Access/VSTS/Models/VstsPullRequest.cs +++ b/BuildsAppReborn.Access/VSTS/Models/VstsPullRequest.cs @@ -7,11 +7,7 @@ namespace BuildsAppReborn.Access.Models // ReSharper disable once UnusedMember.Global internal class VstsPullRequest : TfsPullRequest { - #region Overrides of Base - [JsonConverter(typeof(InterfaceTypeConverter))] public override IUser CreatedBy { get; protected set; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Access/VSTS/Models/VstsSourceVersion.cs b/BuildsAppReborn.Access/VSTS/Models/VstsSourceVersion.cs index fba140e..a77eb59 100644 --- a/BuildsAppReborn.Access/VSTS/Models/VstsSourceVersion.cs +++ b/BuildsAppReborn.Access/VSTS/Models/VstsSourceVersion.cs @@ -1,17 +1,12 @@ using BuildsAppReborn.Contracts.Models; using BuildsAppReborn.Infrastructure; - using Newtonsoft.Json; namespace BuildsAppReborn.Access.Models { internal class VstsSourceVersion : TfsSourceVersion { - #region Overrides of Base - [JsonConverter(typeof(InterfaceTypeConverter))] public override INamedObject Author { get; protected set; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Access/VSTS/VstsBuildProvider.cs b/BuildsAppReborn.Access/VSTS/VstsBuildProvider.cs index 952902c..09ff84d 100644 --- a/BuildsAppReborn.Access/VSTS/VstsBuildProvider.cs +++ b/BuildsAppReborn.Access/VSTS/VstsBuildProvider.cs @@ -11,12 +11,8 @@ namespace BuildsAppReborn.Access [PartCreationPolicy(CreationPolicy.Shared)] internal class VstsBuildProvider : TfsBuildProviderBase { - #region Overrides of Base - protected override String ApiVersion => "2.0"; - #endregion - internal const String Id = "d1d878e8-7658-4eb0-b0bf-e6ab688e0b39"; internal const String Name = "VSTS"; diff --git a/BuildsAppReborn.Access/packages.config b/BuildsAppReborn.Access/packages.config index 7053b92..83d518d 100644 --- a/BuildsAppReborn.Access/packages.config +++ b/BuildsAppReborn.Access/packages.config @@ -1,6 +1,6 @@  - + \ No newline at end of file diff --git a/BuildsAppReborn.Client.Tests/Properties/AssemblyInfo.cs b/BuildsAppReborn.Client.Tests/Properties/AssemblyInfo.cs index e73d258..60e6ff4 100644 --- a/BuildsAppReborn.Client.Tests/Properties/AssemblyInfo.cs +++ b/BuildsAppReborn.Client.Tests/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following @@ -33,4 +32,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/BuildsAppReborn.Client/App.xaml.cs b/BuildsAppReborn.Client/App.xaml.cs index 5f53c0f..9e335d1 100644 --- a/BuildsAppReborn.Client/App.xaml.cs +++ b/BuildsAppReborn.Client/App.xaml.cs @@ -19,11 +19,12 @@ namespace BuildsAppReborn.Client /// public partial class App { - #region Overrides of Base - protected override void OnExit(ExitEventArgs e) { - if (e.ApplicationExitCode == 0) this.globalSettingsContainer.Save(); + if (e.ApplicationExitCode == 0) + { + this.globalSettingsContainer.Save(); + } this.updateChecker.Stop(); this.buildMonitor.Stop(); @@ -36,7 +37,8 @@ protected override void OnStartup(StartupEventArgs e) base.OnStartup(e); ToolTipService.ShowDurationProperty.OverrideMetadata( - typeof(DependencyObject), new FrameworkPropertyMetadata(Int32.MaxValue)); + typeof(DependencyObject), + new FrameworkPropertyMetadata(Int32.MaxValue)); RegisterToWindowsStartUp(); @@ -61,10 +63,6 @@ protected override void OnStartup(StartupEventArgs e) } } - #endregion - - #region Private Static Methods - private static CompositionContainer BuildCompositionContainer() { var catalog = new AggregateCatalog(); @@ -72,7 +70,9 @@ private static CompositionContainer BuildCompositionContainer() var directoryName = Path.GetDirectoryName(typeof(App).Assembly.Location); if (directoryName != null) { - var assemblies = Directory.GetFiles(directoryName, "*.dll").Union(Directory.GetFiles(directoryName, "*.exe")).Where(a => !String.Equals(Path.GetFileName(a), "NuGet.Squirrel.dll", StringComparison.InvariantCultureIgnoreCase) && !String.Equals(Path.GetFileName(a), "Update.exe", StringComparison.InvariantCultureIgnoreCase)); + var assemblies = Directory.GetFiles(directoryName, "*.dll").Union(Directory.GetFiles(directoryName, "*.exe")).Where( + a => !String.Equals(Path.GetFileName(a), "NuGet.Squirrel.dll", StringComparison.InvariantCultureIgnoreCase) && + !String.Equals(Path.GetFileName(a), "Update.exe", StringComparison.InvariantCultureIgnoreCase)); foreach (var assembly in assemblies) { @@ -90,10 +90,6 @@ private static CompositionContainer BuildCompositionContainer() return new CompositionContainer(catalog, true); } - #endregion - - #region Private Methods - private void EnsureOnlyOneInstance() { #if !DEBUG @@ -117,10 +113,6 @@ private void RegisterToWindowsStartUp() } } - #endregion - - #region Private Fields - private IBuildMonitorAdvanced buildMonitor; private GlobalSettingsContainer globalSettingsContainer; @@ -128,7 +120,5 @@ private void RegisterToWindowsStartUp() private TaskbarIcon notifyIcon; private UpdateChecker updateChecker; - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/BuildsAppReborn.Client.csproj b/BuildsAppReborn.Client/BuildsAppReborn.Client.csproj index f3736e8..5da79f5 100644 --- a/BuildsAppReborn.Client/BuildsAppReborn.Client.csproj +++ b/BuildsAppReborn.Client/BuildsAppReborn.Client.csproj @@ -55,17 +55,13 @@ ..\packages\DeltaCompressionDotNet.1.1.0\lib\net20\DeltaCompressionDotNet.PatchApi.dll True - - ..\packages\Dragablz.0.0.3.186\lib\net45\Dragablz.dll - True + + ..\packages\Dragablz.0.0.3.203\lib\net45\Dragablz.dll ..\packages\Hardcodet.NotifyIcon.Wpf.1.0.8\lib\net451\Hardcodet.Wpf.TaskbarNotification.dll True - - ..\packages\squirrel.windows.1.6.0\lib\Net45\ICSharpCode.SharpZipLib.dll - ..\packages\log4net.2.0.8\lib\net45-full\log4net.dll True @@ -79,41 +75,38 @@ ..\packages\MaterialDesignThemes.MahApps.0.0.10\lib\net45\MaterialDesignThemes.MahApps.dll - True ..\packages\MaterialDesignThemes.2.3.0.823\lib\net45\MaterialDesignThemes.Wpf.dll - True - - ..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.dll - True + + ..\packages\Mono.Cecil.0.10.0\lib\net40\Mono.Cecil.dll - - ..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Mdb.dll - True + + ..\packages\Mono.Cecil.0.10.0\lib\net40\Mono.Cecil.Mdb.dll - - ..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Pdb.dll - True + + ..\packages\Mono.Cecil.0.10.0\lib\net40\Mono.Cecil.Pdb.dll - - ..\packages\Mono.Cecil.0.9.6.4\lib\net45\Mono.Cecil.Rocks.dll - True + + ..\packages\Mono.Cecil.0.10.0\lib\net40\Mono.Cecil.Rocks.dll - ..\packages\squirrel.windows.1.6.0\lib\Net45\NuGet.Squirrel.dll + ..\packages\squirrel.windows.1.8.0\lib\Net45\NuGet.Squirrel.dll ..\packages\Prism.Core.6.3.0\lib\net45\Prism.dll True + + ..\packages\SharpCompress.0.17.1\lib\net45\SharpCompress.dll + ..\packages\Splat.2.0.0\lib\Net45\Splat.dll True - - ..\packages\squirrel.windows.1.6.0\lib\Net45\Squirrel.dll + + ..\packages\squirrel.windows.1.8.0\lib\Net45\Squirrel.dll @@ -126,13 +119,11 @@ 4.0 - - ..\packages\ToastNotifications.2.1.0\lib\net452\ToastNotifications.dll - True + + ..\packages\ToastNotifications.2.2.5\lib\net40\ToastNotifications.dll - - ..\packages\ToastNotifications.Messages.2.1.0\lib\net452\ToastNotifications.Messages.dll - True + + ..\packages\ToastNotifications.Messages.2.2.5\lib\net40\ToastNotifications.Messages.dll @@ -244,7 +235,9 @@ Designer - + + Designer + SettingsSingleFileGenerator Settings.Designer.cs diff --git a/BuildsAppReborn.Client/Cache/BuildCache.cs b/BuildsAppReborn.Client/Cache/BuildCache.cs index 3ee0df1..9be88e6 100644 --- a/BuildsAppReborn.Client/Cache/BuildCache.cs +++ b/BuildsAppReborn.Client/Cache/BuildCache.cs @@ -16,10 +16,11 @@ namespace BuildsAppReborn.Client [PartCreationPolicy(CreationPolicy.Shared)] public class BuildCache : ViewModelBase { - #region Constructors - [ImportingConstructor] - internal BuildCache(IBuildMonitorBasic buildMonitor, IEqualityComparer buildDefinitionEqualityComparer, IEqualityComparer pullRequstEqualityComparer, GeneralSettings generalSettings) + internal BuildCache(IBuildMonitorBasic buildMonitor, + IEqualityComparer buildDefinitionEqualityComparer, + IEqualityComparer pullRequstEqualityComparer, + GeneralSettings generalSettings) { BuildsStatus = new RangeObservableCollection(); this.buildDefinitionEqualityComparer = buildDefinitionEqualityComparer; @@ -32,7 +33,7 @@ internal BuildCache(IBuildMonitorBasic buildMonitor, IEqualityComparer BuildsStatus { get; private set; } + public RangeObservableCollection BuildsStatus { get; } public BuildCacheStatus CacheStatus { @@ -71,19 +68,13 @@ public String CurrentIcon } } - #endregion - - #region Protected Methods + public event EventHandler CacheUpdated; protected virtual void OnCacheUpdated() { CacheUpdated?.Invoke(this, EventArgs.Empty); } - #endregion - - #region Private Methods - private List GroupBuildsByDefinition(IEnumerable builds, ICollection currentBuildsStatus) { currentBuildsStatus = currentBuildsStatus.Where(a => a.BuildDefinition != null).OrderBy(a => a.BuildDefinition.Name).ToList(); @@ -133,7 +124,10 @@ private void OnBuildStatusChanged(BuildStatusGroup oldStatus, BuildStatusGroup n private void OnBuildsUpdated(ICollection builds) { - if (!builds.Any()) return; + if (!builds.Any()) + { + return; + } var buildStatusGroups = new List(); @@ -155,11 +149,11 @@ private void OnBuildsUpdated(ICollection builds) //buildStatusGroups = buildStatusGroups.OrderByDescending(a => a.CurrentBuild.BuildStartTime).ToList(); Application.Current.Dispatcher.Invoke(() => - { - BuildsStatus.Clear(); - BuildsStatus.AddRange(buildStatusGroups); - CacheStatus = BuildCacheStatus.Operational; - }); + { + BuildsStatus.Clear(); + BuildsStatus.AddRange(buildStatusGroups); + CacheStatus = BuildCacheStatus.Operational; + }); UpdateCurrentIcon(); OnCacheUpdated(); } @@ -176,7 +170,10 @@ private void UpdateCurrentIcon() } else if (CacheStatus == BuildCacheStatus.Operational) { - if (!BuildsStatus.Any()) return; + if (!BuildsStatus.Any()) + { + return; + } var relevantBuilds = new List(); foreach (var buildStatus in BuildsStatus) @@ -207,18 +204,10 @@ private void UpdateCurrentIcon() } } - #endregion - - #region Private Fields - private readonly IEqualityComparer buildDefinitionEqualityComparer; private BuildCacheStatus cacheStatus; private String currentIcon; - private readonly IEqualityComparer pullRequstEqualityComparer; private readonly GeneralSettings generalSettings; - - #endregion - - public event EventHandler CacheUpdated; + private readonly IEqualityComparer pullRequstEqualityComparer; } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/Controls/StackedBarGraph.xaml.cs b/BuildsAppReborn.Client/Controls/StackedBarGraph.xaml.cs index 78d398a..f265562 100644 --- a/BuildsAppReborn.Client/Controls/StackedBarGraph.xaml.cs +++ b/BuildsAppReborn.Client/Controls/StackedBarGraph.xaml.cs @@ -7,17 +7,11 @@ namespace BuildsAppReborn.Client.Controls { public partial class StackedBarGraph : UserControl { - #region Constructors - public StackedBarGraph() { InitializeComponent(); } - #endregion - - #region Public Properties - public Double BarWidth { get { return (Double) GetValue(BarWidthProperty); } @@ -48,22 +42,34 @@ public String Title set { SetValue(TitleProperty, value); } } - #endregion - public static readonly DependencyProperty BarWidthProperty = DependencyProperty.Register( - "BarWidth", typeof(Double), typeof(StackedBarGraph), new PropertyMetadata(20d)); - + "BarWidth", + typeof(Double), + typeof(StackedBarGraph), + new PropertyMetadata(20d)); public static readonly DependencyProperty ClickCommandParameterProperty = DependencyProperty.Register( - "ClickCommandParameter", typeof(Object), typeof(StackedBarGraph), new PropertyMetadata(default(Object))); + "ClickCommandParameter", + typeof(Object), + typeof(StackedBarGraph), + new PropertyMetadata(default(Object))); public static readonly DependencyProperty ClickCommandProperty = DependencyProperty.Register( - "ClickCommand", typeof(ICommand), typeof(StackedBarGraph), new PropertyMetadata(default(ICommand))); - - public static readonly DependencyProperty TitleProperty = DependencyProperty.Register( - "Title", typeof(String), typeof(StackedBarGraph), new PropertyMetadata(default(String))); + "ClickCommand", + typeof(ICommand), + typeof(StackedBarGraph), + new PropertyMetadata(default(ICommand))); public static readonly DependencyProperty ItemsProperty = DependencyProperty.Register( - "Items", typeof(StackedItemCollection), typeof(StackedBarGraph), new PropertyMetadata(default(StackedItemCollection))); + "Items", + typeof(StackedItemCollection), + typeof(StackedBarGraph), + new PropertyMetadata(default(StackedItemCollection))); + + public static readonly DependencyProperty TitleProperty = DependencyProperty.Register( + "Title", + typeof(String), + typeof(StackedBarGraph), + new PropertyMetadata(default(String))); } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/Controls/StackedBarGraphHeightConverter.cs b/BuildsAppReborn.Client/Controls/StackedBarGraphHeightConverter.cs index 3507398..b297585 100644 --- a/BuildsAppReborn.Client/Controls/StackedBarGraphHeightConverter.cs +++ b/BuildsAppReborn.Client/Controls/StackedBarGraphHeightConverter.cs @@ -6,8 +6,6 @@ namespace BuildsAppReborn.Client.Controls { internal class StackedBarGraphHeightConverter : IMultiValueConverter { - #region Implementation of IMultiValueConverter - public Object Convert(Object[] values, Type targetType, Object parameter, CultureInfo culture) { var maxHeight = (Double) values[0]; @@ -29,10 +27,6 @@ public Object[] ConvertBack(Object value, Type[] targetTypes, Object parameter, throw new NotSupportedException(); } - #endregion - - #region Private Static Methods - private static Double GetFactor(Int32 count, Int32 totalCount) { var factor = (Double) count / totalCount; @@ -46,10 +40,6 @@ private static Double GetHeight(Int32 count, Int32 totalCount, Double maxHeight) return maxHeight * factor; } - #endregion - - #region Private Methods - private Double GetExcessiveHeight(StackedItemCollection items, Double maxHeight) { var excessive = 0d; @@ -89,8 +79,6 @@ private Double GetNormalizedHeight(Int32 count, Int32 totalCount, Double maxHeig return (maxHeight - excessiveHeight) * factor; } - #endregion - private const Int32 MinHeight = 5; } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/Controls/StackedItem.cs b/BuildsAppReborn.Client/Controls/StackedItem.cs index b6ff15c..17c999a 100644 --- a/BuildsAppReborn.Client/Controls/StackedItem.cs +++ b/BuildsAppReborn.Client/Controls/StackedItem.cs @@ -6,18 +6,14 @@ namespace BuildsAppReborn.Client.Controls { public class StackedItem { - #region Public Properties - public Brush Color { get; set; } + public String Icon { get; set; } + public String Title { get; set; } public Int32 Value { get; set; } public Visibility Visibility => Value > 0 ? Visibility.Visible : Visibility.Collapsed; - - public string Icon { get; set; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/Controls/StackedItemCollection.cs b/BuildsAppReborn.Client/Controls/StackedItemCollection.cs index 87c879b..54b32b2 100644 --- a/BuildsAppReborn.Client/Controls/StackedItemCollection.cs +++ b/BuildsAppReborn.Client/Controls/StackedItemCollection.cs @@ -8,22 +8,14 @@ namespace BuildsAppReborn.Client.Controls { public class StackedItemCollection : ObservableCollection { - #region Constructors - public StackedItemCollection(List list) : base(list) { } - #endregion - - #region Public Properties - public String Title { get; set; } public Int32 TotalCount { get; set; } public Visibility Visibility => Items.Any(a => a.Visibility == Visibility.Visible) ? Visibility.Visible : Visibility.Collapsed; - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/Converter/BuildItemToRelativeMarginConverter.cs b/BuildsAppReborn.Client/Converter/BuildItemToRelativeMarginConverter.cs index 11198b7..3a7710d 100644 --- a/BuildsAppReborn.Client/Converter/BuildItemToRelativeMarginConverter.cs +++ b/BuildsAppReborn.Client/Converter/BuildItemToRelativeMarginConverter.cs @@ -10,12 +10,12 @@ namespace BuildsAppReborn.Client.Converter { public class BuildItemToRelativeMarginConverter : IMultiValueConverter { - #region Implementation of IMultiValueConverter - public Object Convert(Object[] values, Type targetType, Object parameter, CultureInfo culture) { if (values == null || values.Length < 4) + { return default(Thickness); + } var currentBuildItem = values[0] as BuildItem; var buildItems = values[1] as List; @@ -31,18 +31,17 @@ public Object Convert(Object[] values, Type targetType, Object parameter, Cultur { barHeight = 1; } + var topMargin = height - barHeight; return new Thickness(0, Math.Round(topMargin), 0, 0); } + return default(Thickness); } - public Object[] ConvertBack(Object value, Type[] targetTypes, Object parameter, CultureInfo culture) { throw new NotSupportedException(); } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/Converter/BuildStatusToImageConverter.cs b/BuildsAppReborn.Client/Converter/BuildStatusToImageConverter.cs index d20329c..46ac480 100644 --- a/BuildsAppReborn.Client/Converter/BuildStatusToImageConverter.cs +++ b/BuildsAppReborn.Client/Converter/BuildStatusToImageConverter.cs @@ -1,7 +1,6 @@ using System; using System.Globalization; using System.Windows.Data; - using BuildsAppReborn.Client.Resources; using BuildsAppReborn.Contracts.Models; using BuildsAppReborn.Infrastructure; @@ -10,8 +9,6 @@ namespace BuildsAppReborn.Client.Converter { public class BuildStatusToImageConverter : IValueConverter { - #region Implementation of IValueConverter - public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture) { var enumValue = EnumHelper.GetEnumValueFromObject(value); @@ -22,7 +19,5 @@ public Object ConvertBack(Object value, Type targetType, Object parameter, Cultu { throw new NotSupportedException(); } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/Converter/BuildStatusToSolidColorBrushBackgroundConverter.cs b/BuildsAppReborn.Client/Converter/BuildStatusToSolidColorBrushBackgroundConverter.cs index bfb40c0..ca83adb 100644 --- a/BuildsAppReborn.Client/Converter/BuildStatusToSolidColorBrushBackgroundConverter.cs +++ b/BuildsAppReborn.Client/Converter/BuildStatusToSolidColorBrushBackgroundConverter.cs @@ -10,8 +10,6 @@ namespace BuildsAppReborn.Client.Converter // might want to move this to some sort of configuration ... public class BuildStatusToSolidColorBrushBackgroundConverter : IValueConverter { - #region Implementation of IValueConverter - public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture) { var color = default(Color); @@ -40,6 +38,7 @@ public Object Convert(Object value, Type targetType, Object parameter, CultureIn color = Colors.Gray; break; } + return new SolidColorBrush(color); } @@ -47,7 +46,5 @@ public Object ConvertBack(Object value, Type targetType, Object parameter, Cultu { throw new NotSupportedException(); } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/Converter/BuildStatusToSolidColorBrushForegroundConverter.cs b/BuildsAppReborn.Client/Converter/BuildStatusToSolidColorBrushForegroundConverter.cs index 6b1b1ea..5db4117 100644 --- a/BuildsAppReborn.Client/Converter/BuildStatusToSolidColorBrushForegroundConverter.cs +++ b/BuildsAppReborn.Client/Converter/BuildStatusToSolidColorBrushForegroundConverter.cs @@ -10,8 +10,6 @@ namespace BuildsAppReborn.Client.Converter // might want to move this to some sort of configuration ... public class BuildStatusToSolidColorBrushForegroundConverter : IValueConverter { - #region Implementation of IValueConverter - public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture) { var color = default(Color); @@ -40,6 +38,7 @@ public Object Convert(Object value, Type targetType, Object parameter, CultureIn color = Colors.DarkGray; break; } + return new SolidColorBrush(color); } @@ -47,7 +46,5 @@ public Object ConvertBack(Object value, Type targetType, Object parameter, Cultu { throw new NotSupportedException(); } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/Converter/BuildTimeToElapsedTimeConverter.cs b/BuildsAppReborn.Client/Converter/BuildTimeToElapsedTimeConverter.cs index 41fc892..f7cf4b8 100644 --- a/BuildsAppReborn.Client/Converter/BuildTimeToElapsedTimeConverter.cs +++ b/BuildsAppReborn.Client/Converter/BuildTimeToElapsedTimeConverter.cs @@ -6,8 +6,6 @@ namespace BuildsAppReborn.Client.Converter { public class BuildTimeToElapsedTimeConverter : IValueConverter { - #region Implementation of IValueConverter - public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture) { var isTime = value is DateTime; @@ -27,10 +25,6 @@ public Object ConvertBack(Object value, Type targetType, Object parameter, Cultu throw new NotSupportedException(); } - #endregion - - #region Private Methods - private String GetReadableTimespan(TimeSpan elapsedTimeSpan) { var seconds = elapsedTimeSpan.Seconds; @@ -43,26 +37,29 @@ private String GetReadableTimespan(TimeSpan elapsedTimeSpan) { return $"- {GetReadableTimespan(elapsedTimeSpan.Duration())}"; } + if (hours == 0 && minutes == 0 && seconds > 0) { return seconds > 30 ? $"1m" : "<1m"; } + if (hours == 0 && minutes > 0) { return seconds > 30 ? $"{minutes + 1}m" : $"{minutes}m"; } + if (hours > 0) { return minutes > 30 ? $"{hours + 1}h" : $"{hours}h"; } } + if (days >= 1) { return hours > 12 ? $"{days + 1}d" : $"{days}d"; } + return "?"; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/Converter/CountToVisibilityConverter.cs b/BuildsAppReborn.Client/Converter/CountToVisibilityConverter.cs index 6bf650c..3b57e67 100644 --- a/BuildsAppReborn.Client/Converter/CountToVisibilityConverter.cs +++ b/BuildsAppReborn.Client/Converter/CountToVisibilityConverter.cs @@ -8,13 +8,13 @@ namespace BuildsAppReborn.Client.Converter { public class CountToVisibilityConverter : IValueConverter { - #region Implementation of IValueConverter - public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture) { var collection = value as ICollection; if (collection != null && collection.Count > 0) + { return Visibility.Visible; + } return Visibility.Collapsed; } @@ -23,7 +23,5 @@ public Object ConvertBack(Object value, Type targetType, Object parameter, Cultu { throw new NotSupportedException(); } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/Converter/EnumDescriptionConverter.cs b/BuildsAppReborn.Client/Converter/EnumDescriptionConverter.cs index c9cffc6..d3e75ed 100644 --- a/BuildsAppReborn.Client/Converter/EnumDescriptionConverter.cs +++ b/BuildsAppReborn.Client/Converter/EnumDescriptionConverter.cs @@ -1,7 +1,6 @@ using System; using System.ComponentModel; using System.Globalization; -using System.Reflection; using System.Windows.Data; namespace BuildsAppReborn.Client.Converter @@ -9,8 +8,6 @@ namespace BuildsAppReborn.Client.Converter // https://stackoverflow.com/a/3987099 public class EnumDescriptionConverter : IValueConverter { - #region Implementation of IValueConverter - Object IValueConverter.Convert(Object value, Type targetType, Object parameter, CultureInfo culture) { var myEnum = (Enum) value; @@ -23,10 +20,6 @@ Object IValueConverter.ConvertBack(Object value, Type targetType, Object paramet return String.Empty; } - #endregion - - #region Private Methods - private String GetEnumDescription(Enum enumObj) { var fieldInfo = enumObj.GetType().GetField(enumObj.ToString()); @@ -41,7 +34,5 @@ private String GetEnumDescription(Enum enumObj) var attrib = attribArray[0] as DescriptionAttribute; return attrib?.Description; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/Converter/FallBackNulltoLoadingConverter.cs b/BuildsAppReborn.Client/Converter/FallBackNulltoLoadingConverter.cs index 8639c48..5092b3b 100644 --- a/BuildsAppReborn.Client/Converter/FallBackNulltoLoadingConverter.cs +++ b/BuildsAppReborn.Client/Converter/FallBackNulltoLoadingConverter.cs @@ -7,8 +7,6 @@ namespace BuildsAppReborn.Client.Converter { public class FallBackNullToLoadingConverter : IValueConverter { - #region Implementation of IValueConverter - public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture) { return String.IsNullOrWhiteSpace(value?.ToString()) ? IconProvider.LoadingIcon : value; @@ -18,7 +16,5 @@ public Object ConvertBack(Object value, Type targetType, Object parameter, Cultu { throw new NotSupportedException(); } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/Converter/MinutesToTimeSpanConverter.cs b/BuildsAppReborn.Client/Converter/MinutesToTimeSpanConverter.cs index 2e7d365..4f31c1c 100644 --- a/BuildsAppReborn.Client/Converter/MinutesToTimeSpanConverter.cs +++ b/BuildsAppReborn.Client/Converter/MinutesToTimeSpanConverter.cs @@ -6,8 +6,6 @@ namespace BuildsAppReborn.Client.Converter { internal class MinutesToTimeSpanConverter : IValueConverter { - #region Implementation of IValueConverter - public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture) { if (value is TimeSpan) @@ -30,7 +28,5 @@ public Object ConvertBack(Object value, Type targetType, Object parameter, Cultu return Binding.DoNothing; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/Converter/NullVisibilityConverter.cs b/BuildsAppReborn.Client/Converter/NullVisibilityConverter.cs index 0d3497a..c717a06 100644 --- a/BuildsAppReborn.Client/Converter/NullVisibilityConverter.cs +++ b/BuildsAppReborn.Client/Converter/NullVisibilityConverter.cs @@ -7,8 +7,6 @@ namespace BuildsAppReborn.Client.Converter { public class NullVisibilityConverter : IValueConverter { - #region Implementation of IValueConverter - public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture) { return value == null ? Visibility.Collapsed : Visibility.Visible; @@ -18,7 +16,5 @@ public Object ConvertBack(Object value, Type targetType, Object parameter, Cultu { throw new NotImplementedException(); } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/Converter/TestRunToStackedItemsConverter.cs b/BuildsAppReborn.Client/Converter/TestRunToStackedItemsConverter.cs index 21f060f..c7ca7c0 100644 --- a/BuildsAppReborn.Client/Converter/TestRunToStackedItemsConverter.cs +++ b/BuildsAppReborn.Client/Converter/TestRunToStackedItemsConverter.cs @@ -11,8 +11,6 @@ namespace BuildsAppReborn.Client.Converter { public class TestRunToStackedItemsConverter : IValueConverter { - #region Implementation of IValueConverter - public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture) { var testRun = value as ITestRun; @@ -35,7 +33,5 @@ public Object ConvertBack(Object value, Type targetType, Object parameter, Cultu { throw new NotSupportedException(); } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/Converter/TimeSpanToNiceStringConverter.cs b/BuildsAppReborn.Client/Converter/TimeSpanToNiceStringConverter.cs index 188d935..92004e3 100644 --- a/BuildsAppReborn.Client/Converter/TimeSpanToNiceStringConverter.cs +++ b/BuildsAppReborn.Client/Converter/TimeSpanToNiceStringConverter.cs @@ -8,13 +8,13 @@ namespace BuildsAppReborn.Client.Converter { public class TimeSpanToNiceStringConverter : IValueConverter { - #region Implementation of IValueConverter - public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture) { var duration = value as TimeSpan?; if (duration == null) + { return value; + } var seconds = duration.Value.Seconds; var minutes = duration.Value.Minutes; @@ -27,13 +27,27 @@ public Object Convert(Object value, Type targetType, Object parameter, CultureIn { // don't care for anything other than days after one week if (days > 6) + { return days + "d"; + } values.Add(days + "d"); } - if (hours > 0) values.Add(hours + "h"); - if (minutes > 0) values.Add(minutes + "m"); - if (seconds >= 0) values.Add(seconds + "s"); + + if (hours > 0) + { + values.Add(hours + "h"); + } + + if (minutes > 0) + { + values.Add(minutes + "m"); + } + + if (seconds >= 0) + { + values.Add(seconds + "s"); + } var result = String.Join("", values.Take(2)); return result; @@ -43,7 +57,5 @@ public Object ConvertBack(Object value, Type targetType, Object parameter, Cultu { throw new NotSupportedException(); } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/GlobalSettingsContainer.cs b/BuildsAppReborn.Client/GlobalSettingsContainer.cs index 6ade988..f0c5b1b 100644 --- a/BuildsAppReborn.Client/GlobalSettingsContainer.cs +++ b/BuildsAppReborn.Client/GlobalSettingsContainer.cs @@ -2,7 +2,6 @@ using System.ComponentModel.Composition; using System.IO; using System.Linq; - using BuildsAppReborn.Contracts.Models; using BuildsAppReborn.Infrastructure; @@ -12,17 +11,11 @@ namespace BuildsAppReborn.Client [PartCreationPolicy(CreationPolicy.Shared)] internal class GlobalSettingsContainer { - #region Constructors - public GlobalSettingsContainer() { Load(); } - #endregion - - #region Public Properties - public SettingsContainer BuildMonitorSettingsContainer { get; set; } /// @@ -34,10 +27,7 @@ public GlobalSettingsContainer() [Export] public GeneralSettings GeneralSettings { - get - { - return this.generalSettingsContainer.Single(); - } + get { return this.generalSettingsContainer.Single(); } set { this.generalSettingsContainer.Clear(); @@ -45,20 +35,12 @@ public GeneralSettings GeneralSettings } } - #endregion - - #region Public Methods - public void Save() { BuildMonitorSettingsContainer.Save(this.buildMonitorSettingsFilePath); this.generalSettingsContainer.Save(this.generalSettingsFilePath); } - #endregion - - #region Private Methods - private void Load() { var buidSettings = "buildMonitorSettings.json"; @@ -81,16 +63,10 @@ private void Load() } } - #endregion - - #region Private Fields - private String buildMonitorSettingsFilePath; private SettingsContainer generalSettingsContainer; private String generalSettingsFilePath; - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/Interfaces/ICloseable.cs b/BuildsAppReborn.Client/Interfaces/ICloseable.cs index 2ff5f4b..1e2f958 100644 --- a/BuildsAppReborn.Client/Interfaces/ICloseable.cs +++ b/BuildsAppReborn.Client/Interfaces/ICloseable.cs @@ -2,10 +2,6 @@ { public interface ICloseable { - #region Public Methods - void OnClose(); - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/Interfaces/IHasDataContext.cs b/BuildsAppReborn.Client/Interfaces/IHasDataContext.cs index 8309137..dc64fc6 100644 --- a/BuildsAppReborn.Client/Interfaces/IHasDataContext.cs +++ b/BuildsAppReborn.Client/Interfaces/IHasDataContext.cs @@ -4,10 +4,6 @@ namespace BuildsAppReborn.Client.Interfaces { public interface IHasDataContext { - #region Public Properties - Object DataContext { get; set; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/Interfaces/ISaveable.cs b/BuildsAppReborn.Client/Interfaces/ISaveable.cs index 2968fe4..5fd8516 100644 --- a/BuildsAppReborn.Client/Interfaces/ISaveable.cs +++ b/BuildsAppReborn.Client/Interfaces/ISaveable.cs @@ -4,16 +4,8 @@ namespace BuildsAppReborn.Client.Interfaces { public interface ISaveable { - #region Public Properties - DelegateCommand SaveCommand { get; } - #endregion - - #region Public Methods - void OnSave(); - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/Interfaces/ISubSettingsControl.cs b/BuildsAppReborn.Client/Interfaces/ISubSettingsControl.cs index d4c34dc..39c881e 100644 --- a/BuildsAppReborn.Client/Interfaces/ISubSettingsControl.cs +++ b/BuildsAppReborn.Client/Interfaces/ISubSettingsControl.cs @@ -4,12 +4,8 @@ namespace BuildsAppReborn.Client.Interfaces { public interface ISubSettingsControl : IHasDataContext { - #region Public Properties - UInt32 Order { get; } String Title { get; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/Notification/NotificationManager.cs b/BuildsAppReborn.Client/Notification/NotificationManager.cs index ef70a02..bd4d9ef 100644 --- a/BuildsAppReborn.Client/Notification/NotificationManager.cs +++ b/BuildsAppReborn.Client/Notification/NotificationManager.cs @@ -16,10 +16,11 @@ namespace BuildsAppReborn.Client.Notification [PartCreationPolicy(CreationPolicy.Shared)] public class NotificationManager { - #region Constructors - [ImportingConstructor] - public NotificationManager(LazyContainer notificationProviders, BuildCache buildCache, IEqualityComparer buildEqualityComparer, ExportFactory buildsExportFactory) + public NotificationManager(LazyContainer notificationProviders, + BuildCache buildCache, + IEqualityComparer buildEqualityComparer, + ExportFactory buildsExportFactory) { this.buildCache = buildCache; this.buildEqualityComparer = buildEqualityComparer; @@ -29,10 +30,6 @@ public NotificationManager(LazyContainer GetChangedBuilds(IList builds) { @@ -68,20 +65,16 @@ private void ShowNotification() var changedBuilds = GetChangedBuilds(builds); foreach (var build in changedBuilds) { - this.notificationProvider?.ShowBuild(build, b => IconProvider.GetCachedIconPathForBuildStatus(b.Status), b => { Application.Current.Dispatcher.Invoke(() => { NotifyIconViewModel.OpenWindow(this.buildsExportFactory); }); }); + this.notificationProvider?.ShowBuild(build, + b => IconProvider.GetCachedIconPathForBuildStatus(b.Status), + b => { Application.Current.Dispatcher.Invoke(() => { NotifyIconViewModel.OpenWindow(this.buildsExportFactory); }); }); } } - #endregion - - #region Private Fields - private readonly BuildCache buildCache; private readonly IEqualityComparer buildEqualityComparer; private readonly ExportFactory buildsExportFactory; - private INotificationProvider notificationProvider; + private readonly INotificationProvider notificationProvider; private IList oldBuilds; - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/Properties/AssemblyInfo.cs b/BuildsAppReborn.Client/Properties/AssemblyInfo.cs index b98027a..167ee10 100644 --- a/BuildsAppReborn.Client/Properties/AssemblyInfo.cs +++ b/BuildsAppReborn.Client/Properties/AssemblyInfo.cs @@ -24,7 +24,6 @@ //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)] - [assembly: ThemeInfo( ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located //(used if a resource is not found in the page, diff --git a/BuildsAppReborn.Client/Resources/IconProvider.cs b/BuildsAppReborn.Client/Resources/IconProvider.cs index c4e3f8d..abb0a9d 100644 --- a/BuildsAppReborn.Client/Resources/IconProvider.cs +++ b/BuildsAppReborn.Client/Resources/IconProvider.cs @@ -5,15 +5,12 @@ using System.Linq; using System.Reflection; using System.Resources; - using BuildsAppReborn.Contracts.Models; namespace BuildsAppReborn.Client.Resources { internal static class IconProvider { - #region Constructors - static IconProvider() { try @@ -23,6 +20,7 @@ static IconProvider() { Directory.Delete(IconCacheFolder, true); } + Directory.CreateDirectory(IconCacheFolder); foreach (var iconResource in iconResources) @@ -35,7 +33,7 @@ static IconProvider() var filenamePath = Path.Combine(IconCacheFolder, fileName); using (var resourceStream = iconResource.Item2) { - using (var fileStream = File.Create(filenamePath, (Int32)resourceStream.Length)) + using (var fileStream = File.Create(filenamePath, (Int32) resourceStream.Length)) { var bytesInStream = new Byte[resourceStream.Length]; resourceStream.Read(bytesInStream, 0, bytesInStream.Length); @@ -56,25 +54,17 @@ static IconProvider() } } - #endregion - - #region Public Static Properties + public static String FailIcon => $"{IconsPath}{IcoPrefix}/failure.ico"; public static String LoadingIcon => $"{IconsPath}{IcoPrefix}/loading.ico"; public static String SettingsIcon => $"{IconsPath}{IcoPrefix}/settings.ico"; - public static String FailIcon => $"{IconsPath}{IcoPrefix}/failure.ico"; - public static String SuccessIcon => $"{IconsPath}{IcoPrefix}/succeeded.ico"; - public static String WarningIcon => $"{IconsPath}{IcoPrefix}/partially_exclamation.ico"; - public static String UnknownIcon => $"{IconsPath}{IcoPrefix}/partially_question.ico"; - #endregion - - #region Public Static Methods + public static String WarningIcon => $"{IconsPath}{IcoPrefix}/partially_exclamation.ico"; public static String GetCachedIconPathForBuildStatus(BuildStatus status) { @@ -86,10 +76,6 @@ public static String GetIconForBuildStatus(BuildStatus status) return $"{IconsPath}{IcoPrefix}/{GetIconFilename(status)}"; } - #endregion - - #region Private Static Methods - private static String GetIconFilename(BuildStatus status) { switch (status) @@ -119,7 +105,7 @@ private static Tuple[] GetResourceNames() { using (var reader = new ResourceReader(stream)) { - return reader.Cast().Select(entry => new Tuple((String)entry.Key, (Stream)entry.Value)).ToArray(); + return reader.Cast().Select(entry => new Tuple((String) entry.Key, (Stream) entry.Value)).ToArray(); } } } @@ -127,8 +113,6 @@ private static Tuple[] GetResourceNames() return Enumerable.Empty>().ToArray(); } - #endregion - private static readonly String IconCacheFolder = Path.Combine(Consts.ApplicationUserProfileFolder, "IconCache"); private const String IcoPrefix = "ICO"; diff --git a/BuildsAppReborn.Client/UpdateChecker.cs b/BuildsAppReborn.Client/UpdateChecker.cs index 615c455..939e02a 100644 --- a/BuildsAppReborn.Client/UpdateChecker.cs +++ b/BuildsAppReborn.Client/UpdateChecker.cs @@ -20,8 +20,6 @@ namespace BuildsAppReborn.Client [PartCreationPolicy(CreationPolicy.Shared)] internal class UpdateChecker { - #region Constructors - [ImportingConstructor] public UpdateChecker(GlobalSettingsContainer globalSettingsContainer, LazyContainer notificationProviders) { @@ -32,15 +30,14 @@ public UpdateChecker(GlobalSettingsContainer globalSettingsContainer, LazyContai this.notificationProvider = notificationProviders.GetSupportedNotificationProvider(); } - #endregion - - #region Public Methods - public void Start() { Stop(); - if (!GeneralSettings.CheckForUpdates) return; + if (!GeneralSettings.CheckForUpdates) + { + return; + } this.timer.Interval = GeneralSettings.UpdateCheckInterval.TotalMilliseconds; this.timer.Start(); @@ -51,33 +48,28 @@ public void Stop() this.timer.Stop(); } - public async void UpdateCheck(Boolean manualCheck) + public void UpdateCheck(Boolean manualCheck) { - await UpdateCheckInternal(manualCheck); + Task.Run(() => UpdateCheckInternalAsync(manualCheck)); } - #endregion - - #region Private Properties - private GeneralSettings GeneralSettings => this.globalSettingsContainer.GeneralSettings; - #endregion - - #region Private Methods - - private async void TimerOnElapsed(Object sender, ElapsedEventArgs elapsedEventArgs) + private void TimerOnElapsed(Object sender, ElapsedEventArgs elapsedEventArgs) { - await UpdateCheckInternal(false); + Task.Run(() => UpdateCheckInternalAsync(false)); } - private async Task UpdateCheckInternal(Boolean manualCheck) + private async Task UpdateCheckInternalAsync(Boolean manualCheck) { #if DEBUG return; #endif - if (!GeneralSettings.CheckForUpdates) return; + if (!GeneralSettings.CheckForUpdates) + { + return; + } this.logger.Info("Checking for update..."); try @@ -85,9 +77,9 @@ private async Task UpdateCheckInternal(Boolean manualCheck) var repo = Settings.Default.UpdateCheckUrl; using (var updateMgrTask = UpdateManager.GitHubUpdateManager(repo, null, null, null, GeneralSettings.IncludePreReleases)) { - using (var updateManager = await updateMgrTask) + using (var updateManager = await updateMgrTask.ConfigureAwait(false)) { - var updateInfo = await updateManager.CheckForUpdate(); + var updateInfo = await updateManager.CheckForUpdate().ConfigureAwait(false); if (updateInfo.ReleasesToApply.Any()) { this.logger.Info("New Update found!"); @@ -97,24 +89,28 @@ private async Task UpdateCheckInternal(Boolean manualCheck) { // ToDo: show if new update available } + // ToDo: implement update when user accepts } else { this.logger.Debug("Auto installing update..."); - await updateManager.DownloadReleases(updateInfo.ReleasesToApply); - var path = await updateManager.ApplyReleases(updateInfo); + await updateManager.DownloadReleases(updateInfo.ReleasesToApply).ConfigureAwait(false); + var path = await updateManager.ApplyReleases(updateInfo).ConfigureAwait(false); if (path != null) { this.logger.Debug("Update install finished."); if (GeneralSettings.NotifyOnNewUpdate) { this.notificationProvider?.ShowMessage($"{this.version.ProductName} - Update check finished!", - "New Updates installed. Click here to restart.", - () => UpdateManager.RestartApp(Path.Combine(path, Path.GetFileName(entryAssembly.Location)))); + "New Updates installed. Click here to restart.", + () => UpdateManager.RestartApp(Path.Combine(path, Path.GetFileName(entryAssembly.Location)))); } } - else this.logger.Debug("Update install failed."); + else + { + this.logger.Debug("Update install failed."); + } } } else @@ -138,18 +134,12 @@ private async Task UpdateCheckInternal(Boolean manualCheck) } } - #endregion - - #region Private Fields + private static readonly Assembly entryAssembly = Assembly.GetEntryAssembly(); private readonly GlobalSettingsContainer globalSettingsContainer; - private ILog logger = LogManager.GetLogger(typeof(UpdateChecker)); - private INotificationProvider notificationProvider; - private Timer timer = new Timer(); - private FileVersionInfo version = FileVersionInfo.GetVersionInfo(entryAssembly.Location); - - #endregion - - private static Assembly entryAssembly = Assembly.GetEntryAssembly(); + private readonly ILog logger = LogManager.GetLogger(typeof(UpdateChecker)); + private readonly INotificationProvider notificationProvider; + private readonly Timer timer = new Timer(); + private readonly FileVersionInfo version = FileVersionInfo.GetVersionInfo(entryAssembly.Location); } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/ViewModels/BuildsStatusViewModel.cs b/BuildsAppReborn.Client/ViewModels/BuildsStatusViewModel.cs index d88ade0..154404c 100644 --- a/BuildsAppReborn.Client/ViewModels/BuildsStatusViewModel.cs +++ b/BuildsAppReborn.Client/ViewModels/BuildsStatusViewModel.cs @@ -19,8 +19,6 @@ namespace BuildsAppReborn.Client.ViewModels [PartCreationPolicy(CreationPolicy.NonShared)] public class BuildsStatusViewModel : ViewModelBase, ICloseable { - #region Constructors - [ImportingConstructor] public BuildsStatusViewModel(BuildCache buildCache) { @@ -33,9 +31,13 @@ public BuildsStatusViewModel(BuildCache buildCache) TestRunClickCommand = new DelegateCommand(a => Task.Run(() => StartProcess(a?.WebUrl))); } - #endregion + public BuildCache BuildCache { get; } + + public DelegateCommand HistoryClickCommand { get; set; } - #region Implementation of ICloseable + public DelegateCommand OpenArtifactCommand { get; set; } + + public DelegateCommand TestRunClickCommand { get; set; } public void OnClose() { @@ -45,27 +47,14 @@ public void OnClose() this.timer?.Dispose(); } - #endregion - - #region Public Properties - - public BuildCache BuildCache { get; } - - public DelegateCommand HistoryClickCommand { get; set; } - - public DelegateCommand OpenArtifactCommand { get; set; } - - public DelegateCommand TestRunClickCommand { get; set; } - - #endregion - - #region Private Methods - private void OnBuildCacheUpdated(Object sender, EventArgs eventArgs) { this.timer?.Stop(); foreach (var buildStatus in BuildCache.BuildsStatus.ToList()) + { buildStatus.CurrentBuild.Refresh(); + } + this.timer?.Start(); } @@ -119,14 +108,8 @@ private Boolean StartProcess(String url) } } - #endregion - - #region Private Fields - private readonly ILog logger = LogManager.GetLogger(typeof(BuildsStatusViewModel)); private readonly Timer timer; - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/ViewModels/NotifyIconViewModel.cs b/BuildsAppReborn.Client/ViewModels/NotifyIconViewModel.cs index 9fc96c5..4d7bbd2 100644 --- a/BuildsAppReborn.Client/ViewModels/NotifyIconViewModel.cs +++ b/BuildsAppReborn.Client/ViewModels/NotifyIconViewModel.cs @@ -20,10 +20,13 @@ namespace BuildsAppReborn.Client.ViewModels [PartCreationPolicy(CreationPolicy.Shared)] public class NotifyIconViewModel : ViewModelBase { - #region Constructors - [ImportingConstructor] - internal NotifyIconViewModel(ExportFactory buildsExportFactory, ExportFactory settingsExportFactory, BuildCache buildCache, NotificationManager notificationManager, UpdateChecker updateChecker, GlobalSettingsContainer settingsContainer) + internal NotifyIconViewModel(ExportFactory buildsExportFactory, + ExportFactory settingsExportFactory, + BuildCache buildCache, + NotificationManager notificationManager, + UpdateChecker updateChecker, + GlobalSettingsContainer settingsContainer) { if (buildCache.CacheStatus == BuildCacheStatus.NotConfigured) { @@ -43,10 +46,6 @@ internal NotifyIconViewModel(ExportFactory buildsExportFactor Initialize(); } - #endregion - - #region Public Properties - public ICommand CheckUpdateCommand { get; private set; } public ICommand ExitApplicationCommand { get; private set; } @@ -68,10 +67,6 @@ public String TrayIcon } } - #endregion - - #region Internal Methods - internal static void OpenWindow(ExportFactory newWindow) { var currentMainWindow = Application.Current.MainWindow; @@ -128,21 +123,6 @@ internal static void OpenWindow(ExportFactory newWindow) } } - #endregion - - #region Private Methods - - private void Initialize() - { - ShowWindowCommand = new DelegateCommand(() => { OpenWindow(this.buildsExportFactory); }); - - ShowSettingsWindowCommand = new DelegateCommand(() => { OpenWindow(this.settingsExportFactory); }); - - ExitApplicationCommand = new DelegateCommand(() => Application.Current.Shutdown()); - - CheckUpdateCommand = new DelegateCommand(() => this.updateChecker.UpdateCheck(true)); - } - private static void RestoreWindowSettings(Window window, List windowSettings) { if (window == null || windowSettings == null) @@ -200,16 +180,22 @@ private static void WindowOnClosed(Object sender, EventArgs e) window.Closed -= WindowOnClosed; } - #endregion + private void Initialize() + { + ShowWindowCommand = new DelegateCommand(() => { OpenWindow(this.buildsExportFactory); }); - #region Private Fields + ShowSettingsWindowCommand = new DelegateCommand(() => { OpenWindow(this.settingsExportFactory); }); + + ExitApplicationCommand = new DelegateCommand(() => Application.Current.Shutdown()); + + CheckUpdateCommand = new DelegateCommand(() => this.updateChecker.UpdateCheck(true)); + } - private readonly ExportFactory buildsExportFactory; private static GlobalSettingsContainer globalSettingsContainer; + + private readonly ExportFactory buildsExportFactory; private readonly ExportFactory settingsExportFactory; private String trayIcon; private readonly UpdateChecker updateChecker; - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/ViewModels/Settings/GeneralSettingsViewModel.cs b/BuildsAppReborn.Client/ViewModels/Settings/GeneralSettingsViewModel.cs index c6b9ef4..6d30c19 100644 --- a/BuildsAppReborn.Client/ViewModels/Settings/GeneralSettingsViewModel.cs +++ b/BuildsAppReborn.Client/ViewModels/Settings/GeneralSettingsViewModel.cs @@ -2,12 +2,10 @@ using System.ComponentModel.Composition; using System.Diagnostics; using System.Reflection; - using BuildsAppReborn.Client.Interfaces; using BuildsAppReborn.Contracts; using BuildsAppReborn.Contracts.Models; using BuildsAppReborn.Infrastructure; - using Prism.Commands; namespace BuildsAppReborn.Client.ViewModels @@ -16,48 +14,16 @@ namespace BuildsAppReborn.Client.ViewModels [PartCreationPolicy(CreationPolicy.NonShared)] public class GeneralSettingsViewModel : ViewModelBase, ICloseable, ISaveable { - #region Constructors - [ImportingConstructor] internal GeneralSettingsViewModel(GlobalSettingsContainer globalSettingsContainer, UpdateChecker updateChecker, IBuildMonitorAdvanced buildMonitor) { this.globalSettingsContainer = globalSettingsContainer; - this.GeneralSettings = this.globalSettingsContainer.GeneralSettings.Clone(); + GeneralSettings = this.globalSettingsContainer.GeneralSettings.Clone(); this.updateChecker = updateChecker; this.buildMonitor = buildMonitor; SaveCommand = new DelegateCommand(OnSave); } - #endregion - - #region Implementation of ICloseable - - public void OnClose() - { - this.GeneralSettings = null; - } - - #endregion - - #region Implementation of ISaveable - - public DelegateCommand SaveCommand { get; } - - public void OnSave() - { - this.globalSettingsContainer.GeneralSettings = GeneralSettings.Clone(); - this.globalSettingsContainer.Save(); - - this.buildMonitor.Start(this.globalSettingsContainer.BuildMonitorSettingsContainer, this.globalSettingsContainer.GeneralSettings); - this.buildMonitor.BeginPollingBuilds(); - - this.updateChecker.Start(); - } - - #endregion - - #region Public Properties - public String CurrentAppVersion { get @@ -69,21 +35,35 @@ public String CurrentAppVersion var version = fileVersionInfo.ProductVersion; return version; } + return assembly.GetName().Version.ToString(); } } public GeneralSettings GeneralSettings { get; private set; } - #endregion + public DelegateCommand SaveCommand { get; } - #region Private Fields + public void OnClose() + { + GeneralSettings = null; + } - private readonly GlobalSettingsContainer globalSettingsContainer; + public void OnSave() + { + this.globalSettingsContainer.GeneralSettings = GeneralSettings.Clone(); + this.globalSettingsContainer.Save(); + + this.buildMonitor.Start(this.globalSettingsContainer.BuildMonitorSettingsContainer, this.globalSettingsContainer.GeneralSettings); + this.buildMonitor.BeginPollingBuildsAsync(); + + this.updateChecker.Start(); + } - private readonly UpdateChecker updateChecker; private readonly IBuildMonitorAdvanced buildMonitor; - #endregion + private readonly GlobalSettingsContainer globalSettingsContainer; + + private readonly UpdateChecker updateChecker; } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/ViewModels/Settings/ServerSettingsViewModel.cs b/BuildsAppReborn.Client/ViewModels/Settings/ServerSettingsViewModel.cs index 11ef741..5be60b8 100644 --- a/BuildsAppReborn.Client/ViewModels/Settings/ServerSettingsViewModel.cs +++ b/BuildsAppReborn.Client/ViewModels/Settings/ServerSettingsViewModel.cs @@ -3,14 +3,12 @@ using System.Collections.ObjectModel; using System.ComponentModel.Composition; using System.Linq; - using BuildsAppReborn.Client.Interfaces; using BuildsAppReborn.Contracts; using BuildsAppReborn.Contracts.Composition; using BuildsAppReborn.Contracts.Models; using BuildsAppReborn.Contracts.UI; using BuildsAppReborn.Infrastructure; - using Prism.Commands; namespace BuildsAppReborn.Client.ViewModels @@ -19,10 +17,10 @@ namespace BuildsAppReborn.Client.ViewModels [PartCreationPolicy(CreationPolicy.NonShared)] public class ServerSettingsViewModel : ViewModelBase, ISaveable, ICloseable { - #region Constructors - [ImportingConstructor] - internal ServerSettingsViewModel(GlobalSettingsContainer globalSettingsContainer, ExportFactoryContainer buildProviderViews, IBuildMonitorAdvanced buildMonitor) + internal ServerSettingsViewModel(GlobalSettingsContainer globalSettingsContainer, + ExportFactoryContainer buildProviderViews, + IBuildMonitorAdvanced buildMonitor) { this.globalSettingsContainer = globalSettingsContainer; this.buildMonitor = buildMonitor; @@ -37,47 +35,31 @@ internal ServerSettingsViewModel(GlobalSettingsContainer globalSettingsContainer RemoveProviderCommand = new DelegateCommand(OnRemoveView); } - #endregion + public DelegateCommand AddProviderCommand { get; } - #region Implementation of ICloseable + public IEnumerable AvailableProvider => BuildProviderViews.MetaData; + + public ExportFactoryContainer BuildProviderViews { get; } + + public DelegateCommand RemoveProviderCommand { get; } + + public DelegateCommand SaveCommand { get; } + + public ObservableCollection Views { get; } public void OnClose() { this.buildMonitorSettingsContainer = null; } - #endregion - - #region Implementation of ISaveable - - public DelegateCommand SaveCommand { get; } - public void OnSave() { this.globalSettingsContainer.BuildMonitorSettingsContainer = this.buildMonitorSettingsContainer.Clone(); this.globalSettingsContainer.Save(); this.buildMonitor.Start(this.globalSettingsContainer.BuildMonitorSettingsContainer, this.globalSettingsContainer.GeneralSettings); - this.buildMonitor.BeginPollingBuilds(); + this.buildMonitor.BeginPollingBuildsAsync(); } - #endregion - - #region Public Properties - - public DelegateCommand AddProviderCommand { get; } - - public IEnumerable AvailableProvider => BuildProviderViews.MetaData; - - public ExportFactoryContainer BuildProviderViews { get; } - - public DelegateCommand RemoveProviderCommand { get; } - - public ObservableCollection Views { get; } - - #endregion - - #region Private Methods - private void AddView(String providerid, BuildMonitorSettings buildMonitorSettings) { var providerView = BuildProviderViews.GetSingleOrDefault(a => a.Id == providerid); @@ -123,16 +105,10 @@ private void OnRemoveView(IBuildProviderView view) } } - #endregion - - #region Private Fields - private readonly IBuildMonitorAdvanced buildMonitor; private SettingsContainer buildMonitorSettingsContainer; private readonly GlobalSettingsContainer globalSettingsContainer; - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/ViewModels/Settings/SettingsViewModel.cs b/BuildsAppReborn.Client/ViewModels/Settings/SettingsViewModel.cs index 719d083..a86d594 100644 --- a/BuildsAppReborn.Client/ViewModels/Settings/SettingsViewModel.cs +++ b/BuildsAppReborn.Client/ViewModels/Settings/SettingsViewModel.cs @@ -1,7 +1,6 @@ using System.Collections.Generic; using System.ComponentModel.Composition; using System.Linq; - using BuildsAppReborn.Client.Interfaces; using BuildsAppReborn.Infrastructure; @@ -11,17 +10,13 @@ namespace BuildsAppReborn.Client.ViewModels [PartCreationPolicy(CreationPolicy.NonShared)] public class SettingsViewModel : ViewModelBase, ICloseable { - #region Constructors - [ImportingConstructor] internal SettingsViewModel([ImportMany] IEnumerable subSettings) { SubSettings = subSettings.OrderBy(a => a.Order).ToList(); } - #endregion - - #region Implementation of ICloseable + public IEnumerable SubSettings { get; } public void OnClose() { @@ -30,13 +25,5 @@ public void OnClose() closableVm?.OnClose(); } } - - #endregion - - #region Public Properties - - public IEnumerable SubSettings { get; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/Views/BuildsStatusView.xaml.cs b/BuildsAppReborn.Client/Views/BuildsStatusView.xaml.cs index ed6dd75..ad63cec 100644 --- a/BuildsAppReborn.Client/Views/BuildsStatusView.xaml.cs +++ b/BuildsAppReborn.Client/Views/BuildsStatusView.xaml.cs @@ -9,17 +9,11 @@ namespace BuildsAppReborn.Client.Views [PartCreationPolicy(CreationPolicy.NonShared)] public partial class BuildsStatusView : IBuildsStatusView { - #region Constructors - public BuildsStatusView() { InitializeComponent(); } - #endregion - - #region Overrides of Base - protected override void OnClosed(EventArgs e) { var closableVm = DataContext as ICloseable; @@ -28,16 +22,10 @@ protected override void OnClosed(EventArgs e) base.OnClosed(e); } - #endregion - - #region Private Properties - [Import] private BuildsStatusViewModel ViewModel { set { SetValue(DataContextProperty, value); } } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/Views/GeneralSettingsControl.xaml.cs b/BuildsAppReborn.Client/Views/GeneralSettingsControl.xaml.cs index d9227de..73c110a 100644 --- a/BuildsAppReborn.Client/Views/GeneralSettingsControl.xaml.cs +++ b/BuildsAppReborn.Client/Views/GeneralSettingsControl.xaml.cs @@ -9,23 +9,15 @@ namespace BuildsAppReborn.Client.Views [PartCreationPolicy(CreationPolicy.NonShared)] public partial class GeneralSettingsControl : ISubSettingsControl { - #region Constructors - public GeneralSettingsControl() { InitializeComponent(); } - #endregion - - #region Implementation of ISubSettingsControl - public UInt32 Order => 0; public String Title => "General Settings"; - #endregion - [Import] private GeneralSettingsViewModel ViewModel { diff --git a/BuildsAppReborn.Client/Views/ServerSettingsControl.xaml.cs b/BuildsAppReborn.Client/Views/ServerSettingsControl.xaml.cs index 9d6d4c3..05154d7 100644 --- a/BuildsAppReborn.Client/Views/ServerSettingsControl.xaml.cs +++ b/BuildsAppReborn.Client/Views/ServerSettingsControl.xaml.cs @@ -9,31 +9,19 @@ namespace BuildsAppReborn.Client.Views [PartCreationPolicy(CreationPolicy.NonShared)] public partial class ServerSettingsControl : ISubSettingsControl { - #region Constructors - public ServerSettingsControl() { InitializeComponent(); } - #endregion - - #region Implementation of ISubSettingsControl - - public String Title => "Server Settings"; - public UInt32 Order => 1; - #endregion - - #region Private Properties + public String Title => "Server Settings"; [Import] private ServerSettingsViewModel ViewModel { set { SetValue(DataContextProperty, value); } } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/Views/SettingsView.xaml.cs b/BuildsAppReborn.Client/Views/SettingsView.xaml.cs index 3bcf3a2..6ef617e 100644 --- a/BuildsAppReborn.Client/Views/SettingsView.xaml.cs +++ b/BuildsAppReborn.Client/Views/SettingsView.xaml.cs @@ -13,17 +13,11 @@ namespace BuildsAppReborn.Client.Views [PartCreationPolicy(CreationPolicy.NonShared)] public partial class SettingsView : ISettingsView { - #region Constructors - public SettingsView() { InitializeComponent(); } - #endregion - - #region Overrides of Base - protected override void OnClosed(EventArgs e) { var closableVm = DataContext as ICloseable; @@ -32,33 +26,27 @@ protected override void OnClosed(EventArgs e) base.OnClosed(e); } - #endregion - - #region Private Properties - [Import] private SettingsViewModel ViewModel { set { SetValue(DataContextProperty, value); } } - #endregion - - #region Private Methods - private void UIElement_OnPreviewMouseLeftButtonUp(Object sender, MouseButtonEventArgs e) { //until we had a StaysOpen glag to Drawer, this will help with scroll bars var dependencyObject = Mouse.Captured as DependencyObject; while (dependencyObject != null) { - if (dependencyObject is ScrollBar) return; + if (dependencyObject is ScrollBar) + { + return; + } + dependencyObject = VisualTreeHelper.GetParent(dependencyObject); } this.MenuToggleButton.IsChecked = false; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Client/packages.config b/BuildsAppReborn.Client/packages.config index cc8ae47..3095ff1 100644 --- a/BuildsAppReborn.Client/packages.config +++ b/BuildsAppReborn.Client/packages.config @@ -1,17 +1,18 @@  - + - + + - - - + + + \ No newline at end of file diff --git a/BuildsAppReborn.Contracts.UI/BuildItem.cs b/BuildsAppReborn.Contracts.UI/BuildItem.cs index 03b5bfc..e3d0cf1 100644 --- a/BuildsAppReborn.Contracts.UI/BuildItem.cs +++ b/BuildsAppReborn.Contracts.UI/BuildItem.cs @@ -8,18 +8,12 @@ namespace BuildsAppReborn.Contracts.UI { public class BuildItem : ViewModelBase { - #region Constructors - public BuildItem(IBuild build, BuildViewStyle viewStyle) { this.viewStyle = viewStyle; Build = build; } - #endregion - - #region Public Properties - public IBuild Build { get; } public TimeSpan BuildDuration => BuildEndTime - BuildStartTime; @@ -111,10 +105,6 @@ public String Description public String RequesterText => !RequesterIsCommitter ? $"Requested by: {Build.Requester.DisplayName}" : Build.Requester.DisplayName; - #endregion - - #region Public Methods - [SuppressMessage("ReSharper", "ExplicitCallerInfoArgument")] public void Refresh() { @@ -126,18 +116,8 @@ public void Refresh() OnPropertyChanged(nameof(CurrentTestRun)); } - #endregion - - #region Private Properties - private Boolean RequesterIsCommitter => Build?.SourceVersion?.Author?.Name == Build?.Requester?.DisplayName; - #endregion - - #region Private Fields - private readonly BuildViewStyle viewStyle; - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts.UI/BuildStatusGroup.cs b/BuildsAppReborn.Contracts.UI/BuildStatusGroup.cs index a3feb02..1631307 100644 --- a/BuildsAppReborn.Contracts.UI/BuildStatusGroup.cs +++ b/BuildsAppReborn.Contracts.UI/BuildStatusGroup.cs @@ -8,13 +8,6 @@ namespace BuildsAppReborn.Contracts.UI { public class BuildStatusGroup : ViewModelBase { - #region Constructors - - private BuildStatusGroup(IEnumerable buildItems) - { - AllBuildItems = buildItems?.OrderBy(a => a.Build?.QueueDateTime).ToList(); - } - public BuildStatusGroup(IPullRequest pullRequest, IEnumerable buildItems) : this(buildItems) { PullRequest = pullRequest; @@ -25,9 +18,10 @@ public BuildStatusGroup(IBuildDefinition buildDefinition, IEnumerable BuildDefinition = buildDefinition; } - #endregion - - #region Public Properties + private BuildStatusGroup(IEnumerable buildItems) + { + AllBuildItems = buildItems?.OrderBy(a => a.Build?.QueueDateTime).ToList(); + } public Boolean AdditionalInformationAvailable => AllBuildItems.Any(a => a.CurrentTestRun != null); @@ -51,12 +45,6 @@ public Boolean AdditionalInformationShown public IPullRequest PullRequest { get; } - #endregion - - #region Private Fields - private Boolean additionalInformationShown; - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts.UI/DeselectionPreventionBehavior.cs b/BuildsAppReborn.Contracts.UI/DeselectionPreventionBehavior.cs index 412849b..4098280 100644 --- a/BuildsAppReborn.Contracts.UI/DeselectionPreventionBehavior.cs +++ b/BuildsAppReborn.Contracts.UI/DeselectionPreventionBehavior.cs @@ -7,8 +7,6 @@ namespace BuildsAppReborn.Contracts.UI { public class DeselectionPreventionBehavior : Behavior { - #region Overrides of Base - protected override void OnAttached() { base.OnAttached(); @@ -23,10 +21,6 @@ protected override void OnDetaching() AssociatedObject.SelectionChanged -= SelectionChanged; } - #endregion - - #region Private Methods - private void SelectionChanged(Object sender, SelectionChangedEventArgs e) { // when last item is deselected, apply the deselected item again @@ -35,7 +29,5 @@ private void SelectionChanged(Object sender, SelectionChangedEventArgs e) AssociatedObject.SelectedItem = e.RemovedItems[0]; } } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts.UI/IBuildProviderView.cs b/BuildsAppReborn.Contracts.UI/IBuildProviderView.cs index 2346a39..bece3e8 100644 --- a/BuildsAppReborn.Contracts.UI/IBuildProviderView.cs +++ b/BuildsAppReborn.Contracts.UI/IBuildProviderView.cs @@ -4,12 +4,8 @@ namespace BuildsAppReborn.Contracts.UI { public interface IBuildProviderView { - #region Public Properties - String Header { get; } IBuildProviderViewModel ViewModel { get; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts.UI/IBuildProviderViewModel.cs b/BuildsAppReborn.Contracts.UI/IBuildProviderViewModel.cs index 4bfe7fc..2d5a2c3 100644 --- a/BuildsAppReborn.Contracts.UI/IBuildProviderViewModel.cs +++ b/BuildsAppReborn.Contracts.UI/IBuildProviderViewModel.cs @@ -1,14 +1,11 @@ using System; using System.Collections.Generic; - using BuildsAppReborn.Contracts.Models; namespace BuildsAppReborn.Contracts.UI { public interface IBuildProviderViewModel { - #region Public Properties - String DisplayName { get; } BuildMonitorSettings MonitorSettings { get; } @@ -17,12 +14,6 @@ public interface IBuildProviderViewModel String Url { get; } - #endregion - - #region Public Methods - void Initialize(BuildMonitorSettings settings); - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts.UI/Notifications/INotificationProvider.cs b/BuildsAppReborn.Contracts.UI/Notifications/INotificationProvider.cs index 75772fb..711bef6 100644 --- a/BuildsAppReborn.Contracts.UI/Notifications/INotificationProvider.cs +++ b/BuildsAppReborn.Contracts.UI/Notifications/INotificationProvider.cs @@ -5,20 +5,12 @@ namespace BuildsAppReborn.Contracts.UI.Notifications { public interface INotificationProvider { - #region Public Properties - Boolean IsSupported { get; } - #endregion - - #region Public Methods - void ShowBuild(IBuild build, Func iconProvider, Action notificationClickAction); void ShowMessage(String title, String message); void ShowMessage(String title, String message, Action clickAction); - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts.UI/Notifications/NotificationProviderExtensions.cs b/BuildsAppReborn.Contracts.UI/Notifications/NotificationProviderExtensions.cs index 047f779..97e83aa 100644 --- a/BuildsAppReborn.Contracts.UI/Notifications/NotificationProviderExtensions.cs +++ b/BuildsAppReborn.Contracts.UI/Notifications/NotificationProviderExtensions.cs @@ -1,5 +1,4 @@ using System.Linq; - using BuildsAppReborn.Contracts.Composition; using BuildsAppReborn.Infrastructure; @@ -7,8 +6,6 @@ namespace BuildsAppReborn.Contracts.UI.Notifications { public static class NotificationProviderExtensions { - #region Public Static Methods - public static INotificationProvider GetSupportedNotificationProvider(this LazyContainer notificationProviders) { var orderedKeys = notificationProviders.Keys.OrderByDescending(a => a.Priority); @@ -23,7 +20,5 @@ public static INotificationProvider GetSupportedNotificationProvider(this LazyCo return null; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/BuildsAppReborn.Contracts.csproj b/BuildsAppReborn.Contracts/BuildsAppReborn.Contracts.csproj index 4292dc8..42c1962 100644 --- a/BuildsAppReborn.Contracts/BuildsAppReborn.Contracts.csproj +++ b/BuildsAppReborn.Contracts/BuildsAppReborn.Contracts.csproj @@ -30,9 +30,8 @@ 4 - - ..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll - True + + ..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll diff --git a/BuildsAppReborn.Contracts/Composition/BuildProviderExportAttribute.cs b/BuildsAppReborn.Contracts/Composition/BuildProviderExportAttribute.cs index 0ecd3c2..8c036df 100644 --- a/BuildsAppReborn.Contracts/Composition/BuildProviderExportAttribute.cs +++ b/BuildsAppReborn.Contracts/Composition/BuildProviderExportAttribute.cs @@ -8,8 +8,6 @@ namespace BuildsAppReborn.Contracts.Composition [AttributeUsage(AttributeTargets.Class, Inherited = false)] public class BuildProviderExportAttribute : ExportAttribute, IBuildProviderMetadata { - #region Constructors - public BuildProviderExportAttribute(Type contractType, String guid, String name, AuthenticationModes supportedAuthenticationModes) : base(contractType) { @@ -18,16 +16,10 @@ public BuildProviderExportAttribute(Type contractType, String guid, String name, SupportedAuthenticationModes = supportedAuthenticationModes; } - #endregion - - #region Implementation of IBuildProviderMetadata + public String Id { get; } public String Name { get; } public AuthenticationModes SupportedAuthenticationModes { get; } - - public String Id { get; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/Composition/IBuildProviderMetadata.cs b/BuildsAppReborn.Contracts/Composition/IBuildProviderMetadata.cs index de34a55..d11b57b 100644 --- a/BuildsAppReborn.Contracts/Composition/IBuildProviderMetadata.cs +++ b/BuildsAppReborn.Contracts/Composition/IBuildProviderMetadata.cs @@ -4,10 +4,6 @@ namespace BuildsAppReborn.Contracts.Composition { public interface IBuildProviderMetadata : IIdentifierMetadata { - #region Public Properties - AuthenticationModes SupportedAuthenticationModes { get; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/Composition/IIdentifierMetadata.cs b/BuildsAppReborn.Contracts/Composition/IIdentifierMetadata.cs index 006f020..fa03490 100644 --- a/BuildsAppReborn.Contracts/Composition/IIdentifierMetadata.cs +++ b/BuildsAppReborn.Contracts/Composition/IIdentifierMetadata.cs @@ -4,12 +4,8 @@ namespace BuildsAppReborn.Contracts.Composition { public interface IIdentifierMetadata { - #region Public Properties - String Id { get; } String Name { get; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/Composition/IPriorityMetadata.cs b/BuildsAppReborn.Contracts/Composition/IPriorityMetadata.cs index 68d26f8..056eb79 100644 --- a/BuildsAppReborn.Contracts/Composition/IPriorityMetadata.cs +++ b/BuildsAppReborn.Contracts/Composition/IPriorityMetadata.cs @@ -4,10 +4,6 @@ namespace BuildsAppReborn.Contracts.Composition { public interface IPriorityMetadata { - #region Public Properties - Int32 Priority { get; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/Composition/IdentifierExportAttribute.cs b/BuildsAppReborn.Contracts/Composition/IdentifierExportAttribute.cs index 182169e..fac16ac 100644 --- a/BuildsAppReborn.Contracts/Composition/IdentifierExportAttribute.cs +++ b/BuildsAppReborn.Contracts/Composition/IdentifierExportAttribute.cs @@ -7,8 +7,6 @@ namespace BuildsAppReborn.Contracts.Composition [AttributeUsage(AttributeTargets.Class, Inherited = false)] public class IdentifierExportAttribute : ExportAttribute, IIdentifierMetadata { - #region Constructors - public IdentifierExportAttribute(Type contractType, String guid, String name = "") : base(contractType) { @@ -16,14 +14,8 @@ public IdentifierExportAttribute(Type contractType, String guid, String name = " Name = name; } - #endregion - - #region Implementation of IIdentifierMetadata - public String Id { get; } public String Name { get; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/Composition/PriorityExportAttribute.cs b/BuildsAppReborn.Contracts/Composition/PriorityExportAttribute.cs index 2a8465d..daed94c 100644 --- a/BuildsAppReborn.Contracts/Composition/PriorityExportAttribute.cs +++ b/BuildsAppReborn.Contracts/Composition/PriorityExportAttribute.cs @@ -7,20 +7,12 @@ namespace BuildsAppReborn.Contracts.Composition [AttributeUsage(AttributeTargets.Class, Inherited = false)] public class PriorityExportAttribute : ExportAttribute, IPriorityMetadata { - #region Constructors - public PriorityExportAttribute(Type contractType, Int32 priority) : base(contractType) { Priority = priority; } - #endregion - - #region Implementation of IPriorityMetadata - public Int32 Priority { get; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/Extensions/BuildDefinitionEqualityComparer.cs b/BuildsAppReborn.Contracts/Extensions/BuildDefinitionEqualityComparer.cs index f71a0ce..8999218 100644 --- a/BuildsAppReborn.Contracts/Extensions/BuildDefinitionEqualityComparer.cs +++ b/BuildsAppReborn.Contracts/Extensions/BuildDefinitionEqualityComparer.cs @@ -9,8 +9,6 @@ namespace BuildsAppReborn.Contracts.Extensions [Export(typeof(IEqualityComparer))] public class BuildDefinitionEqualityComparer : IEqualityComparer { - #region Implementation of IEqualityComparer - public Boolean Equals(IBuildDefinition x, IBuildDefinition y) { return x.Id == y.Id && x.Project.Id == y.Project.Id; @@ -22,9 +20,8 @@ public Int32 GetHashCode(IBuildDefinition obj) { return RuntimeHelpers.GetHashCode(null); } + return obj.Id.GetHashCode() + obj.Project.Id.GetHashCode(); } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/Extensions/BuildEqualityComparer.cs b/BuildsAppReborn.Contracts/Extensions/BuildEqualityComparer.cs index 110a815..d199554 100644 --- a/BuildsAppReborn.Contracts/Extensions/BuildEqualityComparer.cs +++ b/BuildsAppReborn.Contracts/Extensions/BuildEqualityComparer.cs @@ -9,18 +9,12 @@ namespace BuildsAppReborn.Contracts.Extensions [Export(typeof(IEqualityComparer))] public class BuildEqualityComparer : IEqualityComparer { - #region Constructors - [ImportingConstructor] public BuildEqualityComparer(IEqualityComparer buildDefinitionEqualityComparer) { this.buildDefinitionEqualityComparer = buildDefinitionEqualityComparer; } - #endregion - - #region Implementation of IEqualityComparer - public Boolean Equals(IBuild x, IBuild y) { return x.Id == y.Id && this.buildDefinitionEqualityComparer.Equals(x.Definition, y.Definition); @@ -32,15 +26,10 @@ public Int32 GetHashCode(IBuild obj) { return RuntimeHelpers.GetHashCode(null); } + return obj.Id.GetHashCode() + this.buildDefinitionEqualityComparer.GetHashCode(obj.Definition); } - #endregion - - #region Private Fields - private readonly IEqualityComparer buildDefinitionEqualityComparer; - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/Extensions/BuildProviderSettingsExtensions.cs b/BuildsAppReborn.Contracts/Extensions/BuildProviderSettingsExtensions.cs index 58096a7..89e010b 100644 --- a/BuildsAppReborn.Contracts/Extensions/BuildProviderSettingsExtensions.cs +++ b/BuildsAppReborn.Contracts/Extensions/BuildProviderSettingsExtensions.cs @@ -1,18 +1,22 @@ using System; using System.Collections.Generic; - using BuildsAppReborn.Contracts.Models; namespace BuildsAppReborn.Contracts.Extensions { public static class BuildProviderSettingsExtensions { - #region Public Static Methods - public static void ThrowIfKeyNotExists(this BuildMonitorSettings settings, String key) { - if (settings == null) throw new ArgumentNullException(nameof(settings)); - if (String.IsNullOrWhiteSpace(key)) throw new ArgumentNullException(nameof(key)); + if (settings == null) + { + throw new ArgumentNullException(nameof(settings)); + } + + if (String.IsNullOrWhiteSpace(key)) + { + throw new ArgumentNullException(nameof(key)); + } if (!settings.ContainsKey(key)) { @@ -22,19 +26,24 @@ public static void ThrowIfKeyNotExists(this BuildMonitorSettings settings, Strin public static void ThrowIfKeyNotExistsAndValueEmpty(this BuildMonitorSettings settings, String key) { - if (settings == null) throw new ArgumentNullException(nameof(settings)); - if (String.IsNullOrWhiteSpace(key)) throw new ArgumentNullException(nameof(key)); + if (settings == null) + { + throw new ArgumentNullException(nameof(settings)); + } + + if (String.IsNullOrWhiteSpace(key)) + { + throw new ArgumentNullException(nameof(key)); + } settings.ThrowIfKeyNotExists(key); var value = settings[key]; - if (value == null || (value is String && String.IsNullOrEmpty(value.ToString()))) + if (value == null || value is String && String.IsNullOrEmpty(value.ToString())) { throw new NullReferenceException($"Value for key {key} must not be empty or null!"); } } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/Extensions/PullRequestEqualityComparer.cs b/BuildsAppReborn.Contracts/Extensions/PullRequestEqualityComparer.cs index e0a386e..ab4d56a 100644 --- a/BuildsAppReborn.Contracts/Extensions/PullRequestEqualityComparer.cs +++ b/BuildsAppReborn.Contracts/Extensions/PullRequestEqualityComparer.cs @@ -9,8 +9,6 @@ namespace BuildsAppReborn.Contracts.Extensions [Export(typeof(IEqualityComparer))] public class PullRequestEqualityComparer : IEqualityComparer { - #region Implementation of IEqualityComparer - public Boolean Equals(IPullRequest x, IPullRequest y) { return x.Id == y.Id; @@ -25,7 +23,5 @@ public Int32 GetHashCode(IPullRequest obj) return obj.Id.GetHashCode(); } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/IBuildMonitorAdvanced.cs b/BuildsAppReborn.Contracts/IBuildMonitorAdvanced.cs index f18fdd0..7d1324e 100644 --- a/BuildsAppReborn.Contracts/IBuildMonitorAdvanced.cs +++ b/BuildsAppReborn.Contracts/IBuildMonitorAdvanced.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; - +using System.Collections.Generic; using BuildsAppReborn.Contracts.Models; namespace BuildsAppReborn.Contracts @@ -10,12 +8,8 @@ namespace BuildsAppReborn.Contracts /// public interface IBuildMonitorAdvanced : IBuildMonitorBasic { - #region Public Methods - void Start(IEnumerable settings, GeneralSettings generalSettings); void Stop(); - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/IBuildMonitorBasic.cs b/BuildsAppReborn.Contracts/IBuildMonitorBasic.cs index 71c357c..6ef8b28 100644 --- a/BuildsAppReborn.Contracts/IBuildMonitorBasic.cs +++ b/BuildsAppReborn.Contracts/IBuildMonitorBasic.cs @@ -1,30 +1,21 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; - using BuildsAppReborn.Contracts.Models; namespace BuildsAppReborn.Contracts { public interface IBuildMonitorBasic { - #region Public Properties - Boolean IsConfigured { get; } - #endregion - - #region Public Methods - - Task BeginPollingBuilds(); - - #endregion + Task BeginPollingBuildsAsync(); event BuildsUpdatedEventHandler BuildsUpdated; - event EventHandler MonitorStopped; - event EventHandler MonitorStarted; + + event EventHandler MonitorStopped; } public delegate void BuildsUpdatedEventHandler(ICollection builds); diff --git a/BuildsAppReborn.Contracts/IBuildProvider.cs b/BuildsAppReborn.Contracts/IBuildProvider.cs index 97ca64e..7a5374a 100644 --- a/BuildsAppReborn.Contracts/IBuildProvider.cs +++ b/BuildsAppReborn.Contracts/IBuildProvider.cs @@ -6,14 +6,10 @@ namespace BuildsAppReborn.Contracts { public interface IBuildProvider { - #region Public Methods + Task>> GetBuildDefinitionsAsync(BuildMonitorSettings settings); - Task>> GetBuildDefinitions(BuildMonitorSettings settings); + Task>> GetBuildsAsync(IEnumerable buildDefinitions, BuildMonitorSettings settings); - Task>> GetBuilds(IEnumerable buildDefinitions, BuildMonitorSettings settings); - - Task>> GetBuildsByPullRequests(BuildMonitorSettings settings); - - #endregion + Task>> GetBuildsByPullRequestsAsync(BuildMonitorSettings settings); } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/Models/Base/IObjectItem.cs b/BuildsAppReborn.Contracts/Models/Base/IObjectItem.cs index 7a36f1f..caf49ac 100644 --- a/BuildsAppReborn.Contracts/Models/Base/IObjectItem.cs +++ b/BuildsAppReborn.Contracts/Models/Base/IObjectItem.cs @@ -4,10 +4,6 @@ namespace BuildsAppReborn.Contracts.Models.Base { public interface IObjectItem { - #region Public Properties - String Url { get; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/Models/Base/IWebItem.cs b/BuildsAppReborn.Contracts/Models/Base/IWebItem.cs index d579dfb..bd9fd12 100644 --- a/BuildsAppReborn.Contracts/Models/Base/IWebItem.cs +++ b/BuildsAppReborn.Contracts/Models/Base/IWebItem.cs @@ -4,10 +4,6 @@ namespace BuildsAppReborn.Contracts.Models.Base { public interface IWebItem { - #region Public Properties - String WebUrl { get; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/Models/BuildMonitorSettings.cs b/BuildsAppReborn.Contracts/Models/BuildMonitorSettings.cs index 565e1f6..af9dc3f 100644 --- a/BuildsAppReborn.Contracts/Models/BuildMonitorSettings.cs +++ b/BuildsAppReborn.Contracts/Models/BuildMonitorSettings.cs @@ -1,8 +1,6 @@ using System; using System.Collections.Generic; - using BuildsAppReborn.Contracts.Extensions; - using Newtonsoft.Json; // ReSharper disable UnusedAutoPropertyAccessor.Global @@ -12,8 +10,6 @@ namespace BuildsAppReborn.Contracts.Models [JsonDictionary] public class BuildMonitorSettings : Dictionary { - #region Constructors - // ReSharper disable once MemberCanBePrivate.Global public BuildMonitorSettings() { @@ -27,37 +23,21 @@ public BuildMonitorSettings(String buildProviderId) UniqueId = Guid.NewGuid().ToString(); } - #endregion - - #region Public Properties - /// /// Don't know how to get JSON to deserialize properties AND dictionary at the same time /// [JsonIgnore] public String BuildProviderId { - get - { - return GetDefaultValueIfNotExists(nameof(BuildProviderId)); - } - private set - { - this[nameof(BuildProviderId)] = value; - } + get { return GetDefaultValueIfNotExists(nameof(BuildProviderId)); } + private set { this[nameof(BuildProviderId)] = value; } } [JsonIgnore] public ICollection SelectedBuildDefinitions { - get - { - return GetValue>(nameof(SelectedBuildDefinitions)); - } - private set - { - this[nameof(SelectedBuildDefinitions)] = value; - } + get { return GetValue>(nameof(SelectedBuildDefinitions)); } + private set { this[nameof(SelectedBuildDefinitions)] = value; } } /// @@ -66,20 +46,10 @@ private set [JsonIgnore] public String UniqueId { - get - { - return GetDefaultValueIfNotExists(nameof(UniqueId)); - } - private set - { - this[nameof(UniqueId)] = value; - } + get { return GetDefaultValueIfNotExists(nameof(UniqueId)); } + private set { this[nameof(UniqueId)] = value; } } - #endregion - - #region Public Methods - /// /// Gets the default value if not exists. /// @@ -90,8 +60,9 @@ public TValue GetDefaultValueIfNotExists(String key) { if (ContainsKey(key)) { - return (TValue)this[key]; + return (TValue) this[key]; } + return default(TValue); } @@ -105,7 +76,7 @@ public TValue GetDefaultValueIfNotExists(String key) public TValue GetValue(String key) { this.ThrowIfKeyNotExists(key); - return (TValue)this[key]; + return (TValue) this[key]; } /// @@ -119,9 +90,7 @@ public TValue GetValue(String key) public TValue GetValueStrict(String key) { this.ThrowIfKeyNotExistsAndValueEmpty(key); - return (TValue)this[key]; + return (TValue) this[key]; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/Models/BuildViewStyle.cs b/BuildsAppReborn.Contracts/Models/BuildViewStyle.cs index 2093cc6..1309353 100644 --- a/BuildsAppReborn.Contracts/Models/BuildViewStyle.cs +++ b/BuildsAppReborn.Contracts/Models/BuildViewStyle.cs @@ -4,10 +4,8 @@ namespace BuildsAppReborn.Contracts.Models { public enum BuildViewStyle { - [Description("Build Definition")] - GroupByBuildDefinition, + [Description("Build Definition")] GroupByBuildDefinition, - [Description("Pull Request")] - GroupByPullRequest + [Description("Pull Request")] GroupByPullRequest } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/Models/DataResponse.cs b/BuildsAppReborn.Contracts/Models/DataResponse.cs index fcbab77..49868f5 100644 --- a/BuildsAppReborn.Contracts/Models/DataResponse.cs +++ b/BuildsAppReborn.Contracts/Models/DataResponse.cs @@ -5,8 +5,6 @@ namespace BuildsAppReborn.Contracts.Models { public class DataResponse { - #region Public Properties - public T Data { get; set; } public Boolean IsSuccessStatusCode @@ -14,7 +12,9 @@ public Boolean IsSuccessStatusCode get { if (StatusCode >= HttpStatusCode.OK) + { return StatusCode <= (HttpStatusCode) 299; + } return false; } @@ -22,10 +22,6 @@ public Boolean IsSuccessStatusCode public HttpStatusCode StatusCode { get; set; } - #endregion - - #region Public Methods - public void ThrowIfUnsuccessful() { if (!IsSuccessStatusCode) @@ -33,7 +29,5 @@ public void ThrowIfUnsuccessful() throw new DataResponseUnsuccessfulException(StatusCode); } } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/Models/DataResponseUnsuccessfulException.cs b/BuildsAppReborn.Contracts/Models/DataResponseUnsuccessfulException.cs index fd5fba6..3ee110f 100644 --- a/BuildsAppReborn.Contracts/Models/DataResponseUnsuccessfulException.cs +++ b/BuildsAppReborn.Contracts/Models/DataResponseUnsuccessfulException.cs @@ -5,19 +5,11 @@ namespace BuildsAppReborn.Contracts.Models { public class DataResponseUnsuccessfulException : Exception { - #region Constructors - public DataResponseUnsuccessfulException(HttpStatusCode statusCode) { StatusCode = statusCode; } - #endregion - - #region Public Properties - public HttpStatusCode StatusCode { get; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/Models/GeneralSettings.cs b/BuildsAppReborn.Contracts/Models/GeneralSettings.cs index 2a9169b..8533ce5 100644 --- a/BuildsAppReborn.Contracts/Models/GeneralSettings.cs +++ b/BuildsAppReborn.Contracts/Models/GeneralSettings.cs @@ -7,8 +7,6 @@ namespace BuildsAppReborn.Contracts.Models [PartCreationPolicy(CreationPolicy.Shared)] public class GeneralSettings { - #region Constructors - public GeneralSettings() { // currently default values @@ -26,10 +24,6 @@ public GeneralSettings() } } - #endregion - - #region Public Properties - public Boolean AutoInstall { get; set; } public Boolean CheckForUpdates { get; set; } @@ -45,7 +39,5 @@ public GeneralSettings() public BuildViewStyle ViewStyle { get; set; } public List WindowSettings { get; set; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/Models/IArtifact.cs b/BuildsAppReborn.Contracts/Models/IArtifact.cs index 5209b81..ba524ca 100644 --- a/BuildsAppReborn.Contracts/Models/IArtifact.cs +++ b/BuildsAppReborn.Contracts/Models/IArtifact.cs @@ -4,8 +4,6 @@ namespace BuildsAppReborn.Contracts.Models { public interface IArtifact { - #region Public Properties - String Data { get; } String DownloadUrl { get; } @@ -15,7 +13,5 @@ public interface IArtifact String Name { get; } String Type { get; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/Models/IBuild.cs b/BuildsAppReborn.Contracts/Models/IBuild.cs index 61b7517..195ff62 100644 --- a/BuildsAppReborn.Contracts/Models/IBuild.cs +++ b/BuildsAppReborn.Contracts/Models/IBuild.cs @@ -6,8 +6,6 @@ namespace BuildsAppReborn.Contracts.Models { public interface IBuild : IObjectItem, IWebItem { - #region Public Properties - IEnumerable Artifacts { get; } String BuildNumber { get; } @@ -31,7 +29,5 @@ public interface IBuild : IObjectItem, IWebItem BuildStatus Status { get; } IEnumerable TestRuns { get; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/Models/IBuildDefinition.cs b/BuildsAppReborn.Contracts/Models/IBuildDefinition.cs index c321b0f..ca7d191 100644 --- a/BuildsAppReborn.Contracts/Models/IBuildDefinition.cs +++ b/BuildsAppReborn.Contracts/Models/IBuildDefinition.cs @@ -5,8 +5,6 @@ namespace BuildsAppReborn.Contracts.Models { public interface IBuildDefinition : IObjectItem { - #region Public Properties - String BuildSettingsId { get; } Int32 Id { get; } @@ -16,7 +14,5 @@ public interface IBuildDefinition : IObjectItem IProject Project { get; } String Type { get; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/Models/INamedObject.cs b/BuildsAppReborn.Contracts/Models/INamedObject.cs index 9f08f31..0073d34 100644 --- a/BuildsAppReborn.Contracts/Models/INamedObject.cs +++ b/BuildsAppReborn.Contracts/Models/INamedObject.cs @@ -4,10 +4,6 @@ namespace BuildsAppReborn.Contracts.Models { public interface INamedObject { - #region Public Properties - String Name { get; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/Models/IProject.cs b/BuildsAppReborn.Contracts/Models/IProject.cs index 0da4045..a348bca 100644 --- a/BuildsAppReborn.Contracts/Models/IProject.cs +++ b/BuildsAppReborn.Contracts/Models/IProject.cs @@ -5,14 +5,10 @@ namespace BuildsAppReborn.Contracts.Models { public interface IProject : IObjectItem { - #region Public Properties - String Description { get; } String Id { get; } String Name { get; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/Models/IPullRequest.cs b/BuildsAppReborn.Contracts/Models/IPullRequest.cs index 3a628ce..3e3d53a 100644 --- a/BuildsAppReborn.Contracts/Models/IPullRequest.cs +++ b/BuildsAppReborn.Contracts/Models/IPullRequest.cs @@ -4,8 +4,6 @@ namespace BuildsAppReborn.Contracts.Models { public interface IPullRequest { - #region Public Properties - IUser CreatedBy { get; } String Description { get; } @@ -21,7 +19,5 @@ public interface IPullRequest String Target { get; } String Title { get; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/Models/ISourceVersion.cs b/BuildsAppReborn.Contracts/Models/ISourceVersion.cs index fbb566e..950f219 100644 --- a/BuildsAppReborn.Contracts/Models/ISourceVersion.cs +++ b/BuildsAppReborn.Contracts/Models/ISourceVersion.cs @@ -4,14 +4,10 @@ namespace BuildsAppReborn.Contracts.Models { public interface ISourceVersion { - #region Public Properties - INamedObject Author { get; } String Comment { get; } String PortalUrl { get; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/Models/ITestRun.cs b/BuildsAppReborn.Contracts/Models/ITestRun.cs index c66e51e..57256db 100644 --- a/BuildsAppReborn.Contracts/Models/ITestRun.cs +++ b/BuildsAppReborn.Contracts/Models/ITestRun.cs @@ -5,8 +5,6 @@ namespace BuildsAppReborn.Contracts.Models { public interface ITestRun : IObjectItem, IWebItem { - #region Public Properties - Int32 FailedTests { get; } Int32 Id { get; } @@ -22,7 +20,5 @@ public interface ITestRun : IObjectItem, IWebItem String State { get; } Int32 TotalTests { get; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/Models/IUser.cs b/BuildsAppReborn.Contracts/Models/IUser.cs index d5cfb03..313bf04 100644 --- a/BuildsAppReborn.Contracts/Models/IUser.cs +++ b/BuildsAppReborn.Contracts/Models/IUser.cs @@ -5,8 +5,6 @@ namespace BuildsAppReborn.Contracts.Models { public interface IUser : IObjectItem { - #region Public Properties - String DisplayName { get; } String Id { get; } @@ -16,7 +14,5 @@ public interface IUser : IObjectItem String ImageUrl { get; } String UniqueName { get; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/Models/WindowSetting.cs b/BuildsAppReborn.Contracts/Models/WindowSetting.cs index 51039b9..ec40eff 100644 --- a/BuildsAppReborn.Contracts/Models/WindowSetting.cs +++ b/BuildsAppReborn.Contracts/Models/WindowSetting.cs @@ -5,8 +5,6 @@ namespace BuildsAppReborn.Contracts.Models { public class WindowSetting { - #region Public Properties - public Double Height { get; set; } public String Id { get; set; } @@ -17,7 +15,5 @@ public class WindowSetting public Double Width { get; set; } public WindowState WindowState { get; set; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Contracts/packages.config b/BuildsAppReborn.Contracts/packages.config index 50e4724..5762754 100644 --- a/BuildsAppReborn.Contracts/packages.config +++ b/BuildsAppReborn.Contracts/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/BuildsAppReborn.Infrastructure.Tests/Properties/AssemblyInfo.cs b/BuildsAppReborn.Infrastructure.Tests/Properties/AssemblyInfo.cs index 6cfc96d..9b1da12 100644 --- a/BuildsAppReborn.Infrastructure.Tests/Properties/AssemblyInfo.cs +++ b/BuildsAppReborn.Infrastructure.Tests/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following @@ -33,4 +32,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] \ No newline at end of file diff --git a/BuildsAppReborn.Infrastructure.Tests/SettingsContainerTests.cs b/BuildsAppReborn.Infrastructure.Tests/SettingsContainerTests.cs index e246779..393f2b9 100644 --- a/BuildsAppReborn.Infrastructure.Tests/SettingsContainerTests.cs +++ b/BuildsAppReborn.Infrastructure.Tests/SettingsContainerTests.cs @@ -5,7 +5,6 @@ using System.Linq; using BuildsAppReborn.Contracts.Models; using BuildsAppReborn.Infrastructure.Tests.TestData; - using Microsoft.VisualStudio.TestTools.UnitTesting; namespace BuildsAppReborn.Infrastructure.Tests @@ -13,8 +12,6 @@ namespace BuildsAppReborn.Infrastructure.Tests [TestClass] public class SettingsContainerTests { - #region Public Methods - [TestMethod] public void TestIfSavingAndLoadingWorks() { @@ -22,7 +19,7 @@ public void TestIfSavingAndLoadingWorks() var settings = new BuildMonitorSettings(Guid.NewGuid().ToString()); settings.Add("Test1", "02fdb4e0-fa5d-472a-918a-fc02c48b11a8"); - settings.Add("Test2", new List { "Item1", "Item2" }); + settings.Add("Test2", new List {"Item1", "Item2"}); //settings.Add("Test3", new List { GetTestBuildDefinition(1), GetTestBuildDefinition(2) }); var container = new SettingsContainer(); @@ -60,15 +57,15 @@ public void TestIfSavingAndLoadingWorks() } } - #endregion - - #region Private Methods - private IBuildDefinition GetTestBuildDefinition(Int32 id) { - return new DummyDefinition { Id = id, Name = Path.GetRandomFileName(), Type = "TestType", Project = new DummyProject { Name = Path.GetRandomFileName(), Description = Path.GetRandomFileName(), Id = Guid.NewGuid().ToString() } }; + return new DummyDefinition + { + Id = id, + Name = Path.GetRandomFileName(), + Type = "TestType", + Project = new DummyProject {Name = Path.GetRandomFileName(), Description = Path.GetRandomFileName(), Id = Guid.NewGuid().ToString()} + }; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Infrastructure.Tests/TestData/DummyDefinition.cs b/BuildsAppReborn.Infrastructure.Tests/TestData/DummyDefinition.cs index 58dd61f..579e88c 100644 --- a/BuildsAppReborn.Infrastructure.Tests/TestData/DummyDefinition.cs +++ b/BuildsAppReborn.Infrastructure.Tests/TestData/DummyDefinition.cs @@ -5,7 +5,7 @@ namespace BuildsAppReborn.Infrastructure.Tests.TestData { public class DummyDefinition : IBuildDefinition { - #region Implementation of IBuildDefinition + public String BuildSettingsId { get; } public Int32 Id { get; set; } @@ -16,9 +16,5 @@ public class DummyDefinition : IBuildDefinition public String Type { get; set; } public String Url { get; } - - public String BuildSettingsId { get; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Infrastructure.Tests/TestData/DummyProject.cs b/BuildsAppReborn.Infrastructure.Tests/TestData/DummyProject.cs index bbd83fb..ba9c64b 100644 --- a/BuildsAppReborn.Infrastructure.Tests/TestData/DummyProject.cs +++ b/BuildsAppReborn.Infrastructure.Tests/TestData/DummyProject.cs @@ -5,15 +5,11 @@ namespace BuildsAppReborn.Infrastructure.Tests.TestData { public class DummyProject : IProject { - #region Implementation of IProject - public String Description { get; set; } public String Id { get; set; } public String Name { get; set; } public String Url { get; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Infrastructure/BuildsAppReborn.Infrastructure.csproj b/BuildsAppReborn.Infrastructure/BuildsAppReborn.Infrastructure.csproj index 3cf12f2..7f42066 100644 --- a/BuildsAppReborn.Infrastructure/BuildsAppReborn.Infrastructure.csproj +++ b/BuildsAppReborn.Infrastructure/BuildsAppReborn.Infrastructure.csproj @@ -30,9 +30,8 @@ 4 - - ..\packages\Newtonsoft.Json.10.0.2\lib\net45\Newtonsoft.Json.dll - True + + ..\packages\Newtonsoft.Json.11.0.2\lib\net45\Newtonsoft.Json.dll diff --git a/BuildsAppReborn.Infrastructure/Collections/RangeObservableCollection.cs b/BuildsAppReborn.Infrastructure/Collections/RangeObservableCollection.cs index efb97ab..fd9e0dc 100644 --- a/BuildsAppReborn.Infrastructure/Collections/RangeObservableCollection.cs +++ b/BuildsAppReborn.Infrastructure/Collections/RangeObservableCollection.cs @@ -6,14 +6,13 @@ namespace BuildsAppReborn.Infrastructure.Collections { public class RangeObservableCollection : ObservableCollection { - #region Public Methods - public void AddRange(IEnumerable items) { foreach (var item in items) { Items.Add(item); } + OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); } @@ -23,9 +22,8 @@ public void RemoveRange(IEnumerable items) { Items.Remove(item); } + OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset)); } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Infrastructure/Consts.cs b/BuildsAppReborn.Infrastructure/Consts.cs index 5bbfd5f..ce0e18a 100644 --- a/BuildsAppReborn.Infrastructure/Consts.cs +++ b/BuildsAppReborn.Infrastructure/Consts.cs @@ -4,6 +4,7 @@ namespace BuildsAppReborn.Infrastructure { public static class Consts { - public static readonly JsonSerializerSettings JsonSerializerSettings = new JsonSerializerSettings { TypeNameHandling = TypeNameHandling.All, PreserveReferencesHandling = PreserveReferencesHandling.All }; + public static readonly JsonSerializerSettings JsonSerializerSettings = + new JsonSerializerSettings {TypeNameHandling = TypeNameHandling.All, PreserveReferencesHandling = PreserveReferencesHandling.All}; } } \ No newline at end of file diff --git a/BuildsAppReborn.Infrastructure/ExportFactoryContainer.cs b/BuildsAppReborn.Infrastructure/ExportFactoryContainer.cs index 2fb6ef0..25defe1 100644 --- a/BuildsAppReborn.Infrastructure/ExportFactoryContainer.cs +++ b/BuildsAppReborn.Infrastructure/ExportFactoryContainer.cs @@ -15,10 +15,8 @@ public class ExportFactoryContainer where TInterface : class where TMetaData : class { - #region Constructors - /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The factories. /// lazies @@ -29,13 +27,10 @@ public ExportFactoryContainer([ImportMany] ExportFactory[ { throw new ArgumentNullException(nameof(factories)); } + this.factories = factories; } - #endregion - - #region Public Properties - /// /// Gets the meta data. /// @@ -53,16 +48,14 @@ public IEnumerable MetaData { list.Add(it.Metadata); } + this.metadata = list.AsReadOnly(); } + return this.metadata; } } - #endregion - - #region Public Methods - /// /// Gets the many. /// @@ -83,13 +76,7 @@ public ExportFactory GetSingleOrDefault(Func sea return GetMany(searchExpression).SingleOrDefault(); } - #endregion - - #region Private Fields - private readonly ExportFactory[] factories; private IReadOnlyList metadata; - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Infrastructure/Helper/CloneHelper.cs b/BuildsAppReborn.Infrastructure/Helper/CloneHelper.cs index 14d5c38..0ed765c 100644 --- a/BuildsAppReborn.Infrastructure/Helper/CloneHelper.cs +++ b/BuildsAppReborn.Infrastructure/Helper/CloneHelper.cs @@ -7,8 +7,6 @@ namespace BuildsAppReborn.Infrastructure /// public static class CloneHelper { - #region Public Static Methods - /// /// Clones the specified source. /// @@ -20,7 +18,5 @@ public static T Clone(this T source) var serialized = JsonConvert.SerializeObject(source, Consts.JsonSerializerSettings); return JsonConvert.DeserializeObject(serialized, Consts.JsonSerializerSettings); } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Infrastructure/Helper/EnumHelper.cs b/BuildsAppReborn.Infrastructure/Helper/EnumHelper.cs index 5f0e1da..fe73c42 100644 --- a/BuildsAppReborn.Infrastructure/Helper/EnumHelper.cs +++ b/BuildsAppReborn.Infrastructure/Helper/EnumHelper.cs @@ -4,14 +4,10 @@ namespace BuildsAppReborn.Infrastructure { public static class EnumHelper { - #region Public Static Methods - public static T GetEnumValueFromObject(Object o) { var enumVal = (T) Enum.Parse(typeof(T), o.ToString()); return enumVal; } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Infrastructure/Helper/HttpRequestHelper.cs b/BuildsAppReborn.Infrastructure/Helper/HttpRequestHelper.cs index 4114d76..c08e0a9 100644 --- a/BuildsAppReborn.Infrastructure/Helper/HttpRequestHelper.cs +++ b/BuildsAppReborn.Infrastructure/Helper/HttpRequestHelper.cs @@ -9,9 +9,7 @@ namespace BuildsAppReborn.Infrastructure { public static class HttpRequestHelper { - #region Public Static Methods - - public static async Task GetRequestResponse(String url, ICredentials credentials) + public static async Task GetRequestResponseAsync(String url, ICredentials credentials) { using (var handler = new HttpClientHandler()) { @@ -19,34 +17,30 @@ public static async Task GetRequestResponse(String url, ICr using (var client = new HttpClient(handler)) { AddUserAgent(client); - return await client.GetAsync(url); + return await client.GetAsync(url).ConfigureAwait(false); } } } - public static async Task GetRequestResponse(String url, String personalAccessToken) + public static async Task GetRequestResponseAsync(String url, String personalAccessToken) { using (var client = new HttpClient()) { AddUserAgent(client); AddAccessTokenToHeader(personalAccessToken, client); - return await client.GetAsync(url); + return await client.GetAsync(url).ConfigureAwait(false); } } - public static async Task GetRequestResponse(String url) + public static async Task GetRequestResponseAsync(String url) { using (var client = new HttpClient()) { AddUserAgent(client); - return await client.GetAsync(url); + return await client.GetAsync(url).ConfigureAwait(false); } } - #endregion - - #region Private Static Methods - private static void AddAccessTokenToHeader(String personalAccessToken, HttpClient client) { client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); @@ -58,7 +52,5 @@ private static void AddUserAgent(HttpClient client) // fix for issue with GitHub - https://stackoverflow.com/questions/2482715#comment64584330_22134980 client.DefaultRequestHeaders.Add("User-Agent", "Anything"); } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Infrastructure/InterfaceTypeConverter.cs b/BuildsAppReborn.Infrastructure/InterfaceTypeConverter.cs index f2ea622..d7eaacc 100644 --- a/BuildsAppReborn.Infrastructure/InterfaceTypeConverter.cs +++ b/BuildsAppReborn.Infrastructure/InterfaceTypeConverter.cs @@ -1,5 +1,4 @@ using System; - using Newtonsoft.Json; using Newtonsoft.Json.Linq; @@ -8,11 +7,9 @@ namespace BuildsAppReborn.Infrastructure public class InterfaceTypeConverter : JsonConverter where TClass : class, TInterface { - #region Overrides of Base - public override Boolean CanConvert(Type objectType) { - return (objectType == typeof(TInterface)); + return objectType == typeof(TInterface); } public override Object ReadJson(JsonReader reader, Type objectType, Object existingValue, JsonSerializer serializer) @@ -25,7 +22,5 @@ public override void WriteJson(JsonWriter writer, Object value, JsonSerializer s { serializer.Serialize(writer, value); } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Infrastructure/LazyContainer.cs b/BuildsAppReborn.Infrastructure/LazyContainer.cs index 9439708..34e776e 100644 --- a/BuildsAppReborn.Infrastructure/LazyContainer.cs +++ b/BuildsAppReborn.Infrastructure/LazyContainer.cs @@ -15,10 +15,8 @@ namespace BuildsAppReborn.Infrastructure public sealed class LazyContainer : IEnumerable, IEnumerator, IReadOnlyDictionary where TInterface : class where TMetaData : class { - #region Constructors - /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The lazies. [ImportingConstructor] @@ -28,48 +26,15 @@ public LazyContainer([ImportMany] IEnumerable> lazie { throw new ArgumentNullException(nameof(lazies)); } - this.lazyArray = lazies; - } - - #endregion - - #region Implementation of IEnumerable - - IEnumerator IEnumerable.GetEnumerator() - { - return GetEnumerator(); - } - - public IEnumerator GetEnumerator() - { - return Values.GetEnumerator(); - } - - #endregion - - #region Implementation of IEnumerator - - public void Dispose() - { - } - - public Boolean MoveNext() - { - return GetEnumerator().MoveNext(); - } - public void Reset() - { - GetEnumerator().Reset(); + this.lazyArray = lazies; } - Object IEnumerator.Current => GetEnumerator().Current; + public Int32 Count => this.lazyArray.Count(); public TInterface Current => GetEnumerator().Current; - #endregion - - #region Implementation of IReadOnlyDictionary + public IEnumerable Keys => this.lazyArray.Select(a => a.Metadata); /// /// Gets the values. @@ -79,44 +44,20 @@ public void Reset() /// public IEnumerable Values => this.lazyArray.Select(a => a.Value); - IEnumerator> IEnumerable>.GetEnumerator() - { - return new LazyContainerDictionaryEnumerator(this.lazyArray.GetEnumerator()); - } - public Boolean ContainsKey(TMetaData key) { return this.lazyArray.Any(a => a.Metadata == key); } - public Boolean TryGetValue(TMetaData key, out TInterface value) + public void Dispose() { - if (ContainsKey(key)) - { - value = GetSingleOrDefault(data => data == key); - return true; - } - - value = null; - return false; } - TInterface IReadOnlyDictionary.this[TMetaData key] + public IEnumerator GetEnumerator() { - get - { - return GetSingleOrDefault(data => data == key); - } + return Values.GetEnumerator(); } - public IEnumerable Keys => this.lazyArray.Select(a => a.Metadata); - - public Int32 Count => this.lazyArray.Count(); - - #endregion - - #region Public Methods - /// /// Gets the many. /// @@ -137,26 +78,56 @@ public TInterface GetSingleOrDefault(Func searchExpression) return GetMany(searchExpression).SingleOrDefault(); } - #endregion + public Boolean MoveNext() + { + return GetEnumerator().MoveNext(); + } + + public void Reset() + { + GetEnumerator().Reset(); + } + + public Boolean TryGetValue(TMetaData key, out TInterface value) + { + if (ContainsKey(key)) + { + value = GetSingleOrDefault(data => data == key); + return true; + } + + value = null; + return false; + } + + Object IEnumerator.Current => GetEnumerator().Current; - #region Private Fields + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + IEnumerator> IEnumerable>.GetEnumerator() + { + return new LazyContainerDictionaryEnumerator(this.lazyArray.GetEnumerator()); + } private readonly IEnumerable> lazyArray; - #endregion + TInterface IReadOnlyDictionary.this[TMetaData key] + { + get { return GetSingleOrDefault(data => data == key); } + } private class LazyContainerDictionaryEnumerator : IEnumerator> { - #region Constructors - public LazyContainerDictionaryEnumerator(IEnumerator> innerEnumerator) { this.innerEnumerator = innerEnumerator; } - #endregion - - #region Implementation of IEnumerator> + public KeyValuePair Current => + new KeyValuePair(this.innerEnumerator.Current.Metadata, this.innerEnumerator.Current.Value); public void Dispose() { @@ -172,23 +143,12 @@ public void Reset() this.innerEnumerator.Reset(); } - public KeyValuePair Current => new KeyValuePair(this.innerEnumerator.Current.Metadata, this.innerEnumerator.Current.Value); - Object IEnumerator.Current { - get - { - return Current; - } + get { return Current; } } - #endregion - - #region Private Fields - private readonly IEnumerator> innerEnumerator; - - #endregion } } } \ No newline at end of file diff --git a/BuildsAppReborn.Infrastructure/SettingsContainer{TValue}.cs b/BuildsAppReborn.Infrastructure/SettingsContainer{TValue}.cs index 6ac3373..705d833 100644 --- a/BuildsAppReborn.Infrastructure/SettingsContainer{TValue}.cs +++ b/BuildsAppReborn.Infrastructure/SettingsContainer{TValue}.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.IO; using System.Text; - using Newtonsoft.Json; namespace BuildsAppReborn.Infrastructure @@ -10,8 +9,6 @@ namespace BuildsAppReborn.Infrastructure [Serializable] public class SettingsContainer : List { - #region Public Static Methods - public static SettingsContainer Load(String fileName) { if (!File.Exists(fileName)) @@ -24,10 +21,6 @@ public static SettingsContainer Load(String fileName) return JsonConvert.DeserializeObject>(json, Consts.JsonSerializerSettings); } - #endregion - - #region Public Methods - public void Save(String fileName) { var json = JsonConvert.SerializeObject(this, Consts.JsonSerializerSettings); @@ -40,7 +33,5 @@ public void Save(String fileName) File.WriteAllText(fileName, json, Encoding.UTF8); } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Infrastructure/TolerantEnumConverter.cs b/BuildsAppReborn.Infrastructure/TolerantEnumConverter.cs index d2da665..d1eb4b1 100644 --- a/BuildsAppReborn.Infrastructure/TolerantEnumConverter.cs +++ b/BuildsAppReborn.Infrastructure/TolerantEnumConverter.cs @@ -7,8 +7,6 @@ namespace BuildsAppReborn.Infrastructure // https://stackoverflow.com/a/22755077 public class TolerantEnumConverter : JsonConverter { - #region Overrides of Base - public override Boolean CanConvert(Type objectType) { var type = IsNullableType(objectType) ? Nullable.GetUnderlyingType(objectType) : objectType; @@ -66,15 +64,9 @@ public override void WriteJson(JsonWriter writer, Object value, JsonSerializer s writer.WriteValue(value.ToString()); } - #endregion - - #region Private Methods - private Boolean IsNullableType(Type t) { - return (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Nullable<>)); + return t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Nullable<>); } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Infrastructure/UrlValidator.cs b/BuildsAppReborn.Infrastructure/UrlValidator.cs index 5bd9aa7..5589f68 100644 --- a/BuildsAppReborn.Infrastructure/UrlValidator.cs +++ b/BuildsAppReborn.Infrastructure/UrlValidator.cs @@ -4,15 +4,11 @@ namespace BuildsAppReborn.Infrastructure { public static class UrlValidator { - #region Public Static Methods - // https://stackoverflow.com/a/7581824 public static Boolean IsValidUrl(String urlString) { Uri uriResult; return Uri.TryCreate(urlString, UriKind.Absolute, out uriResult) && (uriResult.Scheme == Uri.UriSchemeHttp || uriResult.Scheme == Uri.UriSchemeHttps); } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Infrastructure/ViewModelBase.cs b/BuildsAppReborn.Infrastructure/ViewModelBase.cs index 2950f50..58172d3 100644 --- a/BuildsAppReborn.Infrastructure/ViewModelBase.cs +++ b/BuildsAppReborn.Infrastructure/ViewModelBase.cs @@ -6,19 +6,11 @@ namespace BuildsAppReborn.Infrastructure { public abstract class ViewModelBase : INotifyPropertyChanged { - #region Implementation of INotifyPropertyChanged - public event PropertyChangedEventHandler PropertyChanged; - #endregion - - #region Protected Methods - protected virtual void OnPropertyChanged([CallerMemberName] String propertyName = null) { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Infrastructure/Wpf/InverseBooleanConverter.cs b/BuildsAppReborn.Infrastructure/Wpf/InverseBooleanConverter.cs index f5bc669..d0a7604 100644 --- a/BuildsAppReborn.Infrastructure/Wpf/InverseBooleanConverter.cs +++ b/BuildsAppReborn.Infrastructure/Wpf/InverseBooleanConverter.cs @@ -7,14 +7,13 @@ namespace BuildsAppReborn.Infrastructure.Wpf [ValueConversion(typeof(Boolean), typeof(Boolean))] public class InverseBooleanConverter : IValueConverter { - #region IValueConverter Members - public Object Convert(Object value, Type targetType, Object parameter, CultureInfo culture) { if (value is Boolean) { - return !(Boolean)value; + return !(Boolean) value; } + return Binding.DoNothing; } @@ -22,7 +21,5 @@ public Object ConvertBack(Object value, Type targetType, Object parameter, Cultu { throw new NotSupportedException(); } - - #endregion } } \ No newline at end of file diff --git a/BuildsAppReborn.Infrastructure/Wpf/WaitingIndicator.cs b/BuildsAppReborn.Infrastructure/Wpf/WaitingIndicator.cs index c550a64..06ac07a 100644 --- a/BuildsAppReborn.Infrastructure/Wpf/WaitingIndicator.cs +++ b/BuildsAppReborn.Infrastructure/Wpf/WaitingIndicator.cs @@ -7,18 +7,12 @@ namespace BuildsAppReborn.Infrastructure.Wpf { public class WaitingIndicator : IDisposable { - #region Constructors - public WaitingIndicator() { Interlocked.Increment(ref count); Application.Current.Dispatcher.Invoke(() => Mouse.OverrideCursor = Cursors.Wait); } - #endregion - - #region Implementation of IDisposable - public void Dispose() { Interlocked.Decrement(ref count); @@ -29,8 +23,6 @@ public void Dispose() } } - #endregion - private static Int32 count; } } \ No newline at end of file diff --git a/BuildsAppReborn.Infrastructure/packages.config b/BuildsAppReborn.Infrastructure/packages.config index 50e4724..5762754 100644 --- a/BuildsAppReborn.Infrastructure/packages.config +++ b/BuildsAppReborn.Infrastructure/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/BuildsAppReborn.Package/BuildsAppReborn.Package.csproj b/BuildsAppReborn.Package/BuildsAppReborn.Package.csproj index 75d9e6c..53d6084 100644 --- a/BuildsAppReborn.Package/BuildsAppReborn.Package.csproj +++ b/BuildsAppReborn.Package/BuildsAppReborn.Package.csproj @@ -93,6 +93,6 @@ - + \ No newline at end of file diff --git a/BuildsAppReborn.Package/Properties/AssemblyInfo.cs b/BuildsAppReborn.Package/Properties/AssemblyInfo.cs index a273a1e..96af81a 100644 --- a/BuildsAppReborn.Package/Properties/AssemblyInfo.cs +++ b/BuildsAppReborn.Package/Properties/AssemblyInfo.cs @@ -6,8 +6,7 @@ // associated with an assembly. [assembly: AssemblyTitle("BuildsAppReborn.Package")] -[assembly: AssemblyDescription("Project template made by EyeCatch (http://www.eyecatch.no/)")] - +[assembly: AssemblyDescription("")] // Setting ComVisible to false makes the types in this assembly not visible // to COM components. If you need to access a type in this assembly from diff --git a/BuildsAppReborn.sln b/BuildsAppReborn.sln index 61bfbab..1f965d1 100644 --- a/BuildsAppReborn.sln +++ b/BuildsAppReborn.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 14 -VisualStudioVersion = 14.0.25420.1 +# Visual Studio 15 +VisualStudioVersion = 15.0.27703.2035 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BuildsAppReborn.Client", "BuildsAppReborn.Client\BuildsAppReborn.Client.csproj", "{906D9C2D-F797-45E2-B148-A503892210B7}" EndProject @@ -66,4 +66,7 @@ Global GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {F487867B-738F-43BE-8BDD-05EDFC765A99} + EndGlobalSection EndGlobal diff --git a/BuildsAppReborn.sln.DotSettings b/BuildsAppReborn.sln.DotSettings index 95b82c8..fb05938 100644 --- a/BuildsAppReborn.sln.DotSettings +++ b/BuildsAppReborn.sln.DotSettings @@ -1,941 +1,630 @@  True - True - Left - True - True - - False - ON_ENTER - SOLUTION - False + CSharp60 + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING + WARNING WARNING - DO_NOT_SHOW - DO_NOT_SHOW - HINT - DO_NOT_SHOW + WARNING + WARNING + WARNING + WARNING + WARNING + <?xml version="1.0" encoding="utf-16"?><Profile name="Fancy Coding Styles"><CSReorderTypeMembers>True</CSReorderTypeMembers><CSCodeStyleAttributes ArrangeTypeAccessModifier="True" ArrangeTypeMemberAccessModifier="True" SortModifiers="True" RemoveRedundantParentheses="True" AddMissingParentheses="True" ArrangeBraces="True" ArrangeAttributes="True" ArrangeArgumentsStyle="True" /><CSEnforceVarKeywordUsageSettings>True</CSEnforceVarKeywordUsageSettings><CSUpdateFileHeader>True</CSUpdateFileHeader><CSUseAutoProperty>True</CSUseAutoProperty><CSMakeFieldReadonly>True</CSMakeFieldReadonly><CSMakeAutoPropertyGetOnly>True</CSMakeAutoPropertyGetOnly><CSArrangeQualifiers>True</CSArrangeQualifiers><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSReformatCode>True</CSReformatCode><CSShortenReferences>True</CSShortenReferences><CSFixBuiltinTypeReferences>True</CSFixBuiltinTypeReferences><CSharpFormatDocComments>True</CSharpFormatDocComments></Profile> + Default: Full Cleanup + True + Required + Required + Required + Required + UseClrName + 1 - True + True + True + True + True + True + True + True + True + True + True + 1 - DO_NOT_SHOW - SUGGESTION - DO_NOT_SHOW - DO_NOT_SHOW - DO_NOT_SHOW - DO_NOT_SHOW - DO_NOT_SHOW - DO_NOT_SHOW - DO_NOT_SHOW - DO_NOT_SHOW - DO_NOT_SHOW - DO_NOT_SHOW - DO_NOT_SHOW - DO_NOT_SHOW - SUGGESTION - DO_NOT_SHOW - DO_NOT_SHOW - SUGGESTION - WARNING - WARNING - DO_NOT_SHOW - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - DoHide - <?xml version="1.0" encoding="utf-16"?><Profile name="Fancy Coding Styles"><CSOptimizeUsings><OptimizeUsings>True</OptimizeUsings><EmbraceInRegion>False</EmbraceInRegion><RegionName></RegionName></CSOptimizeUsings><CSReorderTypeMembers>True</CSReorderTypeMembers><CSUseVar><BehavourStyle>CAN_CHANGE_TO_IMPLICIT</BehavourStyle><LocalVariableStyle>ALWAYS_IMPLICIT</LocalVariableStyle><ForeachVariableStyle>ALWAYS_EXPLICIT</ForeachVariableStyle></CSUseVar><CSRemoveCodeRedundancies>True</CSRemoveCodeRedundancies><CSReformatCode>True</CSReformatCode><CSArrangeThisQualifier>True</CSArrangeThisQualifier><RemoveCodeRedundancies>True</RemoveCodeRedundancies><CSUseAutoProperty>True</CSUseAutoProperty><CSMakeFieldReadonly>True</CSMakeFieldReadonly><CSShortenReferences>True</CSShortenReferences><CSArrangeQualifiers>True</CSArrangeQualifiers><CSEnforceVarKeywordUsageSettings>True</CSEnforceVarKeywordUsageSettings><CSFixBuiltinTypeReferences>True</CSFixBuiltinTypeReferences></Profile> - Fancy Coding Styles - UseClrName - ThisClass - Field - True - ALWAYS_ADD - ALWAYS_ADD - ALWAYS_ADD - ALWAYS_ADD - ALWAYS_ADD - True + 1 + 1 NEVER - False - NEVER - USE_FOR_VARIABLES_IN_THIS_CLASS - 300 - False - True - True + True + + CHOP_IF_LONG + + CHOP_IF_LONG + 180 + CHOP_IF_LONG + DoNotTouch + DoNotTouch + False + + False + False + False + False + False <?xml version="1.0" encoding="utf-16"?> <Patterns xmlns="urn:schemas-jetbrains-com:member-reordering-patterns"> - <TypePattern DisplayName="COM interfaces or structs"> - <TypePattern.Match> - <Or> - <And> - <Kind Is="Interface" /> - <Or> - <HasAttribute Name="System.Runtime.InteropServices.InterfaceTypeAttribute" /> - <HasAttribute Name="System.Runtime.InteropServices.ComImport" /> - </Or> - </And> - <Kind Is="Struct" /> - </Or> - </TypePattern.Match> - </TypePattern> - <TypePattern DisplayName="NUnit Test Fixtures" RemoveRegions="All"> - <TypePattern.Match> - <And> - <Kind Is="Class" /> - <HasAttribute Name="NUnit.Framework.TestFixtureAttribute" Inherited="True" /> - <HasAttribute Name="NUnit.Framework.TestCaseFixtureAttribute" Inherited="True" /> - </And> - </TypePattern.Match> - <Region Name="Setup/Teardown"> - <Entry DisplayName="Setup/Teardown Methods"> - <Entry.Match> - <And> - <Kind Is="Method" /> - <Or> - <HasAttribute Name="NUnit.Framework.SetUpAttribute" Inherited="True" /> - <HasAttribute Name="NUnit.Framework.TearDownAttribute" Inherited="True" /> - <HasAttribute Name="NUnit.Framework.FixtureSetUpAttribute" Inherited="True" /> - <HasAttribute Name="NUnit.Framework.FixtureTearDownAttribute" Inherited="True" /> - </Or> - </And> - </Entry.Match> - </Entry> - </Region> - <Entry DisplayName="All other members" /> - <Entry Priority="100" DisplayName="Test Methods"> + <TypePattern DisplayName="Default Pattern" RemoveRegions="AllExceptGenerated"> + <Entry DisplayName="constructors"> <Entry.Match> - <And> - <Kind Is="Method" /> - <HasAttribute Name="NUnit.Framework.TestAttribute" /> - </And> + <Kind Is="Constructor" /> </Entry.Match> <Entry.SortBy> - <Name /> + <Static /> + <Access /> </Entry.SortBy> </Entry> - </TypePattern> - <TypePattern DisplayName="Default Pattern"> - <Region Name="Constructors"> - <Entry DisplayName="Constructors"> + <Group DisplayName="public"> + <Entry DisplayName="public static properties"> <Entry.Match> - <Kind Is="Constructor" /> + <And> + <Access Is="Public" /> + <Static /> + <Kind Is="Property" /> + </And> </Entry.Match> <Entry.SortBy> - <Static /> + <Name /> </Entry.SortBy> </Entry> - </Region> - <Region Name="Delegates"> - <Entry Priority="100" DisplayName="Public Delegates"> + <Entry DisplayName="public properties"> <Entry.Match> <And> <Access Is="Public" /> - <Kind Is="Delegate" /> + <Kind Is="Property" /> </And> </Entry.Match> <Entry.SortBy> <Name /> </Entry.SortBy> </Entry> - </Region> - <Region Name="${0} enum" Priority="100"> - <Region.GroupBy> - <Name /> - </Region.GroupBy> - <Entry DisplayName="Public Enums"> + <Entry DisplayName="public static methods"> <Entry.Match> <And> <Access Is="Public" /> - <Kind Is="Enum" /> + <Static /> + <Kind Is="Method" /> </And> </Entry.Match> <Entry.SortBy> <Name /> </Entry.SortBy> </Entry> - </Region> - <Region Name="Implementation of ${0}" Priority="100"> - <Region.GroupBy> - <ImplementsInterface Immediate="True" /> - </Region.GroupBy> - <Entry DisplayName="Interface Members"> + <Entry DisplayName="public methods"> <Entry.Match> <And> - <Kind Is="Member" /> - <ImplementsInterface /> + <Access Is="Public" /> + <Kind Is="Method" /> </And> </Entry.Match> <Entry.SortBy> - <ImplementsInterface Immediate="True" /> + <Name /> </Entry.SortBy> </Entry> - </Region> - <Region Name="Overrides of Base"> - <Entry DisplayName="Override Members"> + <Entry DisplayName="public events" Priority="100"> <Entry.Match> <And> - <Kind Is="Member" /> - <Override /> + <Access Is="Public" /> + <Kind Is="Event" /> </And> </Entry.Match> <Entry.SortBy> - <Name Is="Enter Pattern Here" /> + <Name /> </Entry.SortBy> </Entry> - </Region> - <Region Name="Public Static Properties"> - <Entry DisplayName="Public Static Properties"> + <Entry DisplayName="public consts"> + <Entry.Match> + <And> + <Access Is="Public" /> + <Kind Is="Constant" /> + </And> + </Entry.Match> + </Entry> + <Entry DisplayName="public static fields"> <Entry.Match> <And> - <Static /> - <Kind Is="Property" /> <Access Is="Public" /> + <Static /> + <Kind Is="Field" /> </And> </Entry.Match> <Entry.SortBy> - <Name Is="Enter Pattern Here" /> + <Name /> </Entry.SortBy> </Entry> - </Region> - <Region Name="Public Properties"> - <Entry DisplayName="Public Properties"> + <Entry DisplayName="public fields"> <Entry.Match> <And> <Access Is="Public" /> - <Kind Is="Property" /> - <Not> - <Static /> - </Not> + <Kind Is="Field" /> </And> </Entry.Match> <Entry.SortBy> - <Name Is="Enter Pattern Here" /> + <Name /> </Entry.SortBy> </Entry> - </Region> - <Region Name="Public Static Methods"> - <Entry DisplayName="Public Static Methods"> + </Group> + <Group DisplayName="protected"> + <Entry DisplayName="protected properties"> <Entry.Match> <And> + <Access Is="Protected" /> <Static /> - <Access Is="Public" /> - <Kind Is="Method" /> + <Kind Is="Property" /> </And> </Entry.Match> <Entry.SortBy> - <Name Is="Enter Pattern Here" /> + <Name /> </Entry.SortBy> </Entry> - </Region> - <Region Name="Public Methods"> - <Entry DisplayName="Public Methods"> + <Entry DisplayName="protected properties"> <Entry.Match> <And> - <Access Is="Public" /> - <Kind Is="Method" /> - <Not> - <Static /> - </Not> + <Access Is="Protected" /> + <Kind Is="Property" /> </And> </Entry.Match> <Entry.SortBy> - <Name Is="Enter Pattern Here" /> + <Name /> </Entry.SortBy> </Entry> - </Region> - <Region Name="Internal Static Properties"> - <Entry DisplayName="Internal Static Properties"> + <Entry DisplayName="protected static methods"> <Entry.Match> <And> + <Access Is="Protected" /> <Static /> - <Kind Is="Property" /> - <Access Is="Internal" /> + <Kind Is="Method" /> </And> </Entry.Match> <Entry.SortBy> - <Name Is="Enter Pattern Here" /> + <Name /> </Entry.SortBy> </Entry> - </Region> - <Region Name="Internal Properties"> - <Entry DisplayName="Internal Properties"> + <Entry DisplayName="protected methods"> <Entry.Match> <And> - <Access Is="Internal" /> - <Kind Is="Property" /> - <Not> - <Static /> - </Not> + <Access Is="Protected" /> + <Kind Is="Method" /> + </And> + </Entry.Match> + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + <Entry DisplayName="protected events" Priority="100"> + <Entry.Match> + <And> + <Access Is="Protected" /> + <Kind Is="Event" /> </And> </Entry.Match> <Entry.SortBy> - <Name Is="Enter Pattern Here" /> + <Name /> </Entry.SortBy> </Entry> - </Region> - <Region Name="Internal Static Methods"> - <Entry DisplayName="Internal Static Methods"> + <Entry DisplayName="protected consts"> <Entry.Match> <And> + <Access Is="Protected" /> + <Kind Is="Constant" /> + </And> + </Entry.Match> + </Entry> + <Entry DisplayName="protected static fields"> + <Entry.Match> + <And> + <Access Is="Protected" /> <Static /> - <Access Is="Internal" /> - <Kind Is="Method" /> + <Kind Is="Field" /> </And> </Entry.Match> <Entry.SortBy> - <Name Is="Enter Pattern Here" /> + <Name /> </Entry.SortBy> </Entry> - </Region> - <Region Name="Internal Methods"> - <Entry DisplayName="Internal Methods"> + <Entry DisplayName="protected fields"> <Entry.Match> <And> - <Access Is="Internal" /> - <Kind Is="Method" /> - <Not> - <Static /> - </Not> + <Access Is="Protected" /> + <Kind Is="Field" /> </And> </Entry.Match> <Entry.SortBy> - <Name Is="Enter Pattern Here" /> + <Name /> </Entry.SortBy> </Entry> - </Region> - <Region Name="Protected Static Properties"> - <Entry DisplayName="Protected Static Properties"> + </Group> + <Group DisplayName="internal"> + <Entry DisplayName="internal static properties"> <Entry.Match> <And> + <Or> + <Access Is="Internal" /> + <Access Is="ProtectedInternal" /> + </Or> <Static /> <Kind Is="Property" /> - <Access Is="Protected" /> </And> </Entry.Match> <Entry.SortBy> - <Name Is="Enter Pattern Here" /> + <Name /> </Entry.SortBy> </Entry> - </Region> - <Region Name="Protected Properties"> - <Entry DisplayName="Protected Properties"> + <Entry DisplayName="internal properties"> <Entry.Match> <And> - <Access Is="Protected" /> + <Or> + <Access Is="Internal" /> + <Access Is="ProtectedInternal" /> + </Or> <Kind Is="Property" /> - <Not> - <Static /> - </Not> </And> </Entry.Match> <Entry.SortBy> - <Name Is="Enter Pattern Here" /> + <Name /> </Entry.SortBy> </Entry> - </Region> - <Region Name="Protected Static Methods"> - <Entry DisplayName="Protected Static Methods"> + <Entry DisplayName="internal static methods"> <Entry.Match> <And> + <Or> + <Access Is="Internal" /> + <Access Is="ProtectedInternal" /> + </Or> <Static /> - <Access Is="Protected" /> <Kind Is="Method" /> </And> </Entry.Match> <Entry.SortBy> - <Name Is="Enter Pattern Here" /> + <Name /> </Entry.SortBy> </Entry> - </Region> - <Region Name="Protected Methods"> - <Entry DisplayName="Protected Methods"> + <Entry DisplayName="internal methods"> <Entry.Match> <And> - <Access Is="Protected" /> + <Or> + <Access Is="Internal" /> + <Access Is="ProtectedInternal" /> + </Or> <Kind Is="Method" /> - <Not> - <Static /> - </Not> </And> </Entry.Match> <Entry.SortBy> - <Name Is="Enter Pattern Here" /> + <Name /> </Entry.SortBy> </Entry> - </Region> - <Region Name="Private Static Properties"> - <Entry DisplayName="Private Static Properties"> + <Entry DisplayName="internal events" Priority="100"> <Entry.Match> <And> + <Or> + <Access Is="Internal" /> + <Access Is="ProtectedInternal" /> + </Or> + <Kind Is="Event" /> + </And> + </Entry.Match> + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + <Entry DisplayName="internal consts"> + <Entry.Match> + <And> + <Or> + <Access Is="Internal" /> + <Access Is="ProtectedInternal" /> + </Or> + <Kind Is="Constant" /> + </And> + </Entry.Match> + </Entry> + <Entry DisplayName="internal static fields"> + <Entry.Match> + <And> + <Or> + <Access Is="Internal" /> + <Access Is="ProtectedInternal" /> + </Or> <Static /> - <Kind Is="Property" /> + <Kind Is="Field" /> + </And> + </Entry.Match> + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + <Entry DisplayName="internal fields"> + <Entry.Match> + <And> + <Or> + <Access Is="Internal" /> + <Access Is="ProtectedInternal" /> + </Or> + <Kind Is="Field" /> + </And> + </Entry.Match> + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + </Group> + <Group DisplayName="private"> + <Entry DisplayName="private static properties"> + <Entry.Match> + <And> <Access Is="Private" /> + <Static /> + <Kind Is="Property" /> </And> </Entry.Match> <Entry.SortBy> - <Name Is="Enter Pattern Here" /> + <Name /> </Entry.SortBy> </Entry> - </Region> - <Region Name="Private Properties"> - <Entry DisplayName="Private Properties"> + <Entry DisplayName="private properties"> <Entry.Match> <And> <Access Is="Private" /> <Kind Is="Property" /> - <Not> - <Static /> - </Not> </And> </Entry.Match> <Entry.SortBy> - <Name Is="Enter Pattern Here" /> + <Name /> </Entry.SortBy> </Entry> - </Region> - <Region Name="Private Static Methods"> - <Entry DisplayName="Private Static Methods"> + <Entry DisplayName="private static methods"> <Entry.Match> <And> - <Static /> <Access Is="Private" /> + <Static /> <Kind Is="Method" /> </And> </Entry.Match> <Entry.SortBy> - <Name Is="Enter Pattern Here" /> + <Name /> </Entry.SortBy> </Entry> - </Region> - <Region Name="Private Methods"> - <Entry DisplayName="Private Methods"> + <Entry DisplayName="private methods"> <Entry.Match> <And> <Access Is="Private" /> <Kind Is="Method" /> - <Not> - <Static /> - </Not> </And> </Entry.Match> <Entry.SortBy> - <Name Is="Enter Pattern Here" /> + <Name /> + </Entry.SortBy> + </Entry> + <Entry DisplayName="private events" Priority="100"> + <Entry.Match> + <And> + <Access Is="Private" /> + <Kind Is="Event" /> + </And> + </Entry.Match> + <Entry.SortBy> + <Name /> </Entry.SortBy> </Entry> - </Region> - <Region Name="Internal Fields"> - <Entry DisplayName="Internal Fields"> + <Entry DisplayName="private static fields"> <Entry.Match> <And> - <Access Is="Internal" /> + <Access Is="Private" /> + <Static /> <Kind Is="Field" /> - <Not> - <Static /> - </Not> </And> </Entry.Match> <Entry.SortBy> - <Name Is="Enter Pattern Here" /> - <Readonly /> + <Name /> </Entry.SortBy> </Entry> - </Region> - <Region Name="Private Fields"> - <Entry DisplayName="Private Fields"> + <Entry DisplayName="private fields"> <Entry.Match> <And> <Access Is="Private" /> <Kind Is="Field" /> - <Not> - <Static /> - </Not> </And> </Entry.Match> <Entry.SortBy> - <Name Is="Enter Pattern Here" /> - <Readonly /> + <Name /> </Entry.SortBy> </Entry> - </Region> - </TypePattern> -</Patterns> - <?xml version="1.0" encoding="utf-8" ?> - -<!-- -I. Overall - -I.1 Each pattern can have <Match>....</Match> element. For the given type declaration, the pattern with the match, evaluated to 'true' with the largest weight, will be used -I.2 Each pattern consists of the sequence of <Entry>...</Entry> elements. Type member declarations are distributed between entries -I.3 If pattern has RemoveAllRegions="true" attribute, then all regions will be cleared prior to reordering. Otherwise, only auto-generated regions will be cleared -I.4 The contents of each entry is sorted by given keys (First key is primary, next key is secondary, etc). Then the declarations are grouped and en-regioned by given property - -II. Available match operands - -Each operand may have Weight="..." attribute. This weight will be added to the match weight if the operand is evaluated to 'true'. -The default weight is 1 - -II.1 Boolean functions: -II.1.1 <And>....</And> -II.1.2 <Or>....</Or> -II.1.3 <Not>....</Not> - -II.2 Operands -II.2.1 <Kind Is="..."/>. Kinds are: class, struct, interface, enum, delegate, type, constructor, destructor, property, indexer, method, operator, field, constant, event, member -II.2.2 <Name Is="..." [IgnoreCase="true/false"] />. The 'Is' attribute contains regular expression -II.2.3 <HasAttribute CLRName="..." [Inherit="true/false"] />. The 'CLRName' attribute contains regular expression -II.2.4 <Access Is="..."/>. The 'Is' values are: public, protected, internal, protected internal, private -II.2.5 <Static/> -II.2.6 <Abstract/> -II.2.7 <Virtual/> -II.2.8 <Override/> -II.2.9 <Sealed/> -II.2.10 <Readonly/> -II.2.11 <ImplementsInterface CLRName="..."/>. The 'CLRName' attribute contains regular expression -II.2.12 <HandlesEvent /> ---> - -<Patterns xmlns="urn:shemas-jetbrains-com:member-reordering-patterns"> - -<Pattern RemoveAllRegions="true"> - <!--Constructors. Place static one first--> - <Entry> - <Match> - <Kind Is="constructor"/> - </Match> - <Sort> - <Static /> - </Sort> - <Group Region="Constructors"/> - </Entry> - <!--public delegate--> - <Entry> - <Match> - <And Weight="100"> - <Access Is="public"/> - <Kind Is="delegate"/> - </And> - </Match> - <Sort> - <Name/> - </Sort> - <Group Region="Delegates"/> - </Entry> - <!--public enum--> - <Entry> - <Match> - <And Weight="100"> - <Access Is="public"/> - <Kind Is="enum"/> - </And> - </Match> - <Sort> - <Name/> - </Sort> - <Group> - <Name Region="${Name} enum"/> - </Group> - </Entry> - <!--interface implementations--> - <Entry> - <Match> - <And Weight="100"> - <Kind Is="member"/> - <ImplementsInterface/> - </And> - </Match> - <Sort> - <ImplementsInterface Immediate="true"/> - </Sort> - <Group> - <ImplementsInterface Immediate="true" Region="Implementation of ${ImplementsInterface}"/> + <Entry DisplayName="private consts"> + <Entry.Match> + <And> + <Access Is="Private" /> + <Kind Is="Constant" /> + </And> + </Entry.Match> + </Entry> </Group> - </Entry> - <!--Overrides of Base--> - <Entry> - <Match> - <And Weight="100"> - <Kind Is="member"/> - <Override/> - </And> - </Match> - <Sort> - <Name/> - </Sort> - <Group Region="Overrides of Base" /> - </Entry> - <!--Public Static Properties--> - <Entry> - <Match> - <And> - <Access Is="public"/> - <Kind Is="property"/> - <Static/> - </And> - </Match> - <Sort> - <Name/> - </Sort> - <Group Region="Public Static Properties" /> - </Entry> - <!--Public Properties--> - <Entry> - <Match> - <And> - <Access Is="public"/> - <Kind Is="property"/> - <Not> - <Static/> - </Not> - </And> - </Match> - <Sort> - <Name/> - </Sort> - <Group Region="Public Properties" /> - </Entry> - <!--Public Static Methods--> - <Entry> - <Match> - <And> - <Access Is="public"/> - <Kind Is="method"/> - <Static/> - </And> - </Match> - <Sort> - <Name/> - </Sort> - <Group Region="Public Static Methods" /> - </Entry> - <!--Public Methods--> - <Entry> - <Match> - <And> - <Access Is="public"/> - <Kind Is="method"/> - <Not> - <Static/> - </Not> - </And> - </Match> - <Sort> - <Name/> - </Sort> - <Group Region="Public Methods" /> - </Entry> - <!--Internal Static Properties--> - <Entry> - <Match> - <And> - <Access Is="internal"/> - <Kind Is="property"/> - <Static/> - </And> - </Match> - <Sort> - <Name/> - </Sort> - <Group Region="Internal Static Properties" /> - </Entry> - <!--Internal Properties--> - <Entry> - <Match> - <And> - <Access Is="internal"/> - <Kind Is="property"/> - <Not> - <Static/> - </Not> - </And> - </Match> - <Sort> - <Name/> - </Sort> - <Group Region="Internal Properties" /> - </Entry> - <!--Internal Static Methods--> - <Entry> - <Match> - <And> - <Access Is="internal"/> - <Kind Is="method"/> - <Static/> - </And> - </Match> - <Sort> - <Name/> - </Sort> - <Group Region="Internal Static Methods" /> - </Entry> - <!--Internal Methods--> - <Entry> - <Match> - <And> - <Access Is="internal"/> - <Kind Is="method"/> - <Not> - <Static/> - </Not> - </And> - </Match> - <Sort> - <Name/> - </Sort> - <Group Region="Internal Methods" /> - </Entry> - <!--Protected Static Properties--> - <Entry> - <Match> - <And> - <Access Is="protected"/> - <Kind Is="property"/> - <Static/> - </And> - </Match> - <Sort> - <Name/> - </Sort> - <Group Region="Protected Static Properties" /> - </Entry> - <!--Protected Properties--> - <Entry> - <Match> - <And> - <Access Is="protected"/> - <Kind Is="property"/> - <Not> - <Static/> - </Not> - </And> - </Match> - <Sort> - <Name/> - </Sort> - <Group Region="Protected Properties" /> - </Entry> - <!--Protected Static Methods--> - <Entry> - <Match> - <And> - <Access Is="protected"/> - <Kind Is="method"/> - <Static/> - </And> - </Match> - <Sort> - <Name/> - </Sort> - <Group Region="Protected Static Methods" /> - </Entry> - <!--Protected Methods--> - <Entry> - <Match> - <And> - <Access Is="protected"/> - <Kind Is="method"/> - <Not> - <Static/> - </Not> - </And> - </Match> - <Sort> - <Name/> - </Sort> - <Group Region="Protected Methods" /> - </Entry> - <!--Private Static Properties--> - <Entry> - <Match> - <And> - <Access Is="private"/> - <Kind Is="property"/> - <Static/> - </And> - </Match> - <Sort> - <Name/> - </Sort> - <Group Region="Private Static Properties" /> - </Entry> - <!--Private Properties--> - <Entry> - <Match> - <And> - <Access Is="private"/> - <Kind Is="property"/> - <Not> - <Static/> - </Not> - </And> - </Match> - <Sort> - <Name/> - </Sort> - <Group Region="Private Properties" /> - </Entry> - <!--Private Static Methods--> - <Entry> - <Match> - <And> - <Access Is="private"/> - <Kind Is="method"/> - <Static/> - </And> - </Match> - <Sort> - <Name/> - </Sort> - <Group Region="Private Static Methods" /> - </Entry> - <!--Private Methods--> - <Entry> - <Match> - <And> - <Access Is="private"/> - <Kind Is="method"/> - <Not> - <Static/> - </Not> - </And> - </Match> - <Sort> - <Name/> - </Sort> - <Group Region="Private Methods" /> - </Entry> - <!--Internal Fields --> - <Entry> - <Match> + <Entry DisplayName="Properties, Indexers"> + <Entry.Match> + <Or> + <Kind Is="Property" /> + <Kind Is="Indexer" /> + </Or> + </Entry.Match> + </Entry> + <Entry DisplayName="Static Fields and Constants"> + <Entry.Match> + <Or> + <Kind Is="Constant" /> + <And> + <Kind Is="Field" /> + <Static /> + </And> + </Or> + </Entry.Match> + <Entry.SortBy> + <Kind Order="Constant Field" /> + </Entry.SortBy> + </Entry> + <Entry DisplayName="Fields"> + <Entry.Match> + <And> + <Kind Is="Field" /> + <Not> + <Static /> + </Not> + </And> + </Entry.Match> + <Entry.SortBy> + <Readonly /> + <Name /> + </Entry.SortBy> + </Entry> + <Entry DisplayName="All other members"> + <Entry.SortBy> + <Access /> + <Name /> + </Entry.SortBy> + </Entry> + <Entry DisplayName="Nested Types"> + <Entry.Match> + <Kind Is="Type" /> + </Entry.Match> + </Entry> + <Entry DisplayName="Public Enums" Priority="100"> + <Entry.Match> + <And> + <Access Is="Public" /> + <Kind Is="Enum" /> + </And> + </Entry.Match> + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + </TypePattern> + <TypePattern DisplayName="StyleGuide Pattern" RemoveRegions="AllExceptGenerated"> + <Entry DisplayName="constructors"> + <Entry.Match> + <Kind Is="Constructor" /> + </Entry.Match> + <Entry.SortBy> + <Access Order="Public Internal ProtectedInternal Protected Private" /> + </Entry.SortBy> + </Entry> + </TypePattern> + <TypePattern DisplayName="COM interfaces or structs"> + <TypePattern.Match> + <Or> + <And> + <Kind Is="Interface" /> + <Or> + <HasAttribute Name="System.Runtime.InteropServices.InterfaceTypeAttribute" /> + <HasAttribute Name="System.Runtime.InteropServices.ComImport" /> + </Or> + </And> + <Kind Is="Struct" /> + </Or> + </TypePattern.Match> + </TypePattern> + <TypePattern DisplayName="xUnit.net Test Classes" RemoveRegions="All"> + <TypePattern.Match> <And> - <Access Is="internal"/> - <Kind Is="field"/> - <Not> - <Static/> - </Not> + <Kind Is="Class" /> + <HasMember> + <And> + <Kind Is="Method" /> + <HasAttribute Name="Xunit.FactAttribute" Inherited="True" /> + </And> + </HasMember> </And> - </Match> - <Sort> - <Name/> - <Readonly/> - </Sort> - <Group Region="Internal Fields" /> - </Entry> - <!--Private members--> - <Entry> - <Match> + </TypePattern.Match> + <Entry DisplayName="Setup/Teardown Methods"> + <Entry.Match> + <Or> + <Kind Is="Constructor" /> + <And> + <Kind Is="Method" /> + <ImplementsInterface Name="System.IDisposable" /> + </And> + </Or> + </Entry.Match> + <Entry.SortBy> + <Kind Order="Constructor" /> + </Entry.SortBy> + </Entry> + <Entry DisplayName="All other members" /> + <Entry DisplayName="Test Methods" Priority="100"> + <Entry.Match> + <And> + <Kind Is="Method" /> + <HasAttribute Name="Xunit.FactAttribute" /> + </And> + </Entry.Match> + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + </TypePattern> + <TypePattern DisplayName="NUnit Test Fixtures" RemoveRegions="All"> + <TypePattern.Match> <And> - <Access Is="private"/> - <Kind Is="field"/> - <Not> - <Static/> - </Not> + <Kind Is="Class" /> + <HasAttribute Name="NUnit.Framework.TestFixtureAttribute" Inherited="True" /> </And> - </Match> - <Sort> - <Name/> - <Readonly/> - </Sort> - <Group Region="Private Fields" /> - </Entry> -</Pattern> - - -</Patterns> - + </TypePattern.Match> + <Entry DisplayName="Setup/Teardown Methods"> + <Entry.Match> + <And> + <Kind Is="Method" /> + <Or> + <HasAttribute Name="NUnit.Framework.SetUpAttribute" Inherited="True" /> + <HasAttribute Name="NUnit.Framework.TearDownAttribute" Inherited="True" /> + <HasAttribute Name="NUnit.Framework.FixtureSetUpAttribute" Inherited="True" /> + <HasAttribute Name="NUnit.Framework.FixtureTearDownAttribute" Inherited="True" /> + </Or> + </And> + </Entry.Match> + </Entry> + <Entry DisplayName="All other members" /> + <Entry DisplayName="Test Methods" Priority="100"> + <Entry.Match> + <And> + <Kind Is="Method" /> + <HasAttribute Name="NUnit.Framework.TestAttribute" /> + </And> + </Entry.Match> + <Entry.SortBy> + <Name /> + </Entry.SortBy> + </Entry> + </TypePattern> +</Patterns> + - True - False - True - Replace - False - False - False - False - True - Automatic property - True - True - True - AT - FK - II - SAF - UI - $object$_On$event$ - <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> - <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> - <Policy Inspect="True" Prefix="I" Suffix="" Style="AaBb" /> - <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> - <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> - <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> - <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> - <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> - <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> - <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> - <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> - <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> - <Policy Inspect="True" Prefix="T" Suffix="" Style="AaBb" /> - <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> - $object$_On$event$ - <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> - <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> - <Policy Inspect="True" Prefix="I" Suffix="" Style="AaBb" /> - <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> - <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> - <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> - <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> - <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> - <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> - <Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /> - <Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /> - <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> - <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> - <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> - <Policy Inspect="True" Prefix="T" Suffix="" Style="AaBb" /> - <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> - <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb"><ExtraRule Prefix="" Suffix="" Style="AA_BB" /></Policy> - <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb" /> + Original + Wide True - True True True True @@ -944,140 +633,4 @@ II.2.12 <HandlesEvent /> True True True - True - True - True - - CodeContract - 5 - - TestClass - 4 - True - True - Imported 1/5/2012 - Importing Constructor - True - impctor - True - [ImportingConstructor] -public $classname$ ($END$) - { - - } - True - typeName() - -1 - 0 - True - 2.0 - InCSharpFile - True - True - Imported 1/5/2012 - cs - Contract - True - CodeContract - True - True - using System; -using System.Collections.Generic; -using System.Diagnostics.Contracts; -using System.Linq; -using System.Text; - -namespace $NAMESPACE$ -{ - /// <summary> - /// Defines code contract for <see cref="$INTERFACE$"/> implementations. - /// </summary> - [System.Diagnostics.Contracts.ContractClassForAttribute(typeof($INTERFACE$))] - class ExportServiceContract : $INTERFACE$ - { - } -} - - True - 1 - True - fileDefaultNamespace() - 0 - True - InCSharpProjectFile - True - True - cs - TestClass - False - TestClass - True - True - using Microsoft.VisualStudio.TestTools.UnitTesting; - -$HEADER$namespace $NAMESPACE$ -{ - [TestClass] - public class $CLASS$ - { - [TestInitialize] - public void TestInitialize() - { - this.sut = new $SystemUnderTest$(); - } - - private $SystemUnderTest$ sut; - } -} - True - getFileNameWithoutExtension() - -1 - 2 - True - fileheader() - 0 - True - fileDefaultNamespace() - -1 - 1 - True - parameterOfType("System.String") - 3 - True - InCSharpProjectFile - True - True - Imported 1/5/2012 - A Property with NotifyPropertyChanged call - True - notiprop - True - public $TYPE$ $NAME$ - { - get - { - return $NAME2$; - } - set - { - $NAME2$ = value; - RaisePropertyChanged("$NAME$"); - } - } - - private $TYPE$ $NAME2$; - True - suggestVariableName() - 1 - True - decapitalize(NAME) - 2 - True - parameterOfType("System.String") - 0 - True - 2.0 - InCSharpTypeMember - True - CSHARP - Module \ No newline at end of file + True \ No newline at end of file