-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed setting dialogs and furthe rthings
Added basic diagnosticsclient
- Loading branch information
1 parent
28b7bd3
commit 01d54f8
Showing
42 changed files
with
885 additions
and
963 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
using System; | ||
using System; | ||
using System.IO; | ||
using System.Reflection; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using Microsoft.ApplicationInsights; | ||
using Microsoft.ApplicationInsights.Extensibility; | ||
|
||
namespace BuildVision.Common.Diagnostics | ||
{ | ||
public static class DiagnosticsClient | ||
{ | ||
private static bool _initialized; | ||
private static TelemetryClient _client; | ||
|
||
|
||
public static void Initialize(string apiKey) | ||
{ | ||
if (!string.IsNullOrWhiteSpace(apiKey)) | ||
{ | ||
TelemetryConfiguration.Active.InstrumentationKey = apiKey; | ||
TelemetryConfiguration.Active.TelemetryChannel.DeveloperMode = Debugger.IsAttached; | ||
TelemetryConfiguration.Active.TelemetryInitializers.Add(new VersionTelemetry()); | ||
TelemetryConfiguration.Active.TelemetryInitializers.Add(new SessionTelemetry()); | ||
|
||
_initialized = true; | ||
|
||
_client = new TelemetryClient(); | ||
} | ||
} | ||
|
||
public static void OnExit() | ||
{ | ||
if (!_initialized) return; | ||
|
||
_client.Flush(); | ||
// Allow time for flushing: | ||
System.Threading.Thread.Sleep(1000); | ||
} | ||
|
||
public static void TrackEvent(string eventName, IDictionary<string, string> properties = null, IDictionary<string, double> metrics = null) | ||
{ | ||
if (!_initialized) return; | ||
_client.TrackEvent(eventName, properties, metrics); | ||
} | ||
|
||
public static void TrackTrace(string evt) | ||
{ | ||
if (!_initialized) return; | ||
_client.TrackTrace(evt); | ||
} | ||
|
||
public static void Notify(Exception exception) | ||
{ | ||
if (!_initialized) return; | ||
|
||
_client.TrackException(exception); | ||
} | ||
|
||
public static void TrackPageView(string pageName) | ||
{ | ||
if (!_initialized) return; | ||
|
||
_client.TrackPageView(pageName); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
using System; | ||
using System.Diagnostics; | ||
using System.Runtime.InteropServices; | ||
using System.Security.Cryptography; | ||
using System.Text; | ||
using Microsoft.ApplicationInsights.Channel; | ||
using Microsoft.ApplicationInsights.Extensibility; | ||
|
||
namespace BuildVision.Common.Diagnostics | ||
{ | ||
class SessionTelemetry : ITelemetryInitializer | ||
{ | ||
private readonly string _userName; | ||
private readonly string _operatingSystem = RuntimeInformation.OSDescription?.Replace("Microsoft ", ""); // Shorter description | ||
private readonly string _session = Guid.NewGuid().ToString(); | ||
|
||
#if STORE | ||
private const string Channel = "store"; | ||
#elif NIGHTLY | ||
private const string Channel = "nightly"; | ||
#elif CHOCO | ||
private const string Channel = "chocolatey"; | ||
#else | ||
private const string Channel = "zip"; | ||
#endif | ||
|
||
|
||
public SessionTelemetry() | ||
{ | ||
try | ||
{ | ||
using (var hash = SHA256.Create()) | ||
{ | ||
var hashBytes = hash.ComputeHash(Encoding.UTF8.GetBytes(Environment.MachineName + Environment.UserDomainName + Environment.UserName)); | ||
_userName = Convert.ToBase64String(hashBytes); | ||
} | ||
} | ||
catch | ||
{ | ||
// No user id | ||
} | ||
} | ||
|
||
public void Initialize(ITelemetry telemetry) | ||
{ | ||
telemetry.Context.GlobalProperties["Environment"] = Channel; | ||
// Always default to development if we're in the debugger | ||
if (Debugger.IsAttached) | ||
{ | ||
telemetry.Context.GlobalProperties["Environment"] = "development"; | ||
} | ||
|
||
if (_userName != null) | ||
{ | ||
telemetry.Context.User.Id = _userName; | ||
} | ||
|
||
telemetry.Context.Session.Id = _session; | ||
telemetry.Context.Device.OperatingSystem = _operatingSystem; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
using System; | ||
using System.Linq; | ||
using System.Reflection; | ||
using Microsoft.ApplicationInsights.Channel; | ||
using Microsoft.ApplicationInsights.Extensibility; | ||
|
||
namespace BuildVision.Common.Diagnostics | ||
{ | ||
class VersionTelemetry : ITelemetryInitializer | ||
{ | ||
private readonly string _appVersion; | ||
|
||
public VersionTelemetry() | ||
{ | ||
_appVersion = typeof(DiagnosticsClient).Assembly.GetCustomAttributes<AssemblyMetadataAttribute>() | ||
.FirstOrDefault(ama => string.Equals(ama.Key, "CloudBuildNumber", StringComparison.OrdinalIgnoreCase)) | ||
?.Value; | ||
} | ||
|
||
public void Initialize(ITelemetry telemetry) | ||
{ | ||
telemetry.Context.Component.Version = _appVersion; | ||
} | ||
} | ||
} |
15 changes: 0 additions & 15 deletions
15
src/BuildVision.Contracts/Models/IBuildProgressViewModel.cs
This file was deleted.
Oops, something went wrong.
11 changes: 9 additions & 2 deletions
11
src/BuildVision.Exports/Providers/IBuildInformationProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 0 additions & 16 deletions
16
src/BuildVision.Exports/Providers/IBuildingProjectsProvider.cs
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
namespace BuildVision.Exports.Services | ||
using BuildVision.UI.Models; | ||
|
||
namespace BuildVision.Exports.Services | ||
{ | ||
public interface IBuildService | ||
{ | ||
void ShowGridColumnsSettingsPage(); | ||
void ShowGeneralSettingsPage(); | ||
void BuildSolution(); | ||
void CleanSolution(); | ||
void RebuildSolution(); | ||
void CancelBuildSolution(); | ||
void ProjectCopyBuildOutputFilesToClipBoard(); | ||
void RaiseCommandForSelectedProject(); | ||
void ProjectCopyBuildOutputFilesToClipBoard(IProjectItem projItem); | ||
void RaiseCommandForSelectedProject(IProjectItem projectItem, int command); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using BuildVision.Contracts; | ||
|
||
namespace BuildVision.Exports.Services | ||
{ | ||
public interface ITaskBarInfoService | ||
{ | ||
void ResetTaskBarInfo(bool ifTaskBarProgressEnabled = true); | ||
void UpdateTaskBarInfo(BuildState buildState, BuildScopes buildScope, int projectsCount, int finishedProjects); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/BuildVision.UI/Converters/InProgressToBoolConverter.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
using System; | ||
using System.Globalization; | ||
using System.Windows.Data; | ||
using BuildVision.Contracts; | ||
|
||
namespace BuildVision.UI.Converters | ||
{ | ||
[ValueConversion(typeof(BuildState), typeof(bool))] | ||
public class InProgressToBoolConverter : IValueConverter | ||
{ | ||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
var buildState = (BuildState)value; | ||
return buildState == BuildState.InProgress; | ||
} | ||
|
||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.