Community
Showing results for 
Search instead for 
Do you mean 
Reply

UIContactManager.ShowContact

Copper Contributor
Posts: 119
Country: USA

UIContactManager.ShowContact

by RobEisler on 01-02-2008 3:55 PM

Hello,

I am attempting to have my Plugin display a certain contact record in ACT!. This is quite similar to one of the ACT! sample snippets of code, which displays a random contact. To do this, I (and the sample) use a call like:

ActApp.UIContactManager.ShowContact(cList[0]);

where I have the cList populated with the single contact I'd like to display. When I run the sample or similar code from a menu item in ACT!, it works. However, my code needs to fire based on a file change in another external application. I am doing this by having a FileSystemWatcher watch that file, and then making this ShowContact call from its event.

The problem with this is that the ACT! record counter (the "50 of 140" in the top-left) changes to the correct value for the contact I'm trying to display, but the fields in the contact view do not update to show the contact information. Clicking the button to move to the next contact shows the next contact after "my" contact, showing that the system really did move to it. I looked around to see if there is any kind of refresh call I should make. I found ActApp.RefreshLoadedViews(), which does update the contact view, but ACT! then crashes with an "object reference not set to an instance of an object" error. This is in the new 10.2.

Any suggestions?

Thanks.

Copper Contributor
Posts: 119
Country: USA

Re: UIContactManager.ShowContact

by Mark on 01-02-2008 4:29 PM

ShowContact won't work if it's being called by an async delegate, make sure your call to ShowContact is marshalled back to the main thread.

Also is any of the contact data being changed in the handler for the file watcher?  If so you'll want to call RefreshData on the apps contact list for that record to refresh it.

Have you tried it in any other versions besides 10.0.2 beta?


Mark

Copper Contributor
Posts: 119
Country: USA

Re: UIContactManager.ShowContact

by Carlton Jones on 01-02-2008 4:46 PM

 

Hi Rob,

 

Have you tried ‘ ActApp.Update(); ’ ?

 

Carlton Jones

ACT! SDK Support

 

Copper Contributor
Posts: 119
Country: USA

Re: UIContactManager.ShowContact

by RobEisler on 01-03-2008 11:27 AM
 
Mark:

ShowContact won't work if it's being called by an async delegate, make sure your call to ShowContact is marshalled back to the main thread. 

Thanks, that was it. After setting this up properly (and fixing a couple other little mistakes I won't mention Smiley Happy ) this is working fine. Thanks again for the help.

- Rob

New Member
Posts: 5
Country: Canada

Re: UIContactManager.ShowContact

I am glad you got ShowContact working. I am having the same issue and wondered if you could explain how to "make sure your call to ShowContact is marshalled back to the main thread." Thanks, John
New Member
Posts: 5
Country: Canada

Re: UIContactManager.ShowContact

I guess I gave up too soon. I found an Invoke method on the ActApplication object that I could use. Problem solved.