小编Zdr*_*lev的帖子

如何使用GetClientScriptsInDocument从Source View智能标记设计器访问客户端脚本

我试图获取ASP页面的脚本节点块并通过代码实现动态修改它.为了做到这一点,我有一个自定义向导(组件设计器),我从设计视图源视图(ASP页面视图)打开.我已经在asp标记中定义了块.如果我从设计视图中打开设计器(带有智能标记),GetClientScriptsInDocument将返回现有节点,我可以修改它(例如添加一个javascript函数),尽管如果我从源视图中打开设计器,那么GetClientSciptsInDocument是返回null.

我的部分代码来自"Pro ASP.NET Extensibility"一书,我用它来获取设计器主机(通常是Visual Studio),并从那里获得RootDesigner(WebFormsRootDesigner类)和客户端脚本.

代码段:

internal ScriptNodeCollection GetScriptNodes()
{
    IDesignerHost host = this.designer.Component.Site.GetService(typeof(IDesignerHost)) as IDesignerHost;
    WebFormsRootDesigner root = host.GetDesigner(host.RootComponent) as WebFormsRootDesigner;

    if (root == null) return null;
    ClientScriptItemCollection scriptItems = root.GetClientScriptsInDocument();
    ....
}
Run Code Online (Sandbox Code Playgroud)

(this)是DesignerHelper(自定义类)类型,它继承System.Windows.Forms.Design.ControlDesigner

这是某种.NET限制吗?使用自定义设计器时,只能使用设计视图访问脚本节点块,或者我遗漏了什么?

.net c# asp.net windows-forms-designer visual-studio-2015

7
推荐指数
0
解决办法
86
查看次数

使用 Microsoft 托管代理执行构建定义时出现“运行其他请求问题”

我收到的错误消息是Error: The agent request is not running because all potential agents are running other requests. Current position in queue: 1

当我使用 Microsoft 代理执行构建定义时,会导致上述错误。构建执行花了几天时间,而且已经很多了。有人可以帮我解决这个问题吗?

我尝试使用 Microsoft 代理“Azure pipelines”的场景:

  1. 重新安装自承载代理并再次重新配置代理。

azure-devops azure-pipelines

7
推荐指数
1
解决办法
2万
查看次数