Page 1 of 1

One more hook

Posted: Tue Apr 05, 2011 12:03 pm
by wjstarck
I need a hook near the bottom of method LayoutControls() after line 2440 on FormOpenDental like so:

Code: Select all

ContrAppt2.Height=height;
try {          <------
Plugins.HookAddCode(ContrAppt2, "FormOpenDental.LayoutControls_bottom"); <------
} catch { } <------
ContrChart2.Location=position;
The try-catch seems to be needed because when OD first loads it calls LayoutControls and I don't think the plugins are quite initialized yet so it bombs. What I'm doing is calling ContrAppt.RefreshModuleScreenPeriod() and ContrAppt.RefreshPeriod() here.

Let me know what naming convention you want to use here. And, I only need this in the head (7.9).

Thanks.

Re: One more hook

Posted: Fri Apr 08, 2011 5:25 am
by jordansparks
We can't put a try-catch in that every customer is guaranteed to hit because it will slow down the load time. We need to find some other way of determining whether plugins are loaded yet.

Re: One more hook

Posted: Fri Apr 08, 2011 6:32 am
by wjstarck
OK.

How about this:

Code: Select all

public static Assembly AssemblyEHR;
public bool pluginsLoaded; <-------
.
.
.

private void FormOpenDental_Load(object sender, System.EventArgs e) {
.
.
Plugins.LoadAllPlugins(this);//moved up from right after optimizing tooth chart graphics.  New position might cause problems.
pluginsLoaded = true; <------
.
}
Then, move the hook to line 2369:

Code: Select all

		private void FormOpenDental_Resize(object sender,EventArgs e) {
			
			LayoutControls();
			if (pluginsLoaded) {  <------
				Plugins.HookAddCode(ContrAppt2, "FormOpenDental.FormOpenDental_Resize_end"); <------
			} <------
		}
NOTE: It doesn't matter whether any plugins have *actually loaded*, I just need to know that I'm past Plugins.LoadAllPlugins(this) on FormOpenDental, so if you think a different naming convention is appropriate for bool pluginsLoaded let me know.

Re: One more hook

Posted: Sun Apr 10, 2011 10:54 am
by jordansparks
Closer. I'd rather make PluginsAreLoaded a static property in the Plugins class. And it might simply check to see if PluginList is null.

Re: One more hook

Posted: Sun Apr 10, 2011 12:03 pm
by wjstarck
Sure. That works.

Thanks.

Re: One more hook

Posted: Tue Apr 26, 2011 3:54 am
by wjstarck
What did we ever decide for this one? Is there something I still need to do?

Also, did we ever decide what to do with this:

viewtopic.php?f=3&t=3322

?

Re: One more hook

Posted: Thu Apr 28, 2011 9:24 am
by michael
The property PluginsAreLoaded has been added to the head.

Simply use if(PluginList.PluginsAreLoaded) {} to enclose any code that requires the Plugins.

Also, your hook has been added as:

Code: Select all

Plugins.HookAddCode(ContrAppt2,"FormOpenDental.LayoutControls_bottom");
at line 2458 of the head.

Re: One more hook

Posted: Thu Apr 28, 2011 11:54 am
by wjstarck
Thanks Michael-

I guess you didn't catch my edit: The hook should be after line 2383 in method FormOpenDental_Resize like so:

Code: Select all

private void FormOpenDental_Resize(object sender,EventArgs e) {
LayoutControls();
Plugins.HookAddCode(ContrAppt2, "FormOpenDental.FormOpenDental_Resize_end") <-----
} 
Thanks again.

Re: One more hook

Posted: Wed Jul 13, 2011 1:06 pm
by michael
So, right now it looks like

Code: Select all

if(Plugins.PluginsAreLoaded) {
				Plugins.HookAddCode(ContrAppt2,"FormOpenDental.LayoutControls_bottom");
			}
I'm not sure why we are passing ContrAppt2 instead of this. Did we discuss this? I'm proposing changing it to

Code: Select all

if(Plugins.PluginsAreLoaded) {
				Plugins.HookAddCode(this,"FormOpenDental.FormOpenDental_Resize_end");
			}

when we move it to the FormOpenDental_Resize() function. Does that give you what you need?

Re: One more hook

Posted: Thu Jul 14, 2011 3:44 am
by wjstarck
Hi Michael-

I'm accessing method ContrApptA.RefreshModuleData with this; changing ContrAppt2 to 'this' breaks things. So I'd want it to read:

Code: Select all

if(Plugins.PluginsAreLoaded) {
            Plugins.HookAddCode(ContrAppt2,"FormOpenDental.FormOpenDental_Resize_end");
         }

Re: One more hook

Posted: Thu Jul 14, 2011 6:12 am
by michael
You should be able to use the sender (FormOpenDental/this) to access ContrAppt2. Otherwise you may just need the hook inside ContrAppt. We won't use ContrAppt2 as the sender, because its not the sender. Sending ContrAppt2 was a mistake that we will correct when we move the hook.

So, can you confirm you still want me to move it to here, knowing it will have this as a sender?

Re: One more hook

Posted: Thu Jul 14, 2011 10:09 am
by wjstarck
OK, I've reworked my code so that

Code: Select all

private void FormOpenDental_Resize(object sender,EventArgs e) {
LayoutControls();
	if (Plugins.PluginsAreLoaded) {
		Plugins.HookAddCode(this, "FormOpenDental.FormOpenDental_Resize_end");
	}
}
will work just fine.

Thanks.

Re: One more hook

Posted: Tue Jul 19, 2011 6:32 am
by michael
Hook has been moved. It is in the new location in 11.05 (beta).

Re: One more hook

Posted: Tue Jul 19, 2011 6:44 am
by wjstarck
Nice.

Thanks.