Cosmos/source/Cosmos.Build.Builder/Services/VisualStudioSetup/VisualStudioSetupPackageReference.cs
José Pedro f969601a53
Builder improvements.
- Added check for dependencies, which can be installed from the builder.
- Replaced CosmosTask with CosmosBuildDefinition, which is much simpler.
- The builder can be opened without any command line arguments.
- If the VS path is not specified as a command line argument, it can be selected in a dialog.
2018-03-30 19:44:19 +01:00

27 lines
1.3 KiB
C#

using System;
using System.Windows;
using Microsoft.VisualStudio.Setup.Configuration;
namespace Cosmos.Build.Builder.Services.VisualStudioSetup
{
internal class VisualStudioSetupPackageReference : ISetupPackageReference
{
private ISetupPackageReference _setupPackageReference;
public VisualStudioSetupPackageReference(ISetupPackageReference setupPackageReference)
{
_setupPackageReference = setupPackageReference;
}
public string GetId() => RunOnMainThread(_setupPackageReference.GetId);
public string GetVersion() => RunOnMainThread(_setupPackageReference.GetVersion);
public string GetChip() => RunOnMainThread(_setupPackageReference.GetChip);
public string GetLanguage() => RunOnMainThread(_setupPackageReference.GetLanguage);
public string GetBranch() => RunOnMainThread(_setupPackageReference.GetBranch);
string ISetupPackageReference.GetType() => RunOnMainThread(_setupPackageReference.GetType);
public string GetUniqueId() => RunOnMainThread(_setupPackageReference.GetUniqueId);
public bool GetIsExtension() => RunOnMainThread(_setupPackageReference.GetIsExtension);
private static T RunOnMainThread<T>(Func<T> function) => Application.Current.Dispatcher.Invoke(function);
}
}