diff --git a/BuildsAppReborn.Access.UI/ViewModel/Tfs2017BuildProviderViewModel.cs b/BuildsAppReborn.Access.UI/ViewModel/Tfs2017BuildProviderViewModel.cs
index 6a3bf22..f3dbfc7 100644
--- a/BuildsAppReborn.Access.UI/ViewModel/Tfs2017BuildProviderViewModel.cs
+++ b/BuildsAppReborn.Access.UI/ViewModel/Tfs2017BuildProviderViewModel.cs
@@ -69,9 +69,13 @@ public String AccessToken
get { return String.Empty; }
set
{
- MonitorSettings[Tfs2017BuildProvider.PersonalAccessTokenSettingsKey] = value;
- OnPropertyChanged();
- ConnectCommand?.RaiseCanExecuteChanged();
+ // ToDo: Token should only be saved if connection was successful
+ if (!String.IsNullOrWhiteSpace(value))
+ {
+ MonitorSettings[Tfs2017BuildProvider.PersonalAccessTokenSettingsKey] = value;
+ OnPropertyChanged();
+ ConnectCommand?.RaiseCanExecuteChanged();
+ }
}
}
diff --git a/BuildsAppReborn.Access.UI/Views/Tfs2017BuildProviderView.xaml b/BuildsAppReborn.Access.UI/Views/Tfs2017BuildProviderView.xaml
index 73cb8e5..dd44f33 100644
--- a/BuildsAppReborn.Access.UI/Views/Tfs2017BuildProviderView.xaml
+++ b/BuildsAppReborn.Access.UI/Views/Tfs2017BuildProviderView.xaml
@@ -69,7 +69,6 @@
-
+
diff --git a/BuildsAppReborn.Access/BuildMonitor.cs b/BuildsAppReborn.Access/BuildMonitor.cs
index 3c89679..f3cd60f 100644
--- a/BuildsAppReborn.Access/BuildMonitor.cs
+++ b/BuildsAppReborn.Access/BuildMonitor.cs
@@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
-using System.Net;
using System.Threading.Tasks;
using System.Timers;
using BuildsAppReborn.Contracts;
@@ -117,17 +116,20 @@ private async void PollBuilds(IBuildProvider provider, BuildMonitorSettings sett
{
var builds = await Task.Run(() => provider.GetBuilds(settings.SelectedBuildDefinitions, settings));
- if (builds.StatusCode != HttpStatusCode.OK)
+ if (!builds.IsSuccessStatusCode)
{
this.logger.Warn($"Http status code {builds.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 '{builds.StatusCode}'. See log for more details.");
+ }
+ else
+ {
+ OnBuildsUpdated(builds.Data.ToList());
}
-
- OnBuildsUpdated(builds.Data.ToList());
}
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())}.");
+ 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.");
}
}
diff --git a/BuildsAppReborn.Access/Tfs2017BuildProvider.cs b/BuildsAppReborn.Access/Tfs2017BuildProvider.cs
index 8663924..976769a 100644
--- a/BuildsAppReborn.Access/Tfs2017BuildProvider.cs
+++ b/BuildsAppReborn.Access/Tfs2017BuildProvider.cs
@@ -29,10 +29,14 @@ public async Task>> GetBuildDefinitio
var requestUrl = $"{projectUrl}/_apis/build/definitions?api-version={ApiVersion}";
var requestResponse = await GetRequestResponse(requestUrl, settings);
- var result = await requestResponse.Content.ReadAsStringAsync();
- var data = JsonConvert.DeserializeObject>(JObject.Parse(result)["value"].ToString());
-
- return new DataResponse> {Data = data, StatusCode = requestResponse.StatusCode};
+ if (requestResponse.IsSuccessStatusCode)
+ {
+ var result = await requestResponse.Content.ReadAsStringAsync();
+ var data = JsonConvert.DeserializeObject>(JObject.Parse(result)["value"].ToString());
+
+ return new DataResponse> {Data = data, StatusCode = requestResponse.StatusCode};
+ }
+ return new DataResponse> {Data = Enumerable.Empty(), StatusCode = requestResponse.StatusCode};
}
throw new Exception($"Error while processing method!");
@@ -56,12 +60,15 @@ public async Task>> GetBuilds(IEnumerable a.Id));
var requestUrl = $"{projectUrl}/_apis/build/builds?api-version={ApiVersion}&definitions={buildDefinitionsCommaList}&maxBuildsPerDefinition={maxBuilds}";
-
var requestResponse = await GetRequestResponse(requestUrl, settings);
- var result = await requestResponse.Content.ReadAsStringAsync();
- var data = JsonConvert.DeserializeObject>(JObject.Parse(result)["value"].ToString());
-
- return new DataResponse> {Data = data, StatusCode = requestResponse.StatusCode};
+ if (requestResponse.IsSuccessStatusCode)
+ {
+ var result = await requestResponse.Content.ReadAsStringAsync();
+ var data = JsonConvert.DeserializeObject>(JObject.Parse(result)["value"].ToString());
+
+ return new DataResponse> {Data = data, StatusCode = requestResponse.StatusCode};
+ }
+ return new DataResponse> {Data = Enumerable.Empty(), StatusCode = requestResponse.StatusCode};
}
throw new Exception($"Error while processing method!");
diff --git a/BuildsAppReborn.Client/ViewModels/GeneralSettingsViewModel.cs b/BuildsAppReborn.Client/ViewModels/GeneralSettingsViewModel.cs
index a1cc042..0ceb955 100644
--- a/BuildsAppReborn.Client/ViewModels/GeneralSettingsViewModel.cs
+++ b/BuildsAppReborn.Client/ViewModels/GeneralSettingsViewModel.cs
@@ -1,4 +1,6 @@
-using System.ComponentModel.Composition;
+using System;
+using System.ComponentModel.Composition;
+using System.Reflection;
using BuildsAppReborn.Client.Interfaces;
using BuildsAppReborn.Contracts.Models;
using BuildsAppReborn.Infrastructure;
@@ -20,8 +22,19 @@ internal GeneralSettingsViewModel(GlobalSettingsContainer globalSettingsContaine
#endregion
+ #region Implementation of ICloseable
+
+ public void OnClose()
+ {
+ this.updateChecker.Start();
+ }
+
+ #endregion
+
#region Public Properties
+ public Version CurrentAppVersion => Assembly.GetEntryAssembly().GetName().Version;
+
public GeneralSettings GeneralSettings => this.globalSettingsContainer.GeneralSettings;
#endregion
@@ -31,11 +44,6 @@ internal GeneralSettingsViewModel(GlobalSettingsContainer globalSettingsContaine
private readonly GlobalSettingsContainer globalSettingsContainer;
private readonly UpdateChecker updateChecker;
- public void OnClose()
- {
- this.updateChecker.Start();
- }
-
#endregion
}
}
\ No newline at end of file
diff --git a/BuildsAppReborn.Client/Views/GeneralSettingsControl.xaml b/BuildsAppReborn.Client/Views/GeneralSettingsControl.xaml
index 305d22f..a5c14d9 100644
--- a/BuildsAppReborn.Client/Views/GeneralSettingsControl.xaml
+++ b/BuildsAppReborn.Client/Views/GeneralSettingsControl.xaml
@@ -14,56 +14,80 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-