Is this possible to change with a hook?

This forum is for programmers who have questions about the source code.
Post Reply
User avatar
Justin Shafer
Posts: 596
Joined: Sat Jul 28, 2007 7:34 pm
Location: Fort Worth, TX.

Is this possible to change with a hook?

Post by Justin Shafer » Sat Aug 06, 2016 8:17 pm

I didn't think so, but I thought I would ask...

Instead of an Open File Dialog sending a list of files as a string.. I want to replace it with my own. :) The method is rather large, it is the Import File Dialog in the Images Module.

OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.Multiselect = true;

if (EhrAmendmentCur != null)
{
openFileDialog.Multiselect = false;
}

if (openFileDialog.ShowDialog() != DialogResult.OK)
{
return;
}

string[] fileNames = openFileDialog.FileNames;

if (fileNames.Length < 1)
{
return;
}

User avatar
jsalmon
Posts: 1551
Joined: Tue Nov 30, 2010 12:33 pm
Contact:

Re: Is this possible to change with a hook?

Post by jsalmon » Mon Aug 08, 2016 9:06 am

If the part you pasted is the only part of the method that you don't want to run I would recommend checking out the "goto" option:
If a developer wishes to only replace part of the code in a method, a goto may be used.
Otherwise the easiest kind of hook for taking over entire methods would be the first hook type:
The first type of hook is called HookMethod. It is placed at the very top of a method and is designed to let the plug-in designer completely replace the method with their own code. This is the code that is placed at the top of the method:
http://www.opendental.com/manual/patternplugins.html
The best thing about a boolean is even if you are wrong, you are only off by a bit.

Jason Salmon
Open Dental Software
http://www.opendental.com

Post Reply