Thursday, May 17, 2012
Google Custom Search

ClearCanvas Highlights

Download our Open Source software
Watch some Videos
Get the Source
Check out our Licensing
Join our  Forums
Some Research: OICR IPP-Trials

Our Community

Membership Membership:
Latest New User Latest: JBauza
New Today New Today: 19
New Yesterday New Yesterday: 33
User Count Overall: 22559

People Online People Online:
Visitors Visitors: 15
Members Members: 1
Total Total: 16

Online Now Online Now:
01: dougsrl

ClearCanvas Community Forums

Application Component
Last Post 2008-07-22 09:34 AM by stewart. 1 Replies.
Printer Friendly
Sort:
PrevPrev NextNext
You are not authorized to post a reply.
Author Messages
cnagrani
Advanced Member
Advanced Member
Posts:60

--
2008-07-19 07:13 PM  
I have created an application component and placed it the main window as a pane. The application component contains a multiline text box. I want to run a background thread that does some processing and updates this text box with the status of my process. Like a online status/logging. How can I expose this text box or application component so I can send it info from my thread. Thanks for any pointers.
Chandru 
stewart
Senior Member
Senior Member
Posts:2128

--
2008-07-22 09:34 AM  
Hi Chandru, you may already be using it, but there is a class in CC.Utilities called BackgroundTask (which wraps the .NET framework BackgroundWorker) that you can use within your application component. The good thing about this class is that the progress events are automatically marshaled back to (and executed on) the UI thread so that you don't have to do that yourself.

To answer your question, though ... If you can, it would be better to run your thread from within the application component, rather than exposing your component so that other classes can manipulate it. As a general rule, the more you can decouple classes from each other (and encapsulate their internal state), the better the design will be, and it will also be easier to maintain your code. If the thread can't be part of your component (usually because other classes also depend on it or need updates from it), then it should be treated as a service. In your case, the service would expose an event that your component subscribes to in order to receive updates. Often, people think of 'services' as being out of process, but they also exist in our code as singleton classes, often with a suffix like 'Manager'.

I think you asked in a previous post about the Import Progress component and the LocalDataStoreActivityMonitor service. This is a good example of an application component subscribing to a service for updates.

Hope this helps,
Stewart
Real-time support available to Clinical Edition and Team Edition customers
You are not authorized to post a reply.

Active Forums 4.1
Copyright 2012 ClearCanvas Inc.