如何在远程数据库中使用 ClearCanvas?

发布于 2024-08-31 07:10:31 字数 1064 浏览 8 评论 0原文

如何使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

似梦非梦 2024-09-07 07:10:31

只是一个想法,OnStart 是一个事件;如果您可以以某种方式提供 StudyLoaderArgs ,那么您可以将代码移动到 Init(ApplicationEntity) 方法中并按如下方式调用它:

Init(myStudyArgs);

以及在 OnStart 中>:

protected override int OnStart(StudyLoaderArgs studyLoaderArgs)
{
    Init(StudyLoaderArgs.Server as ApplicationEntity);
}

--编辑--

  1. 将现有的 OnStart() 正文移动到 Init()

    void Init(ApplicationEntity ae)
    {
    EventResult 结果 = EventResult.Success;
    AuditedInstances loadInstances = new AuditedInstances();
    尝试
    {

     XmlDocument doc = RetrieveHeaderXml(studyLoaderArgs);
        StudyXml StudyXml = new StudyXml();
        StudyXml.SetMemento(doc);
    
        _instances = GetInstances(studyXml).GetEnumerator();
    
        loadInstances.AddInstance(studyXml.PatientId,studyXml.PatientsName,studyXml.StudyInstanceUid);
    
        返回 StudyXml.NumberOfStudyRelatedInstances;
    
    } 
    最后 
    {
        AuditHelper.LogOpenStudies(new string[] { ae.AETitle }, returnedInstances, EventSource.CurrentUser, result);
    }
    

    }

  2. OnStart() 调用 Init()

    受保护的覆盖 int OnStart(StudyLoaderArgs StudyLoaderArgs)
    {
    ApplicationEntity ae = StudyLoaderArgs.Server as ApplicationEntity;
    _ae = ae;
    初始化(ae);
    }

  3. OnStart() 是一个事件,将在服务(假设它是一个服务)启动时调用。更具体地说,事件不是用来调用的,而是作为发生了某事的通知而引发的;我们所做的就是处理事件;即注册一个方法作为该事件的处理程序,然后每次引发该事件时都会调用该方法。

因此,要实现您想要的效果,您可以调用 Init() 而不是 OnStart();但要调用 Init() 你必须提供输入参数,这就是我的第一句话所说的 - 或者它会像 OnStart(EventArgs.Empty); >

不确定这是否能回答你的问题,但在我的头骨之上! (0:

Just a thought, OnStart is an event; if you can provide the StudyLoaderArgs some how, then you can move your code in Init(ApplicationEntity) method and call it like following:

Init(myStudyArgs);

and in OnStart:

protected override int OnStart(StudyLoaderArgs studyLoaderArgs)
{
    Init(StudyLoaderArgs.Server as ApplicationEntity);
}

--EDIT--

  1. Move existing OnStart() body in Init()

    void Init(ApplicationEntity 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);
    }
    

    }

  2. Call Init() from OnStart()

    protected override int OnStart(StudyLoaderArgs studyLoaderArgs)
    {
    ApplicationEntity ae = studyLoaderArgs.Server as ApplicationEntity;
    _ae = ae;
    Init(ae);
    }

  3. 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 than OnStart(); but to call Init() you will have to provide the input arguments, which is what my first sentence says - or it'd be something like OnStart(EventArgs.Empty);

Not sure if this answers your question, but above the top of my skull! (0:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文