如何在远程数据库中使用 ClearCanvas?
如何使用 OnStart 方法从 REMOTE 数据库获取数据?
protected override int OnStart(StudyLoaderArgs studyLoaderArgs)
{
ApplicationEntity ae = studyLoaderArgs.Server as ApplicationEntity;
_ae = ae;
EventResult result = EventResult.Success;
AuditedInstances loadedInstances = new AuditedInstances();
try
{
XmlDocument doc = RetrieveHeaderXml(studyLoaderArgs);
StudyXml studyXml = new StudyXml();
studyXml.SetMemento(doc);
_instances = GetInstances(studyXml).GetEnumerator();
loadedInstances.AddInstance(studyXml.PatientId, studyXml.PatientsName, studyXml.StudyInstanceUid);
return studyXml.NumberOfStudyRelatedInstances;
}
finally
{
AuditHelper.LogOpenStudies(new string[] { ae.AETitle }, loadedInstances, EventSource.CurrentUser, result);
}
}
我需要在主项目中使用 OnStart 。我如何使用或调用 OnStart 方法
How can i get data from REMOTE database using OnStart method?
protected override int OnStart(StudyLoaderArgs studyLoaderArgs)
{
ApplicationEntity ae = studyLoaderArgs.Server as ApplicationEntity;
_ae = ae;
EventResult result = EventResult.Success;
AuditedInstances loadedInstances = new AuditedInstances();
try
{
XmlDocument doc = RetrieveHeaderXml(studyLoaderArgs);
StudyXml studyXml = new StudyXml();
studyXml.SetMemento(doc);
_instances = GetInstances(studyXml).GetEnumerator();
loadedInstances.AddInstance(studyXml.PatientId, studyXml.PatientsName, studyXml.StudyInstanceUid);
return studyXml.NumberOfStudyRelatedInstances;
}
finally
{
AuditHelper.LogOpenStudies(new string[] { ae.AETitle }, loadedInstances, EventSource.CurrentUser, result);
}
}
i need to use OnStart in main project. How cn i use or call OnStart method
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只是一个想法,
OnStart
是一个事件;如果您可以以某种方式提供StudyLoaderArgs
,那么您可以将代码移动到Init(ApplicationEntity)
方法中并按如下方式调用它:以及在
OnStart
中>:--编辑--
将现有的
OnStart()
正文移动到Init()
void Init(ApplicationEntity ae)
{
EventResult 结果 = EventResult.Success;
AuditedInstances loadInstances = new AuditedInstances();
尝试
{
}
从
OnStart()
调用Init()
受保护的覆盖 int OnStart(StudyLoaderArgs StudyLoaderArgs)
{
ApplicationEntity ae = StudyLoaderArgs.Server as ApplicationEntity;
_ae = ae;
初始化(ae);
}
OnStart()
是一个事件,将在服务(假设它是一个服务)启动时调用。更具体地说,事件不是用来调用的,而是作为发生了某事的通知而引发的;我们所做的就是处理事件;即注册一个方法作为该事件的处理程序,然后每次引发该事件时都会调用该方法。因此,要实现您想要的效果,您可以调用
Init()
而不是OnStart()
;但要调用Init()
你必须提供输入参数,这就是我的第一句话所说的 - 或者它会像OnStart(EventArgs.Empty);
>不确定这是否能回答你的问题,但在我的头骨之上! (0:
Just a thought,
OnStart
is an event; if you can provide theStudyLoaderArgs
some how, then you can move your code inInit(ApplicationEntity)
method and call it like following:and in
OnStart
:--EDIT--
Move existing
OnStart()
body inInit()
void Init(ApplicationEntity ae)
{
EventResult result = EventResult.Success;
AuditedInstances loadedInstances = new AuditedInstances();
try
{
}
Call
Init()
fromOnStart()
protected override int OnStart(StudyLoaderArgs studyLoaderArgs)
{
ApplicationEntity ae = studyLoaderArgs.Server as ApplicationEntity;
_ae = ae;
Init(ae);
}
OnStart()
is an event, and would be called upon service(assuming that it is a service) start. TO be more specific, events are not there to be called, rather events are raised as a notification that something has happened; all we do is handle the event; i.e. register a method as a handler for that event, and then that method will be invoked each time the event is raised.So, to achieve want you want, you can call
Init()
rather thanOnStart()
; but to callInit()
you will have to provide the input arguments, which is what my first sentence says - or it'd be something likeOnStart(EventArgs.Empty);
Not sure if this answers your question, but above the top of my skull! (0: