本文整理汇总了C#中SIM.Instances.Instance.GetVisualStudioSolutionFiles方法的典型用法代码示例。如果您正苦于以下问题:C# Instance.GetVisualStudioSolutionFiles方法的具体用法?C# Instance.GetVisualStudioSolutionFiles怎么用?C# Instance.GetVisualStudioSolutionFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SIM.Instances.Instance
的用法示例。
在下文中一共展示了Instance.GetVisualStudioSolutionFiles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnClick
public void OnClick(Window mainWindow, Instance instance)
{
if (instance == null)
{
return;
}
var paths = instance.GetVisualStudioSolutionFiles().ToArray();
if (paths.Length > 0)
{
CoreApp.OpenFile(paths.First());
return;
}
const string noThanks = "No, thanks";
const string yesAspNetMvc = "Yes, ASP.NET MVC";
var options = new[] { noThanks, yesAspNetMvc };
var result = WindowHelper.AskForSelection("Choose Visual Studio Project Type", null, "There isn't any Visual Studio project in the instance's folder. \n\nWould you like us to create a new one?", options, mainWindow);
if (result == null || result == noThanks)
{
return;
}
var packageName = "Visual Studio 2015 Website Project.zip";
var product = GetProduct(packageName);
if (product == null)
{
WindowHelper.HandleError("The " + packageName + " package cannot be found in either the .\\Packages folder", false);
return;
}
PipelineManager.StartPipeline("installmodules", new InstallModulesArgs(instance, new[] { product }), isAsync: false);
var path = instance.GetVisualStudioSolutionFiles().FirstOrDefault();
Assert.IsTrue(!string.IsNullOrEmpty(path) && FileSystem.FileSystem.Local.File.Exists(path), "The Visual Studio files are missing");
CoreApp.OpenFile(path);
}
示例2: OnClick
public void OnClick(Window mainWindow, Instance instance)
{
if (instance != null)
{
var paths = instance.GetVisualStudioSolutionFiles().ToArray();
if (paths.Length == 1)
{
WindowHelper.OpenFile(paths.First());
}
else if (paths.Length == 0)
{
var version = instance.Product.Version.SubstringEx(0, 3);
const string noThanks = "No, thanks";
const string yesAspNetWebforms = "Yes, ASP.NET WebForms";
const string yesAspNetMvc = "Yes, ASP.NET MVC";
var packageName = "Visual Studio " + AppSettings.AppToolsVisualStudioVersion.Value + " Website Project.zip";
var is66 = version == "6.6";
var is70 = version == "7.0";
var is7x = version[0] == '7';
var is71plus = is7x && !is70;
var is8 = version[0] == '8';
if (is66 || is7x || is8)
{
var options = is71plus ? new[]
{
noThanks, yesAspNetMvc
} : new[]
{
noThanks, yesAspNetWebforms, yesAspNetMvc
};
var result = WindowHelper.AskForSelection("Choose Visual Studio Project Type", null,
"There isn't any Visual Studio project in the instance's folder. \n\nWould you like us to create a new one?",
options, mainWindow);
if (result == null || result == noThanks)
{
return;
}
if (result == yesAspNetMvc)
{
if (!this.EnsureMvcEnabled(mainWindow, instance, version))
{
return;
}
packageName = "Visual Studio " + AppSettings.AppToolsVisualStudioVersion.Value + " MVC" + (is71plus ? " 4" : string.Empty) + " Website Project.zip";
}
}
Product product = GetProduct(packageName);
if (product == null)
{
WindowHelper.HandleError("The " + packageName + " package cannot be found in either the .\\Packages folder", false, null);
return;
}
PipelineManager.StartPipeline("installmodules", new InstallModulesArgs(instance, new[]
{
product
}), isAsync: false);
var path = instance.GetVisualStudioSolutionFiles().FirstOrDefault();
Assert.IsTrue(!string.IsNullOrEmpty(path) && FileSystem.FileSystem.Local.File.Exists(path), "The Visual Studio files are missing");
WindowHelper.OpenFile(path);
}
else
{
var rootPath = instance.RootPath.ToLowerInvariant();
var virtualPaths = paths.Select(file => file.ToLowerInvariant().Replace(rootPath, string.Empty).TrimStart('\\'));
var path = WindowHelper.AskForSelection("Open Visual Studio", null, "Select the project you need", virtualPaths, mainWindow, paths.First());
if (string.IsNullOrEmpty(path))
{
return;
}
WindowHelper.OpenFile(Path.Combine(rootPath, path));
}
}
}