本文整理汇总了C#中IPackage.IsTheme方法的典型用法代码示例。如果您正苦于以下问题:C# IPackage.IsTheme方法的具体用法?C# IPackage.IsTheme怎么用?C# IPackage.IsTheme使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPackage
的用法示例。
在下文中一共展示了IPackage.IsTheme方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Update
private void Update(IPackage package)
{
if (package.IsTheme())
{
this.themePackageManager.UpdatePackage(package, false, true);
}
else
{
this.pluginPackageManager.UpdatePackage(package, false, true);
}
}
示例2: ExecuteInstall
/// <summary>
/// Executes a package installation.
/// </summary>
/// <param name="package">The package to install.</param>
/// <param name="packageRepository">The repository for the package.</param>
/// <param name="sourceLocation">The source location.</param>
/// <param name="targetPath">The path where to install the package.</param>
/// <returns>The package information.</returns>
protected PackageInfo ExecuteInstall(IPackage package, IPackageRepository packageRepository, string sourceLocation, string targetPath)
{
var logger = new NugetLogger(_logger);
var project = new FileBasedProjectSystem(targetPath) { Logger = logger };
IPackageRepository referenceRepository;
if (package.IsTheme())
{
referenceRepository = new ThemeReferenceRepository(project, packageRepository, _themeRegistry);
}
else
{
referenceRepository = new PluginReferenceRepository(project, packageRepository, _pluginFinder);
}
var projectManager = new ProjectManager(
packageRepository,
new DefaultPackagePathResolver(targetPath),
project,
referenceRepository
) { Logger = logger };
// add the package to the project
projectManager.AddPackageReference(package, true, false);
return new PackageInfo
{
Id = package.Id,
Name = package.Title ?? package.Id,
Version = package.Version.ToString(),
Type = package.IsTheme() ? "Theme" : "Plugin",
Path = targetPath
};
}
示例3: Uninstall
private void Uninstall(IPackage package)
{
if (package == null)
{
throw new ArgumentNullException("package", "The package cannot be null.");
}
if (package.IsTheme())
{
this.themePackageManager.UninstallPackage(package);
}
else
{
this.pluginPackageManager.UninstallPackage(package);
}
}