本文整理汇总了C#中IManager.Owner_SetApplicationManifest方法的典型用法代码示例。如果您正苦于以下问题:C# IManager.Owner_SetApplicationManifest方法的具体用法?C# IManager.Owner_SetApplicationManifest怎么用?C# IManager.Owner_SetApplicationManifest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IManager
的用法示例。
在下文中一共展示了IManager.Owner_SetApplicationManifest方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateTask
/// <summary>
/// Creates a task on the Manager from the provided XML task representation and returns its Id.
/// </summary>
/// <param name="manager"></param>
/// <param name="sc">Security Credentials</param>
/// <param name="taskXml"></param>
/// <returns>application id</returns>
public static string CreateTask(IManager manager, SecurityCredentials sc, string taskXml)
{
// TODO: validate against schema
string taskId = manager.Owner_CreateApplication(sc);
XmlDocument doc = new XmlDocument();
doc.LoadXml(taskXml);
FileDependencyCollection manifest = new FileDependencyCollection();
foreach (XmlNode manifestFile in doc.SelectNodes("task/manifest/embedded_file"))
{
EmbeddedFileDependency dep = new EmbeddedFileDependency(manifestFile.Attributes["name"].Value);
dep.Base64EncodedContents = manifestFile.InnerText;
manifest.Add(dep);
logger.Debug("Added dependency to manifest: " + dep.FileName);
}
manager.Owner_SetApplicationManifest(sc, taskId, manifest);
foreach (XmlNode jobXml in doc.SelectNodes("task/job"))
{
int jobId = int.Parse(jobXml.Attributes["id"].Value);
jobXml.Attributes.Remove(jobXml.Attributes["id"]);
// TODO: allow setting of priority in xml file
AddJob(manager, sc, taskId, jobId, 0, jobXml.OuterXml);
logger.Debug("Added job to manager: " + jobId);
}
return taskId;
}