- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
根据 this blog post by Adam Najmanowicz ,使用 Sitecore.Jobs.AsyncUI 中的 JobMonitor 和 JobContext 类从后台作业打开警报或确认对话框应该相对容易。我无法让它工作。谁能告诉我我错过了什么?我的控件的 CodeBeside 类如下。我试过将它作为模式对话框和应用程序打开,但它没有显示任何警报。
public class JobMonitorTestForm : BaseForm
{
protected JobMonitor Monitor;
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
if (this.Monitor == null)
{
if (!Context.ClientPage.IsEvent)
{
this.Monitor = new JobMonitor { ID = "Monitor" };
Context.ClientPage.Controls.Add(this.Monitor);
}
else
{
this.Monitor = Context.ClientPage.FindControl("Monitor") as JobMonitor;
}
}
this.Monitor.JobFinished += this.JobFinished;
this.Monitor.JobDisappeared += this.JobFinished;
this.Monitor.Start("JobMonitorTest", "Test", this.Run);
}
private void JobFinished(object sender, EventArgs eventArgs)
{
SheerResponse.Alert("Job finished!");
}
private void Run()
{
Thread.Sleep(2000);
JobContext.Alert("Hello!");
Thread.Sleep(2000);
}
}
更新
我找到了另一条线索,但我仍然一头雾水。我的日志文件显示以下异常。这是 Sitecore.Web.UI.Sheer.ClientPage 的构造函数中的空引用异常,因为 HttpContext.Current 为空。这是有道理的,因为调用是从后台线程启动的,但我认为 AsyncUI 命名空间中的类的全部意义在于解决这个问题。
ManagedPoolThread #3 23:18:28 ERROR Exception
Exception: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at (Object , Object[] )
at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
at Sitecore.Jobs.Job.ThreadEntry(Object state)
Nested Exception
Exception: System.NullReferenceException
Message: Object reference not set to an instance of an object.
Source: Sitecore.Kernel
at Sitecore.Web.UI.Sheer.ClientPage..ctor()
at Sitecore.Web.UI.Sheer.SheerResponse.Alert(String text, String[] arguments)
at TestApp.sitecore.shell.Applications.Dialogs.JobMonitorTest.JobMonitorTestForm.Run() in c:\Projects\sc66Test\TestApp\TestApp\sitecore\shell\Applications\Dialogs\JobMonitorTest\JobMonitorTestForm.cs:line 45
at Sitecore.Jobs.AsyncUI.JobMonitor.TaskRunner.Run()
最佳答案
您发布的代码有一个小问题,就像异步 UI 中的任何内容一样引起了大量调查:)
问题在于时机。您不能在 OnLoad 中执行作业创建,因为这会在请求有时间往返于用户并由浏览器中的监视器控件处理之前使用监视器。基本上,工作还没有什么可坚持的。
有两种解决方法。您可以显示您的对话框,并作为用户按下按钮/功能区/菜单,这将触发一个事件来启 Action 业。另一种方法是我在 PowerShell Extensions 中所做的当我想让运行者在没有用户干预的情况下开始工作时。在 Sheer 控件中包含一个 JavaScript,它会在页面加载后向您的对话框发送一个事件:
window.onload=function(){
scForm.postRequest("", "", "", "psr:execute");
};
然后在您控件的代码旁边:
[HandleMessage("psr:execute", true)]
protected virtual void Execute(ClientPipelineArgs args)
{
// Do the Job starting through the monitor.
}
希望对您有所帮助。如果您有任何问题,我将非常乐意分享更多详细信息或提供示例
关于sitecore - 无法让 Sitecore JobMonitor/JobContext 显示对话框,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22241653/
我已将 Active Directory 模块与 sitecore 集成,我可以在 sitecore 用户管理器中看到广告中的用户。现在我想验证广告用户是否可以登录 sitecore。我为用户分配了
有没有办法通过代码访问Sitecore设置。 我感兴趣的具体设置是数据文件夹路径。 最佳答案 如果您想获得其他设置,您可能需要尝试:- Sitecore.Configuration.Settings.
根据 Sitecore 数据定义引用,版本 6.4,第 4.3.1 节: Sitecore processes queries using the fasted technology possible
Sitecore 6.6(更新4)。 MaxMind具有与DMS集成的Sitecore-specific lookup service选项。 MaxMind还具有一些更通用的Web服务。 可以将“通用
当我在 Sitecore 单行字段文本框中按 ENTER 时,它会呈现两个换行符 此问题仅出现在 Chrome/Firefox 中。在 IE ENTER 中只导致一个 我可以在这些浏览器中以某种方式
好奇为什么我无法从那里取回任何物品 HistoryManager.GetHistory(database, fromThisDate, toThisDate) ,我查看了 Sitecore 数据库,发
我们正在使用Sitecore 6.2,并且要求在Sitecore管理网站上使用SSL。 除了将内容保存在Rich Text编辑器中(单击“接受”按钮)时,所有指向媒体库项目的URL都将添加“ http
如何以编程方式登录 Sitecore? 例如,如果您想将 Sitecore API 的一小部分连接到桌面应用程序,则需要先登录到 sitecore 才能访问数据库等。 这可以做到吗? 最佳答案 正如
我已将 Sitecore 安装设置到两个不同的 IIS 站点。一个包含所有 Sitecore 管理文件,另一个包含共享相同 Web.config 的干净 Web 文件,而我的 Data 文件夹位于这两
我在一台开发服务器上安装了 sitecore,并将站点根文件夹复制到一堆开发机器上。此过程在 7 台计算机中的 6 台上运行良好,我们可以正常看到 sitecore 登录和内容编辑器页面,并通过 II
我已经设置了一个本地 Sitecore 环境,所有 sql 和 mongodb 数据库都可以正常工作。 除了我在体验文件(联系人)中没有获得任何数据 我看到 mongo 中的tracking_cont
我的 Sitecore 网站要求用户名是电子邮件地址。 我可以在代码中成功创建用户,但每当我尝试在用户管理器上的 Sitecore CMS 中手动创建 Extranet 用户时,都会引发电子邮件用户名
客户询问 Sitecore 中是否有任何地方内容作者可以为内容项的单个版本添加内部注释。该注释可能会说“我更改了内容字段以包含更新的描述”之类的内容。这与您在工作流程中提交项目时简单地添加评论不同。他
现在我的 sitecore 工作流程遇到问题。问题如下: 我的模板标准值已设置工作流程和默认工作流程字段集。工作流程状态设置为草稿。但是,每次我从此模板创建项目时,它都不会继承工作流程部分字段,所有字
我在 sitecore 用户管理器中遇到了这个奇怪的错误。我一打开用户管理器就收到此错误我无法将用户分配给角色。 有人可以帮忙吗? 提前致谢。 P.S > 以防万一它无法正确显示:http://www
我知道有一个 SortOrder 字段。然而,在我看来,该字段很多次都是空的,直到您真正开始在列表中四处移动内容项。然后,如果您有一个项目列表并四处移动其中一些项目,将为它们分配一个 SortOrde
我知道这听起来像是一个愚蠢的问题,但无数的谷歌搜索都没有给我想要的答案。我看到很多关于如何基于 Sitecore 模板等格式化电子邮件的数据,但没有关于实际发送邮件的信息。我是否需要通过 .net 代
我想 Hook item:renamed 事件来做一些处理。不过可能需要几分钟。事件处理程序是与正常管道执行异步执行还是同步执行?如果我需要自己执行此操作,是否有标准的 Sitecore 方法可以异步
我一直在浏览 Sitecore.Kernel,但似乎找不到 Sitecore 运行 Initialize 管道的位置。它是在每个页面请求上运行还是在应用程序启动时只运行一次?您能指出为此管道调用 Ru
我已经在 sitecore 中安装了重定向模块。在模块内部,我创建了“重定向网址”。在重定向网址中,我写了请求的网址“http://domainname/pagename”并从内容中选择了重定向到。但
我是一名优秀的程序员,十分优秀!